* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* ── AUTH SCREENS ── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: #111;
    border: 1px solid #222;
    border-radius: 18px;
    padding: 28px 24px;
}

.auth-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(220,38,38,0.12);
    border: 1.5px solid #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 26px;
}

/* ── FORM FIELDS ── */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.field label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.field input {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.field input:focus {
    border-color: #dc2626;
}

/* ── BUTTONS ── */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

button:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.btn {
    display: block;
    width: 100%;
    padding: 13px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
}

.btn-accent {
    background: #dc2626;
    color: #fff;
}

.btn-accent:hover {
    background: #b91c1c;
}

.btn-ghost {
    background: transparent;
    border: 1px solid #333;
    color: #999;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-ghost:hover {
    border-color: #555;
    color: #ccc;
}

.btn-ghost-sm {
    background: transparent;
    border: 1px solid #333;
    color: #888;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.btn-ghost-sm:hover {
    border-color: #555;
    color: #ccc;
}

.btn-sm {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-approve {
    background: #10b981;
    color: #fff;
}

.btn-approve:hover {
    background: #059669;
}

.btn-reject-card {
    background: #ef4444;
    color: #fff;
}

.btn-reject-card:hover {
    background: #dc2626;
}

.btn-makeadmin {
    background: #6366f1;
    color: #fff;
}

.btn-makeadmin:hover {
    background: #4f46e5;
}

.btn-edit {
    background: #6366f1;
    color: #fff;
}

.btn-edit:hover {
    background: #4f46e5;
}

/* ── APP HEADER ── */
.app-header {
    background: #111;
    border-bottom: 1px solid #1a1a1a;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-title {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: -0.3px;
}

.app-title span {
    color: #dc2626;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.role-badge {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-sa {
    background: rgba(99,102,241,0.15);
    color: #6366f1;
}

.role-admin {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
}

.role-user {
    background: rgba(148,163,184,0.12);
    color: #8896ab;
}

/* ── ADMIN NAV ── */
.admin-nav {
    display: flex;
    gap: 4px;
    margin-left: 24px;
}

.admin-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.admin-tab:hover {
    color: #999;
    background: rgba(255,255,255,0.03);
}

.admin-tab.active {
    color: #dc2626;
    background: rgba(220,38,38,0.1);
    border-color: rgba(220,38,38,0.3);
}

/* ── MAIN CONTAINER ── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px;
}

/* ── CONTROLS ── */
.controls {
    margin-bottom: 24px;
}

.search-row {
    display: flex;
    gap: 0;
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.search-row:focus-within {
    border-color: #dc2626;
}

#fio-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1rem;
    background: transparent;
    color: #fff;
    border: none;
    outline: none;
}

#fio-input::placeholder {
    color: #555;
}

#btn-load {
    padding: 14px 32px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: #dc2626;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#btn-load:hover {
    background: #b91c1c;
}

#btn-load:active {
    background: #991b1b;
}

/* ── SUGGESTIONS ── */
.suggestions {
    background: #111;
    border: 1px solid #222;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.suggestions .item {
    padding: 11px 18px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.15s;
    border-bottom: 1px solid #1a1a1a;
    color: #ccc;
}

.suggestions .item:last-child {
    border-bottom: none;
}

.suggestions .item:hover {
    background: #1a0000;
    color: #fff;
}

.suggestions .item.marked {
    background: #dc2626;
    color: #fff;
}

/* ── LOADING ── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 48px;
    color: #666;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #222;
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── ERROR BOX ── */
.error-box {
    background: #1a0000;
    color: #fca5a5;
    border: 1px solid #7f1d1d;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

/* ── SUMMARY ── */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.summary .card {
    background: #111;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.3s;
}

.summary .card:hover {
    border-color: #dc2626;
}

.summary .card .value {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.summary .card .label {
    font-size: 0.75rem;
    color: #666;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── TABS ── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #1a1a1a;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab:hover {
    color: #999;
}

.tab.active {
    color: #dc2626;
    border-bottom-color: #dc2626;
    font-weight: 700;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* ── ERROR CARDS ── */
.error-card {
    background: #111;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.error-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dc2626;
}

.error-card:hover {
    border-color: #333;
}

.error-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.error-card .card-num {
    font-weight: 700;
    font-size: 0.9rem;
    color: #dc2626;
}

.error-card .card-penalty {
    background: #dc2626;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 3px 12px;
    border-radius: 20px;
    min-width: 36px;
    text-align: center;
}

.error-card .card-penalty.zero {
    background: #222;
    color: #666;
}

.error-card .fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    font-size: 0.9rem;
}

.error-card .field {
    display: flex;
    gap: 8px;
}

.error-card .field-label {
    color: #555;
    white-space: nowrap;
}

.error-card .field-value {
    color: #ccc;
    word-break: break-word;
}

.error-card .field.full {
    grid-column: 1 / -1;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #444;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── ADMIN: USER CARDS ── */
.user-card {
    background: #111;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s;
}

.user-card:hover {
    border-color: #333;
}

.user-card-info {
    flex: 1;
    min-width: 0;
}

.user-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-card-meta {
    font-size: 0.8rem;
    color: #666;
}

.user-card-fio {
    font-size: 0.8rem;
    color: #999;
    margin-top: 2px;
}

.user-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pending {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
}

.status-active {
    background: rgba(16,185,129,0.15);
    color: #10b981;
}

.status-rejected {
    background: rgba(148,163,184,0.12);
    color: #8896ab;
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 500;
}

.modal-sheet {
    background: #111;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 480px;
    padding: 20px 20px 32px;
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin: 0 auto 16px;
}

.modal-sheet select {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    color: #fff;
    outline: none;
    appearance: auto;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
    .error-card .fields {
        grid-template-columns: 1fr;
    }

    .summary {
        grid-template-columns: 1fr 1fr;
    }

    .tabs {
        gap: 0;
    }

    .tab {
        padding: 10px 12px;
        font-size: 0.78rem;
    }

    .app-header {
        padding: 10px 16px;
    }

    .header-right {
        gap: 8px;
    }

    #user-name {
        display: none;
    }

    .user-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-card-actions {
        width: 100%;
    }

    .user-card-actions .btn {
        flex: 1;
    }
}
