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

:root {
    /* Platform colors (Brand North) — fixed, matches logo #000062 */
    --platform: #000062;
    --platform-light: #0a0a7a;
    --platform-dark: #00004a;

    /* Company colors — updated dynamically by JS from company data */
    --primary: #000062;
    --primary-light: #0a0a7a;
    --primary-bg: #ededf5;
    --accent: #c0c0c0;
    --accent-hover: #a8a8a8;

    --success: #059669;
    --success-bg: #ECFDF5;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-500: #6B7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --white: #FFFFFF;
    --sidebar-w: 250px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
}

.hidden { display: none !important; }

/* ── Login ── */
#login-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: linear-gradient(135deg, var(--platform-dark) 0%, var(--platform) 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: var(--white); border-radius: 12px; padding: 40px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center; margin-bottom: 20px;
}
.login-logo img {
    max-width: 220px; height: auto;
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; color: var(--gray-900); text-align: center; }
.login-card p { color: var(--gray-500); margin-bottom: 24px; font-size: 14px; text-align: center; }
.login-card .error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 20px; }

/* ── Layout ── */
#app { display: flex; min-height: 100vh; }

#sidebar {
    width: var(--sidebar-w); background: var(--platform); color: var(--white);
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 100;
}
.sidebar-company {
    padding: 8px 20px 12px; font-size: 12px; color: rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.sidebar-logo {
    padding: 16px 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    min-height: 64px;
}
.sidebar-logo img {
    height: 32px; width: auto; flex-shrink: 0;
}
.sidebar-logo span { font-weight: 700; font-size: 14px; line-height: 1.2; }
.nav-links { list-style: none; padding: 8px 0; flex: 1; overflow-y: auto; }
.nav-links li a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: rgba(255,255,255,0.75); text-decoration: none;
    font-size: 14px; transition: all 0.15s;
}
.nav-links li a:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-links li a.active { background: rgba(255,255,255,0.18); color: var(--white); border-left: 3px solid var(--accent); }
.nav-links li a .icon { width: 20px; text-align: center; }
.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: space-between; font-size: 13px;
}
.sidebar-footer span { color: rgba(255,255,255,0.75); }
#logout-btn {
    background: none; border: 1px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.85);
    padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
#logout-btn:hover { background: rgba(255,255,255,0.15); }

/* ── Admin Viewing Banner ── */
.admin-viewing-banner {
    background: var(--platform);
    color: #fff;
    padding: 8px 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    border-radius: var(--radius);
}
.admin-viewing-banner strong { margin-right: 4px; }
.admin-viewing-banner .banner-actions { display: flex; gap: 8px; }
.admin-viewing-banner .banner-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}
.admin-viewing-banner .banner-btn:hover { background: rgba(255,255,255,0.3); }
.sidebar-viewing-indicator {
    padding: 8px 20px;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-viewing-indicator a {
    color: rgba(255,255,255,0.8);
    text-decoration: underline;
    cursor: pointer;
    font-size: 11px;
}
.sidebar-viewing-indicator a:hover { color: #fff; }

#content { margin-left: var(--sidebar-w); flex: 1; padding: 24px 32px; max-width: 1200px; }

/* ── Page Header ── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header .subtitle { color: var(--gray-500); font-size: 14px; margin-top: 2px; }

/* ── Cards ── */
.card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 16px; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px;
}
.stat-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .value { font-size: 24px; font-weight: 700; }
.stat-card .value.success { color: var(--success); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.primary { color: var(--primary); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left; padding: 10px 12px; background: var(--gray-50);
    color: var(--gray-500); font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--gray-50); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500; color: var(--gray-700);
    margin-bottom: 4px;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
input[type="text"], input[type="email"], input[type="number"], input[type="date"],
select, textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300);
    border-radius: 6px; font-size: 14px; font-family: inherit;
    background: var(--white); transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,31,94,0.1);
}
input[type="number"] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500;
    cursor: pointer; border: none; font-family: inherit; transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: var(--gray-900); font-weight: 600; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
    background: var(--white); color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Badges ── */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 12px; font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }

/* ── Score Input ── */
.score-select {
    width: 60px; text-align: center; padding: 6px 4px;
    border: 2px solid var(--gray-200); border-radius: 6px;
    font-size: 16px; font-weight: 600;
}
.score-select:focus { border-color: var(--primary); }

/* ── Scoring Cards ── */
.scoring-card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
}
.scoring-card .emp-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.scoring-card .emp-name { font-weight: 600; font-size: 15px; }
.scoring-card .emp-pool { color: var(--gray-500); font-size: 13px; }
.scoring-card .kpi-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid var(--gray-100);
}
.scoring-card .kpi-row:last-child { border-bottom: none; }
.scoring-card .kpi-name { font-size: 14px; }
.scoring-card .kpi-weight { color: var(--gray-500); font-size: 12px; }

