:root {
    --primary: #D73F09; /* OSU Orange */
    --bg-body: #1a1a1a;
    --bg-card: #2c2c2c;
    --text-main: #f1f1f1;
    --text-muted: #a0a0a0;
    --border: #444444;
    --success: #2eaea2; /* A brighter teal for visibility on dark */
    --purple: #a855f7; /* For Classified */
    --diff-pos: #4ade80;
    --diff-neg: #f87171;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: var(--bg-body); color: var(--text-main); margin: 0; padding: 20px; }

.container { max-width: 1200px; margin: 0 auto; }

/* Search Header */
.header { margin-bottom: 30px; }
h1 { font-size: 1.5rem; margin-bottom: 10px; color: var(--text-main); }

.section-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 25px 0;
    width: 100%;
}

.search-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.advanced-toggle {
    background: #2a2a2a;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.advanced-toggle:hover,
.advanced-toggle:focus-visible {
    border-color: var(--primary);
    outline: none;
}
.advanced-search {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background: #242424;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.exclusions-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
    background: #333;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
    flex: 1;
    justify-content: space-between;
    min-width: 200px;
}

.exclusion-title {
    font-weight: 600;
    color: var(--text-main);
}

.exclusion-select {
    background: #2a2a2a;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    min-width: 160px;
    font-size: 0.9rem;
}

.chip-container {
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: -5px;
    margin-bottom: 10px;
    min-height: 28px; /* Prevent jump */
}

.chip {
    background: #2a2a2a;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.chip:hover {
    background: #3a3a3a;
    color: var(--text-main);
    border-color: var(--primary);
}

.search-wrapper {
    flex: 2;
    display: flex;
    position: relative;
    min-width: 200px;
}

.advanced-toggle {
    align-self: center;
}

.search-bar {
    width: 100%;
    padding: 16px;
    padding-right: 40px; /* Space for clear button */
    font-size: 16px;
    border: 1px solid var(--border);
    background-color: #333;
    color: var(--text-main);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    outline: none;
    transition: border-color 0.2s;
}
.search-bar:focus { border-color: var(--primary); }

.regex-pill {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    background: #3a2f16;
    border: 1px solid #8a6a1e;
    color: #facc15;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    pointer-events: none;
}

.regex-pill.hidden {
    display: none;
}

.search-autocomplete {
    width: 100%;
    background: #242424;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: -4px;
    margin-bottom: 2px;
}

.search-autocomplete.hidden {
    display: none;
}

.autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: #2a2a2a;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    border-color: var(--primary);
    background: #353535;
}

.autocomplete-type {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dsl-help {
    width: 100%;
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    color: var(--text-muted);
    background: #212121;
    margin-bottom: 8px;
}

.dsl-help summary {
    cursor: pointer;
    font-size: 0.82rem;
}

.dsl-help-body {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dsl-chip {
    background: #2d2d2d;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 8px;
    color: var(--text-main);
    font-size: 0.75rem;
}

.search-hit {
    background: rgba(215, 63, 9, 0.25);
    color: #ffd8ca;
    border-radius: 3px;
    padding: 0 2px;
}

.no-results-panel {
    text-align: center;
    color: var(--text-muted);
    padding: 20px 12px;
    background: #222;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.no-results-title {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 8px;
}

.no-results-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

.clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    padding: 0;
    line-height: 1;
}
.clear-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.1); }
.clear-btn.hidden { display: none; }

.filter-select, .filter-input {
    flex: 1;
    padding: 16px;
    font-size: 16px;
    border: 1px solid var(--border);
    background-color: #333;
    color: var(--text-main);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    outline: none;
    min-width: 150px;
}

/* Stats Bar */
.stats {
    display: flex; gap: 20px; margin-bottom: 20px; font-size: 0.9rem; color: var(--text-muted);
}

.search-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 20px;
    padding: 12px;
    background: #242424;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.search-suggestions.hidden { display: none; }
