* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: rgb(31, 36, 48);
    background: linear-gradient(135deg, rgb(31, 36, 48) 0%, rgb(77, 86, 57) 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ============ HEADER ============ */

.header {
    text-align: center;
    color: rgb(255, 255, 255);
    margin-bottom: 20px;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 10px;
}

.header h1 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
}

.header p {
    font-size: 1.1em;
    color: rgb(138, 155, 106);
    font-weight: 500;
}

.btn-logout {
    position: absolute;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============ TABS ============ */

.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 0;
    padding: 0 8px;
}

.tab {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    transition: background 0.2s;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.25);
}

.tab.active {
    background: rgb(255, 255, 255);
    color: rgb(31, 36, 48);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============ MAIN CARD ============ */

.main-content {
    background: rgb(255, 255, 255);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.add-user-section,
.files-controls {
    margin-bottom: 30px;
}

.add-user-section h2,
.users-section h2,
.files-controls h2 {
    color: rgb(31, 36, 48);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgb(138, 155, 106);
}

/* ============ FORM ============ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: rgb(77, 86, 57);
    margin-bottom: 8px;
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    padding: 12px 15px;
    border: 2px solid rgb(138, 155, 106);
    border-radius: 8px;
    font-size: 1em;
    color: rgb(31, 36, 48);
    background: rgb(255, 255, 255);
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: rgb(77, 86, 57);
    box-shadow: 0 0 0 3px rgba(138, 155, 106, 0.3);
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    background: rgb(138, 155, 106);
    color: rgb(255, 255, 255);
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    background: rgb(77, 86, 57);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(31, 36, 48, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-cancel {
    background: rgb(31, 36, 48);
}

.btn-cancel:hover {
    background: rgb(77, 86, 57);
}

.btn-full {
    width: 100%;
}

/* ============ TABLE ============ */

.table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(31, 36, 48, 0.1);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: rgb(255, 255, 255);
    min-width: 900px;
}

.users-table thead {
    background: rgb(31, 36, 48);
    color: rgb(255, 255, 255);
}

.users-table th,
.users-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(138, 155, 106, 0.3);
}

.users-table th {
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgb(138, 155, 106);
}

.users-table tbody tr:hover {
    background-color: rgba(138, 155, 106, 0.1);
}

.users-table td {
    color: rgb(31, 36, 48);
    vertical-align: middle;
}

.user-id {
    font-weight: 700;
    color: rgb(77, 86, 57);
}

.user-position {
    background: rgb(138, 155, 106);
    color: rgb(255, 255, 255);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.contact-info {
    font-size: 0.9em;
    color: rgb(77, 86, 57);
}

.user-token {
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    background: rgba(31, 36, 48, 0.08);
    color: rgb(31, 36, 48);
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-action {
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    color: rgb(255, 255, 255);
    font-family: inherit;
}

.btn-action:hover {
    transform: translateY(-1px);
}

.btn-edit        { background: rgb(138, 155, 106); }
.btn-edit:hover  { background: rgb(77, 86, 57); }

.btn-delete      { background: rgb(31, 36, 48); }
.btn-delete:hover{ background: rgb(77, 86, 57); }

.btn-activate    { background: rgb(76, 175, 80); }
.btn-activate:hover { background: rgb(56, 142, 60); }

.btn-deactivate  { background: rgb(255, 152, 0); }
.btn-deactivate:hover { background: rgb(230, 126, 0); }

.btn-promote     { background: rgb(255, 193, 7); color: rgb(60, 45, 0); }
.btn-promote:hover { background: rgb(230, 170, 0); }

.btn-demote      { background: rgb(120, 120, 120); }
.btn-demote:hover{ background: rgb(90, 90, 90); }

.btn-restore     { background: rgb(76, 175, 80); }
.btn-restore:hover { background: rgb(56, 142, 60); }

.btn-ignore      { background: rgb(113, 113, 198); }
.btn-ignore:hover{ background: rgb(90, 90, 165); }

/* ============ STATUS & ROLE BADGES ============ */

.status, .role {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
}

.status-active    { background: rgba(76, 175, 80, 0.15); color: rgb(46, 125, 50); border: 1px solid rgba(76, 175, 80, 0.4); }
.status-inactive  { background: rgba(244, 67, 54, 0.12); color: rgb(183, 28, 28); border: 1px solid rgba(244, 67, 54, 0.35); }
.status-unknown   { background: rgba(158, 158, 158, 0.15); color: rgb(97, 97, 97); border: 1px solid rgba(158, 158, 158, 0.4); }

.role-admin { background: rgba(255, 193, 7, 0.18); color: rgb(180, 130, 0); border: 1px solid rgba(255, 193, 7, 0.5); }
.role-user  { background: rgba(158, 158, 158, 0.15); color: rgb(97, 97, 97); border: 1px solid rgba(158, 158, 158, 0.4); }

.empty-state {
    text-align: center;
    padding: 40px;
    color: rgb(138, 155, 106);
    font-style: italic;
}

/* ============ FILES ============ */

.files-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 15px;
}

.files-controls h2 {
    flex: 1 1 auto;
    margin-bottom: 0;
}

.files-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: rgb(77, 86, 57);
    font-size: 0.9em;
    cursor: pointer;
}