/* ── Modal ── */
#modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.4); display: flex;
    align-items: center; justify-content: center;
}
.modal {
    background: var(--white); border-radius: 12px; padding: 24px;
    width: 100%; max-width: 500px; box-shadow: var(--shadow-lg);
    max-height: 80vh; overflow-y: auto;
}
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Toast ── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 600; }
.toast {
    background: var(--gray-900); color: var(--white); padding: 12px 20px;
    border-radius: 8px; font-size: 14px; margin-bottom: 8px;
    box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Quarter Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tab {
    padding: 8px 20px; border: 1px solid var(--gray-300); border-radius: 6px;
    background: var(--white); cursor: pointer; font-size: 14px; font-weight: 500;
}
.tab.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ── Pool % Validation ── */
.pool-total { font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 6px; }
.pool-total.valid { background: var(--success-bg); color: var(--success); }
.pool-total.invalid { background: var(--danger-bg); color: var(--danger); }

/* ── Checkbox Multi-Select ── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-group label {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 10px; background: var(--gray-100); border-radius: 4px;
    font-size: 13px; cursor: pointer;
}
.checkbox-group input[type="checkbox"] { width: auto; }

/* ── Responsive ── */
@media (max-width: 768px) {
    #sidebar { width: 60px; }
    .sidebar-logo span, .sidebar-company, .nav-links li a span, .sidebar-footer span { display: none; }
    .sidebar-logo img { height: 24px; }
    .nav-links li a { justify-content: center; padding: 12px; }
    .sidebar-footer { justify-content: center; }
    #content { margin-left: 60px; padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Dollar format ── */
.money::before { content: '$'; }

/* ── Empty state ── */
.empty-state {
    text-align: center; padding: 40px; color: var(--gray-500); font-size: 14px;
}

/* ── Nav Module Accordions ── */
.nav-module-header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 20px; cursor: pointer;
    color: rgba(255,255,255,0.55); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 2px; transition: color 0.15s;
    user-select: none;
}
.nav-module-header:hover { color: rgba(255,255,255,0.85); }
.nav-module-header.has-active { color: rgba(255,255,255,0.75); }
.nav-module-header .chevron {
    font-size: 10px; transition: transform 0.2s; flex-shrink: 0;
}
.nav-module-header.expanded .chevron { transform: rotate(90deg); }
.nav-module-header .mod-icon { width: 16px; text-align: center; font-size: 13px; }
.nav-module-items { list-style: none; overflow: hidden; }
.nav-module-items.collapsed { display: none; }
.nav-module-items li a {
    padding-left: 36px !important; font-size: 13px !important;
}

/* ── Dropdown Lists (payer search, etc.) ── */
.dropdown-list {
    position: absolute; z-index: 20; width: 100%;
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    max-height: 240px; overflow-y: auto; margin-top: 2px;
}
.dropdown-list .dropdown-item:hover {
    background: var(--gray-50);
}

/* ── Wide Modal ── */
.modal-wide { max-width: 900px; }
.modal-wide .table-wrap { max-height: 400px; overflow-y: auto; }

/* ── CSV Import ── */
.csv-drop-zone {
    border: 2px dashed var(--gray-300); border-radius: var(--radius);
    padding: 32px; text-align: center; cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.csv-drop-zone:hover, .csv-drop-zone.dragover {
    border-color: var(--primary); background: var(--primary-bg);
}
.csv-drop-zone input[type="file"] { display: none; }
.csv-error-row { background: var(--danger-bg) !important; }
.csv-error-cell { color: var(--danger); font-size: 12px; font-style: italic; }
.csv-summary { display: flex; gap: 16px; margin: 12px 0; font-size: 14px; }
.csv-summary .stat { font-weight: 600; }
.csv-summary .stat.valid { color: var(--success); }
.csv-summary .stat.invalid { color: var(--danger); }

/* ── Star Rating (Reviews) ── */
.star-rating { display: flex; gap: 8px; justify-content: center; margin: 20px 0; }
.star-rating .star {
    font-size: 48px; cursor: pointer; color: var(--gray-300);
    transition: color 0.15s, transform 0.15s;
}
.star-rating .star:hover { transform: scale(1.15); }
.star-rating .star.active { color: #F59E0B; }
.star-rating .star.hover { color: #FBBF24; }

/* ── Interview Wizard ── */
.wizard-progress {
    display: flex; align-items: center; gap: 4px; margin-bottom: 24px;
    padding: 0 4px;
}
.wizard-step {
    flex: 1; height: 4px; border-radius: 2px;
    background: var(--gray-200); transition: background 0.3s;
}
.wizard-step.completed { background: var(--success); }
.wizard-step.active { background: var(--primary); }
.wizard-nav {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 24px; padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}
.wizard-section-title {
    font-size: 18px; font-weight: 600; margin-bottom: 16px;
    padding-bottom: 8px; border-bottom: 2px solid var(--primary);
}
.question-card {
    padding: 12px 0; border-bottom: 1px solid var(--gray-100);
}
.question-card:last-child { border-bottom: none; }
.question-label {
    font-size: 14px; font-weight: 500; margin-bottom: 6px;
    display: flex; align-items: center; gap: 6px;
}
.question-label .required { color: var(--danger); }
.scale-buttons { display: flex; gap: 4px; }
.scale-btn {
    width: 36px; height: 36px; border-radius: 6px;
    border: 2px solid var(--gray-200); background: var(--white);
    font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.scale-btn:hover { border-color: var(--primary); }
.scale-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.yes-no-toggle { display: flex; gap: 4px; }
.yes-no-btn {
    padding: 6px 20px; border: 2px solid var(--gray-200); border-radius: 6px;
    background: var(--white); cursor: pointer; font-weight: 500;
    transition: all 0.15s;
}
.yes-no-btn:hover { border-color: var(--primary); }
.yes-no-btn.active-yes { background: var(--success); color: var(--white); border-color: var(--success); }
.yes-no-btn.active-no { background: var(--danger); color: var(--white); border-color: var(--danger); }
.mode-toggle {
    display: flex; gap: 2px; background: var(--gray-100);
    border-radius: 6px; padding: 2px;
}
.mode-toggle .toggle-btn {
    padding: 4px 12px; border-radius: 4px; border: none;
    background: transparent; font-size: 12px; cursor: pointer;
    font-weight: 500; transition: all 0.15s;
}
.mode-toggle .toggle-btn.active {
    background: var(--white); box-shadow: var(--shadow);
}