.suggestions-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.suggestion-chip {
    background: #2a2a2a;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.suggestion-chip:hover {
    background: #3a3a3a;
    border-color: var(--primary);
}

/* Person Card */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    overflow: hidden;
    transition: transform 0.1s ease;
}
.card:hover { transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }

/* Card Header (Always Visible) */
.card-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.card-header:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.person-info h2 { margin: 0 0 5px 0; font-size: 1.1rem; color: var(--primary); }
.person-info p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.latest-stat { text-align: right; }
.latest-salary { font-weight: 700; color: var(--success); font-family: monospace; font-size: 1.1rem; }
.latest-role { font-size: 0.85rem; color: var(--text-muted); }

.data-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.12);
    border: 1px solid rgba(250, 204, 21, 0.35);
    color: #facc15;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Expandable History Section */
.history {
    display: none; /* Hidden by default */
    border-top: 1px solid var(--border);
    background-color: #222;
    padding: 20px;
}
.card.expanded .history { display: block; }
.card.expanded .card-header { background-color: #333; }
.history-loading { color: var(--text-muted); font-size: 0.9rem; padding: 6px 0; }

.data-quality {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(250, 204, 21, 0.08);
    border: 1px solid rgba(250, 204, 21, 0.25);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #fbbf24;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-actions {
    margin-top: 10px;
}
.link-btn.small {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* Individual Trend */
.personal-trend-section {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
}
.trend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.trend-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.legend-line {
    width: 18px;
    height: 0;
    border-top: 2px dashed rgba(250, 204, 21, 0.85);
    display: inline-block;
}
.trend-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}
.trend-mode {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 4px 8px;
    border-radius: 999px;
    cursor: pointer;
    outline: none;
}
.trend-mode:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.trend-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 3px 8px;
    border-radius: 999px;
    cursor: pointer;
}
.trend-toggle input {
    accent-color: var(--primary);
}
.person-chart-wrap {
    height: 220px;
    position: relative;
}
.person-chart-wrap .trend-legend {
    position: absolute;
    top: 6px;
    right: 8px;
    background: rgba(0,0,0,0.35);
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
}
.trend-empty {
    padding: 18px;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}

.cola-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 6px;
    background: #facc15;
    color: #111;
    font-weight: 800;
    font-size: 0.8rem;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.2);
}

.exclusion-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 6px;
    background: #38bdf8;
    color: #0b1220;
    font-weight: 800;
    font-size: 0.7rem;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.record-gap {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #fbbf24;
}