.search-input {
    padding: 8px 14px;
    border: 2px solid rgb(138, 155, 106);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95em;
    min-width: 260px;
}

.search-input:focus {
    outline: none;
    border-color: rgb(77, 86, 57);
}

.btn-refresh {
    background: rgb(138, 155, 106);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-refresh:hover {
    background: rgb(77, 86, 57);
}

.files-table td {
    font-size: 0.9em;
}

.file-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 700;
    white-space: nowrap;
}

.file-status-active  { background: rgba(76, 175, 80, 0.15); color: rgb(46, 125, 50); border: 1px solid rgba(76, 175, 80, 0.4); }
.file-status-deleted { background: rgba(244, 67, 54, 0.12); color: rgb(183, 28, 28); border: 1px solid rgba(244, 67, 54, 0.35); }

.file-path {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    word-break: break-all;
}

tr.row-deleted {
    background: rgba(244, 67, 54, 0.05);
}

/* ============ LOGIN ============ */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: rgb(255, 255, 255);
    border-radius: 15px;
    padding: 40px 35px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-title {
    color: rgb(31, 36, 48);
    font-size: 2em;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.login-subtitle {
    color: rgb(138, 155, 106);
    text-align: center;
    margin-bottom: 30px;
    font-size: 1em;
    font-weight: 500;
}

.login-error {
    color: rgb(183, 28, 28);
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    min-height: 20px;
    margin-bottom: 10px;
}

.login-card .form-group {
    margin-bottom: 18px;
}

/* ============ MODAL ============ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h3 {
    color: rgb(31, 36, 48);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.modal p {
    color: rgb(77, 86, 57);
    margin-bottom: 15px;
    font-size: 0.95em;
}

.modal-file-path {
    font-family: 'Courier New', monospace;
    background: rgba(31, 36, 48, 0.06);
    padding: 8px 12px;
    border-radius: 6px;
    word-break: break-all;
    font-size: 0.85em;
}

.modal .form-group {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.token-display {
    font-family: 'Courier New', monospace;
    background: rgba(31, 36, 48, 0.06);
    padding: 15px;
    border-radius: 6px;
    word-break: break-all;
    font-size: 1em;
    color: rgb(31, 36, 48);
    text-align: center;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .users-table {
        font-size: 0.85em;
    }

    .users-table th,
    .users-table td {
        padding: 10px 8px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .action-buttons {
        flex-direction: column;
    }

    .files-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .files-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        min-width: 0;
        width: 100%;
    }
}