/* Final product-system layer. Loaded after legacy styles to prevent drift. */
:root {
    --background: #f7f8fa;
    --foreground: #172033;
    --card: #fff;
    --card-foreground: #172033;
    --primary: #2563eb;
    --primary-foreground: #fff;
    --secondary: #fff;
    --secondary-foreground: #344054;
    --muted: #f3f4f6;
    --muted-foreground: #667085;
    --accent: #eff6ff;
    --accent-foreground: #1d4ed8;
    --destructive: #c93636;
    --border: #e4e7ec;
    --input: #d7dce3;
    --ring: #2563eb;
    --sidebar-background: #fff;
    --sidebar-foreground: #475467;
    --sidebar-accent: #f1f5f9;
    --sidebar-accent-foreground: #1d4ed8;
    --sidebar-border: #e7e9ee;
    --radius: 9px;
    --shadow: none;
}

html { background: var(--background); }

body:not(.login-page) {
    grid-template-columns: 244px minmax(0, 1fr);
    background: var(--background);
    font-size: 16px;
    letter-spacing: -.01em;
}

.main {
    max-width: none;
    padding: 24px 28px 40px;
}

.sidebar {
    padding: 16px 12px 12px;
    border-left-color: var(--sidebar-border);
    box-shadow: none;
}

.sidebar-header { padding: 0 4px 12px; }
.sidebar-content { padding-top: 6px; }
.sidebar-group { padding: 6px 4px; }
.sidebar-group + .sidebar-group { margin-top: 2px; padding-top: 8px; }

.sidebar-group-label {
    height: 24px;
    padding-inline: 8px;
    color: #98a2b3;
    font-size: 12px;
}

.sidebar-menu-button {
    min-height: 36px;
    padding: 7px 8px;
    border-radius: 7px;
    color: #475467;
    font-size: 14.5px;
}