.trend-insights {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insight-item {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.trend-insights-section {
    /* Styled by .collapsible-section */
}

.collapsible-section {
    margin-top: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
    overflow: hidden;
}
.section-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--text-main);
    font-weight: 600;
    padding: 10px 12px;
    border: none;
    cursor: pointer;
}
.section-toggle::after {
    content: '▸';
    float: right;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.section-toggle[aria-expanded="true"]::after {
    transform: rotate(90deg);
}
.collapsible-body {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.collapsible-body.hidden { display: none; }
.record-appearances .collapsible-body:not(.hidden) {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* History Table */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--text-muted); font-weight: 600; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
td { padding: 12px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-wrap {
    width: 100%;
    overflow-x: auto;
}
.table-wrap:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Badges */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.badge-source { background: #444; color: #ccc; margin-top: 4px; }
.badge-type { background: #1e293b; color: #93c5fd; border: 1px solid #3b82f6; }

/* Salary Term Badge (12 mo / 9 mo) */
.term-badge {
    display: inline-block;
    background: #312e81;
    color: #a5b4fc;
    border: 1px solid #4f46e5;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.7rem;
    margin-left: 6px;
    vertical-align: middle;
    font-family: sans-serif;
    font-weight: 500;
}

.missing-pay {
    display: inline-block;
    color: #f59e0b;
    font-weight: 600;
    font-size: 0.85rem;
}

.date-cell { width: 140px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.money-cell { font-family: monospace; font-weight: 600; color: var(--text-main); }
.hourly-rate {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Diff Styles */
.diff-val {
    display: block;
    font-size: 0.75rem;
    margin-top: 2px;
    font-weight: normal;
}
.diff-positive { color: var(--diff-pos); }
.diff-negative { color: var(--diff-neg); }

/* Utility */
.hidden { display: none; }
.loader-sentinel { height: 50px; margin: 20px 0; text-align: center; color: var(--text-muted); }

.help-cursor {
    cursor: help;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    color: var(--text-muted);
}
.help-cursor:hover {
    color: var(--text-main);
}

.custom-tooltip {
    position: fixed;
    background: #111;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none; /* Let mouse pass through */
    z-index: 9999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    border: 1px solid #444;
    max-width: 250px;
    line-height: 1.4;
    transition: opacity 0.1s ease;
}

/* Dashboard & Header Extras */
.title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.icon-btn {
    background: #333;
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 12px;
}
.section-title {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}
.section-toggle {
    background: #333;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.section-toggle:hover { background: #3a3a3a; border-color: var(--primary); }

/* Collapsible */
.collapsible.hidden { display: none; }
.historical-grid { margin-bottom: 20px; }
.dashboard.historical-grid {
    display: block;
    margin-bottom: 20px;
}

.historical-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #facc15;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    margin-bottom: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.historical-warning-icon {
    font-size: 1rem;
    line-height: 1;
}

.historical-kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.historical-kpi {
    background: #242424;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.historical-kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.historical-kpi-value {
    margin-top: 5px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: monospace;
}

.historical-core-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 12px;
}

.historical-primary-grid,
.historical-advanced-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.historical-card {
    min-height: 350px;
    position: relative;
}

.historical-hero-card {
    min-height: 380px;
}

.chart-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 52px;
    margin-bottom: 6px;
}

.chart-title-row .stat-label {
    margin-bottom: 0;
}

.chart-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-muted);
    text-decoration: none;
    user-select: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.chart-info-icon:hover,
.chart-info-icon:focus-visible {
    border-color: var(--primary);
    color: #fff;
    background: rgba(215, 63, 9, 0.35);
    outline: none;
}

.historical-canvas-wrap {
    position: relative;
    height: 270px;
}

.historical-canvas-wrap.short {
    height: 245px;
}

.historical-expand-row {
    display: flex;
    justify-content: center;
    margin: 6px 0 10px;
}

.historical-more-btn {
    min-width: 180px;
}

.historical-advanced-panel.hidden {
    display: none;
}

.historical-advanced-panel {
    margin-top: 8px;
}

.historical-card .status-error {
    color: #fca5a5;
}

.historical-card .status-muted {
    color: var(--text-muted);
}

.chart-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #252525;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    z-index: 3;
}

.chart-fullscreen-btn:hover,
.chart-fullscreen-btn:focus-visible {
    background: #333;
    border-color: var(--primary);
    outline: none;
}

.historical-card:fullscreen,
.historical-card.pseudo-fullscreen {
    background: var(--bg-card);
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: 20px;
    box-sizing: border-box;
    z-index: 10000;
}

.historical-card:fullscreen .chart-title-row,
.historical-card.pseudo-fullscreen .chart-title-row {
    padding-right: 64px;
}

.historical-card:fullscreen .historical-canvas-wrap,
.historical-card.pseudo-fullscreen .historical-canvas-wrap {
    height: calc(100vh - 130px);
}

.historical-card:fullscreen .historical-canvas-wrap.short,
.historical-card.pseudo-fullscreen .historical-canvas-wrap.short {
    height: calc(100vh - 130px);
}

.historical-no-scroll {
    overflow: hidden;
}

@media (max-width: 1023px) and (min-width: 700px) {
    .historical-primary-grid,
    .historical-advanced-grid {
        gap: 12px;
    }
    .historical-card {
        min-height: 335px;
    }
}

/* Stats Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    animation: fadeIn 0.4s ease-out;
}

.stat-card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card.wide {
    grid-column: span 2;
}

/* Vertical Stack for Service + Roles */
.stat-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.stat-column.wide {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .stat-card.wide { grid-column: span 1; }
    .stat-column.wide { grid-column: span 1; }
    .stat-card.full-width-mobile { grid-column: 1 / -1; }
}

.stat-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 5px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-main); font-family: monospace; }
.stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Bar Chart */
.bar-chart-container { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.bar-chart {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #444;
}
.bar-segment { height: 100%; transition: width 0.5s ease; }
.bar-segment.classified { background-color: var(--purple); }
.bar-segment.unclassified { background-color: var(--primary); }

.bar-legend { display: flex; gap: 15px; font-size: 0.8rem; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.classified { background-color: var(--purple); }
.dot.unclassified { background-color: var(--primary); }


/* Tenure Chart */
.tenure-chart {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #444;
    margin-bottom: 8px;
}
.tenure-seg { height: 100%; transition: width 0.5s ease; }
.tenure-seg.t1 { background-color: #4ade80; }
.tenure-seg.t2 { background-color: #22c55e; }
.tenure-seg.t3 { background-color: #16a34a; }
.tenure-seg.t4 { background-color: #15803d; }

/* Leaderboard */
.leaderboard { display: flex; flex-direction: column; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.lb-label { width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); text-align: right; }
.lb-bar-container { flex: 1; display: flex; align-items: center; gap: 8px; }
.lb-bar { height: 8px; background: var(--primary); border-radius: 4px; transition: width 0.5s ease; min-width: 2px; }
.lb-val { font-family: monospace; font-weight: bold; color: var(--text-main); }

/* Donut Chart */
.donut-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}
.donut-chart {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #444; /* Fallback */
    /* Mask for donut hole */
    -webkit-mask: radial-gradient(transparent 55%, black 56%);
    mask: radial-gradient(transparent 55%, black 56%);
}
.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Filter Inputs */
.salary-inputs {
    display: flex;
    gap: 10px;
    flex: 1 1 250px;
    min-width: 250px;
}
/* Hide spin buttons for number input */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }


/* Modal */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity 0.3s ease;
}
.modal.hidden { display: none; opacity: 0; pointer-events: none; }

.modal-content {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 30px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh; /* Ensure it fits in viewport */
    overflow-y: auto; /* Enable internal scrolling */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    position: relative;
    animation: slideUp 0.3s ease;
    border: 1px solid var(--border);
}
.close {
    position: absolute; top: 15px; right: 20px; font-size: 24px; cursor: pointer; color: var(--text-muted);
    background: none; border: none; padding: 0; line-height: 1;
}
.close:hover { color: var(--text-main); }
.modal-footer { margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); text-align: center; border-top: 1px solid var(--border); padding-top: 15px; }
.modal-content h2 { margin-top: 0; color: var(--primary); }
.modal-content h3 { font-size: 1rem; margin-top: 20px; }
.modal-content ul { padding-left: 20px; color: var(--text-muted); }
.modal-content li { margin-bottom: 8px; }

.def-list li { margin-bottom: 12px; line-height: 1.5; }
.def-list strong { color: var(--primary); }

.modal-section {
    margin-bottom: 1.5rem;
}

.collapsible-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    outline: none;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s;
}

.collapsible-btn:hover,
.collapsible-btn:focus-visible {
    color: var(--primary);
}

.collapsible-btn .icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.collapsible-btn[aria-expanded="true"] .icon {
    transform: rotate(90deg);
    color: var(--primary);
}

/* Remove border for the last item or specific styling?
   Actually, a border separation is nice.
*/

.collapsible-content {
    margin-top: 10px;
    padding-bottom: 5px;
}

.collapsible-content.hidden {
    display: none;
}

.warning-box {
    background-color: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 1rem;
    border-radius: 4px;
    color: #856404;
}

.warning-box h3 {
    margin-top: 0;
    color: #856404;
}

.subtitle {
    font-style: italic;
    color: #666;
    margin-top: -10px;
    margin-bottom: 20px;
}

/* Modal Links */
.modal-content a {
    color: #60a5fa; /* Light blue for dark background */
    text-decoration: none;
}
.modal-content a:hover {
    text-decoration: underline;
}

/* Warning box links need to be dark */
.warning-box a {
    color: #533f03;
    font-weight: bold;
    text-decoration: underline;
}

/* Link Button (View on GitHub) */
.link-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 20px;
    background-color: var(--primary);
    color: #fff !important;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none !important;
    transition: background-color 0.2s, transform 0.1s;
}
.link-btn:hover {
    background-color: #b83508;
    transform: translateY(-1px);
    text-decoration: none;
}

.kofi-btn {
    background-color: #72a4f2;
    margin-left: 10px;
}
.kofi-btn:hover {
    background-color: #558dc6;
}

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Deep Link Styles */
.name-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.link-btn-card {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0; /* Hidden by default until hover */
    transition: opacity 0.2s, transform 0.2s;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
}
.link-btn-card.report-btn {
    font-weight: 800;
    color: #fbbf24;
}

/* Show button when hovering the name area or the card header */
.card-header:hover .link-btn-card {
    opacity: 0.4;
}

.link-btn-card:hover {
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.link-btn-card:focus {
    opacity: 1;
    outline: 2px solid var(--primary);
}

/* Toast Notification */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--bg-card);
    color: var(--text-main);
    text-align: center;
    border-radius: 8px;
    padding: 12px 20px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid var(--primary);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    font-size: 0.9rem;
}

/* Mobile/coarse pointer: keep card action buttons visible and tappable */
@media (max-width: 700px), (pointer: coarse) {
    .name-header {
        flex-wrap: wrap;
        column-gap: 8px;
        row-gap: 6px;
        align-items: flex-start;
        width: 100%;
    }

    .name-header h2 {
        flex: 1 1 100%;
        margin: 0;
        font-size: 1rem;
    }

    .link-btn-card {
        opacity: 0.85;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
        background: rgba(255, 255, 255, 0.06);
        border-radius: 8px;
        flex: 0 0 auto;
    }

    .card-header:hover .link-btn-card {
        opacity: 0.85;
    }
}

.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

.year-separator {
    width: 100%;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.5rem;
}

/* Ensure the first year doesn't have a huge top margin */
.year-separator:first-child {
    margin-top: 10px;
}

/* Style for the Active Chip */
.chip.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Minor tweak to grid to ensure it clears the float/flex of the header */
.records-grid {
    margin-bottom: 20px;
}


.year-separator {
    width: 100%;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.5rem;
}

.year-separator:first-child {
    margin-top: 10px;
}

.chip.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.toggle-container:hover {
    border-color: var(--primary);
    color: var(--text-main);
    background: #3a3a3a;
}

@media (max-width: 700px) {
    body { padding: 12px; }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px;
    }
    .latest-stat { text-align: left; width: 100%; }
    .latest-salary { font-size: 1rem; }
    .history { padding: 16px; }
    .chip-container { margin-bottom: 6px; }
    .search-wrapper { min-width: 100%; }
    .filter-select, .filter-input { width: 100%; min-width: 100%; }
    .salary-inputs { min-width: 100%; }
    .link-btn-card { opacity: 0.6; }
    .bar-legend { flex-wrap: wrap; }
    .historical-kpi-strip {
        grid-template-columns: 1fr;
    }
    .historical-primary-grid,
    .historical-advanced-grid {
        grid-template-columns: 1fr;
    }
    .historical-card,
    .historical-hero-card {
        min-height: 320px;
    }
    .historical-canvas-wrap {
        height: 230px;
    }
    .historical-canvas-wrap.short {
        height: 210px;
    }
    .chart-info-icon {
        width: 24px;
        height: 24px;
        font-size: 0.82rem;
    }
}