.sidebar-menu-button:hover,
.sidebar-menu-button:focus-visible { background: #f7f8fa; color: #1d2939; }
.sidebar-menu-button.is-active { background: #eff4ff; color: #1d4ed8; }

.sidebar-menu-button.is-active::before {
    top: 7px;
    right: -4px;
    bottom: 7px;
    width: 2px;
}

.sidebar-footer {
    margin: 8px 4px 0;
    padding: 12px 8px 2px;
    border: 0;
    border-top: 1px solid var(--sidebar-border);
    border-radius: 0;
    background: transparent;
}

.sidebar-status-dot,
.live-dot { width: 6px; height: 6px; box-shadow: none; }

.topbar {
    min-height: 54px;
    margin-bottom: 20px;
    padding-bottom: 16px;
}

.topbar h1 {
    margin-bottom: 3px;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.025em;
}

.topbar p { color: #667085; font-size: 13px; }

.topbar-date,
.profile-chip {
    min-height: 36px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.topbar-date { padding-inline: 8px; color: #667085; font-size: 12.5px; }

.profile-chip {
    padding: 0 8px;
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.profile-chip > b { border-radius: 7px; background: #f2f4f7; color: #475467; }

.logout-button {
    min-height: 36px;
    border-color: transparent;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    color: #475467;
}

.logout-button:hover { border-color: transparent; background: #f2f4f7; color: #1d2939; }

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.stats-grid article {
    min-height: 112px;
    padding: 16px 18px;
    border: 0;
    border-left: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.stats-grid article:last-child { border-left: 0; }
.metric-card::after { display: none; }

.metric-blue,
.metric-violet,
.metric-orange { --metric-color: #2563eb; --metric-soft: #eff4ff; }

.metric-card-head small { color: #475467; font-size: 13px; font-weight: 600; }
.metric-card-head i { width: 28px; height: 28px; border-radius: 7px; }
.stats-grid .metric-card > span { margin: 8px 0 2px; font-size: 28px; font-weight: 700; }
.metric-card p { color: #98a2b3; font-size: 12px; }

.panel,
.login-card {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: none;
}

.panel-head,
.section-heading,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-heading { padding-bottom: 12px; border-bottom: 1px solid #eef0f3; }

.section-heading h2,
.panel-head h2,
.analytics-head h2 {
    margin: 0;
    color: #1d2939;
    font-size: 16px;
    font-weight: 600;
}

.section-heading p,
.analytics-head p { margin: 3px 0 0; color: #667085; font-size: 12.5px; }

.dashboard-charts-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr);
    gap: 16px;
}

.analytics-card { min-height: 0; }

.chart-range-filter {
    display: inline-flex;
    width: auto;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f8f9fb;
}

.chart-range {
    min-width: 48px;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 5px;
    color: #667085;
    font-size: 12px;
}

.chart-range:hover,
.chart-range.is-active {
    background: #fff;
    color: #1d4ed8;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .07);
}

.dashboard-chart {
    height: 238px;
    min-height: 238px;
}
.dashboard-chart svg {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: visible;
}
.chart-grid-line {
    stroke: #e5eaf1;
    stroke-width: 1;
    stroke-dasharray: 4 5;
}
.chart-axis-label {
    fill: #98a2b3;
    font-size: 11px;
}
.chart-area,
.chart-line,
.chart-line-halo { pointer-events: none; }
.chart-line,
.chart-line-halo {
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
.chart-point,
.chart-hover-line {
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease;
}
.chart-hover-line {
    stroke: #cbd5e1;
    stroke-width: 1;
    stroke-dasharray: 3 4;
}
.chart-point-group:hover .chart-point,
.chart-point-group:hover .chart-hover-line { opacity: 1; }
.chart-hit-area { cursor: crosshair; }
.two-col { gap: 16px; }

.list {
    gap: 0;
    border-top: 1px solid var(--border);
}

.list-row {
    min-height: 52px;
    padding: 10px 4px;
    border: 0;
    border-bottom: 1px solid #eef0f3;
    border-radius: 0;
    background: transparent;
}

.list-row:last-child { border-bottom: 0; }
.list-row-button:hover,
.list-row-button:focus-visible { border-color: transparent; background: #f8fafc; }
.list-row strong { font-size: 14px; font-weight: 600; }
.list-row span { font-size: 12.5px; }

.table-wrap { border: 1px solid var(--border); border-radius: 7px; }
table { font-size: 14px; }
th, td { height: 46px; padding: 9px 12px; }
th { background: #f8f9fb; color: #667085; font-size: 12.5px; font-weight: 600; }
tbody tr:hover td { background: #f8fafc; }
.no-result-row, .no-result-row td { background: #fff8f7 !important; }
.no-result-row:hover, .no-result-row:hover td { background: #fff3f1 !important; }

.field {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.field > span { line-height: 1.4; }
.field textarea, .field input, .field select { font-weight: 400; }
.toolbar-field { width: min(440px, 100%); }
.form-grid { align-items: end; gap: 12px; }

input,
select,
textarea {
    min-height: 40px;
    padding: 8px 11px;
    border-color: var(--input);
    border-radius: 7px;
    background: #fff;
    font-size: 14px;
}

textarea { min-height: 96px; }

input:focus,
select:focus,
textarea:focus {
    border-color: #84adff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

button,
.button-link {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--primary);
    border-radius: 7px;
    background: var(--primary);
    box-shadow: none;
    font-size: 13.5px;
    font-weight: 600;
}

button:hover, .button-link:hover { border-color: #1d4ed8; background: #1d4ed8; }

button.secondary,
.button-link.secondary {
    border-color: #d0d5dd;
    background: #fff;
    color: #344054;
}

button.secondary:hover,
.button-link.secondary:hover { border-color: #b9c0ca; background: #f8f9fb; color: #1d2939; }

button.danger { border-color: transparent; background: transparent; color: var(--destructive); }
button.danger:hover { border-color: #fed7d7; background: #fff5f5; }

button.danger-solid { border-color: #c93636; background: #c93636; color: #fff; }
button.danger-solid:hover { border-color: #a92d2d; background: #a92d2d; }

.icon-button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    border-color: transparent;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    color: #475467;
}

.icon-button:hover { border-color: transparent; background: #f2f4f7; }

.badge,
.status {
    gap: 5px;
    min-height: 24px;
    padding: 2px 7px;
    border-color: #e4e7ec;
    border-radius: 6px;
    background: #f8f9fb;
    color: #475467;
    font-size: 12px;
    font-weight: 500;
}

.success-badge { border-color: #ccebd8; background: #f2fbf5; color: #187443; }
.danger-badge { border-color: #f4cece; background: #fff6f6; color: #b42323; }

.missing-professors-head { align-items: flex-start; }
.missing-professors-head p,
.modal-head p { margin: 4px 0 0; color: #667085; font-size: 12.5px; }
.missing-professors-head button { display: inline-flex; align-items: center; gap: 7px; }

.missing-status-tabs {
    display: flex;
    margin: 0 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef0f3;
}

.status-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    background: #fff;
    color: #344054 !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
}

.status-filter:hover { border-color: #b9c0ca; background: #f8fafc; color: #1d2939 !important; }
.status-filter.is-active {
    border-color: #bfd2fb;
    background: #eef4ff;
    color: #1d4ed8 !important;
}

.compact-modal { width: min(480px, 100%); }
.compact-modal .modal-head { align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid #eef0f3; }
.compact-modal .stack-form { gap: 16px; }
.compact-modal .form-footer { display: flex; justify-content: flex-start; }

.cards-list { gap: 0; border-top: 1px solid var(--border); }

.edit-card {
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid #eef0f3;
    border-radius: 0;
    background: transparent;
}

.edit-card:last-child { border-bottom: 0; }
.check-line, .check-label { font-size: 13px; font-weight: 500; }
.check-line { min-height: 40px; border-color: #d7dce3; border-radius: 7px; }
.empty { padding: 28px 16px; color: #667085; font-size: 13.5px; }
.flash { border-radius: 7px; box-shadow: none; }
.modal { border-radius: 10px; box-shadow: 0 20px 48px rgba(16, 24, 40, .16); }
.metric-line strong { font-size: 28px; font-weight: 700; }

.pagination {
    justify-content: flex-start;
    margin-top: 14px;
}

.pagination-status {
    color: #667085;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    margin: -4px -4px 18px;
    padding: 4px;
    border-bottom: 1px solid var(--border);
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 12px;
    border-bottom: 2px solid transparent;
    color: #667085;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.settings-tab:hover {
    color: #1d2939;
}

.settings-tab.is-active {
    border-bottom-color: var(--primary);
    color: #1d4ed8;
    font-weight: 600;
}

.settings-tab-panel {
    max-width: 1040px;
}

.settings-tab-panel .stack-form {
    max-width: 760px;
}

.settings-tab-panel .form-footer {
    margin-top: 2px;
}

@media (max-width: 520px) {
    .settings-tabs {
        overflow-x: auto;
    }

    .settings-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

.login-page {
    background: #f7f8fa;
}

.login-card {
    box-shadow: 0 12px 32px rgba(16, 24, 40, .08);
}

@media (max-width: 1100px) {
    body:not(.login-page) { grid-template-columns: 1fr; }
    .sidebar { padding: 9px 12px 7px; box-shadow: 0 1px 3px rgba(16, 24, 40, .06); }
    .dashboard-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .main { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .stats-grid article { min-height: 100px; border-left: 0; border-bottom: 1px solid var(--border); }
    .stats-grid article:last-child { border-bottom: 0; }
    .section-heading { align-items: flex-start; }
    .panel { padding: 14px; }
}
