:root {
    --sidebar: #102238;
    --sidebar-deep: #0a192b;
    --sidebar-muted: #8fa2b8;
    --accent: #2c7a73;
    --accent-dark: #21655f;
    --accent-soft: #e7f4f1;
    --blue: #3266c8;
    --blue-soft: #eaf0ff;
    --ink: #172235;
    --muted: #68758a;
    --subtle: #94a0b1;
    --line: #e3e8ef;
    --page: #f4f6f9;
    --surface: #ffffff;
    --low: #25845b;
    --low-bg: #e8f6ef;
    --moderate: #a66a08;
    --moderate-bg: #fff4d8;
    --high: #c05a13;
    --high-bg: #fff0e4;
    --critical: #c83f4d;
    --critical-bg: #fdebee;
    --shadow-sm: 0 2px 8px rgba(26, 43, 67, 0.05);
    --shadow-md: 0 14px 40px rgba(26, 43, 67, 0.08);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    letter-spacing: -0.025em;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    display: flex;
    width: 278px;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 10%, rgba(54, 133, 125, 0.16), transparent 28%),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-deep));
    color: #fff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 84px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-symbol {
    display: flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: end;
    justify-content: center;
    gap: 3px;
    padding: 10px;
    border-radius: 12px;
    background: linear-gradient(145deg, #3b9188, #256b65);
    box-shadow: 0 8px 20px rgba(17, 92, 84, 0.32);
}

.brand-symbol span {
    width: 4px;
    border-radius: 4px 4px 1px 1px;
    background: #fff;
}

.brand-symbol span:nth-child(1) { height: 9px; opacity: 0.65; }
.brand-symbol span:nth-child(2) { height: 17px; }
.brand-symbol span:nth-child(3) { height: 13px; opacity: 0.82; }

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand strong {
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.sidebar-brand small {
    margin-top: 1px;
    color: var(--sidebar-muted);
    font-size: 0.66rem;
}

.sidebar-close {
    display: none;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.5rem;
}

.sidebar-navigation {
    padding: 20px 14px 15px;
}

.sidebar-label {
    margin: 15px 10px 7px;
    color: #70869d;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.sidebar-label:first-child {
    margin-top: 0;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #b6c3d0;
    text-align: left;
    font-size: 0.83rem;
    font-weight: 650;
    transition: background 140ms ease, color 140ms ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(60, 148, 139, 0.18);
    color: #effffd;
}

.sidebar-link.active::before {
    position: absolute;
    left: -14px;
    width: 3px;
    height: 23px;
    border-radius: 0 4px 4px 0;
    background: #4eb3a8;
    content: "";
}

.nav-icon {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 7px;
    color: #92a7bb;
    font-size: 0.9rem;
}

.sidebar-link.active .nav-icon {
    border-color: rgba(78, 179, 168, 0.25);
    background: rgba(78, 179, 168, 0.15);
    color: #73d1c7;
}

.sidebar-history {
    min-height: 0;
    margin: 0 14px;
    padding-top: 17px;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 10px;
}

.sidebar-history-heading span,
.sidebar-history-heading small {
    display: block;
}

.sidebar-history-heading span {
    font-size: 0.75rem;
    font-weight: 700;
}

.sidebar-history-heading small {
    margin-top: 1px;
    color: #6f859c;
    font-size: 0.63rem;
}

.refresh-button {
    padding: 3px 7px;
    border: 0;
    background: transparent;
    color: #8399af;
    font-size: 1.1rem;
}

.history-list {
    display: grid;
    gap: 6px;
    padding-bottom: 16px;
}

.history-item {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    color: #d8e1ea;
    text-align: left;
    transition: background 140ms ease, border-color 140ms ease;
}

.history-item:hover,
.history-item.active {
    border-color: rgba(78, 179, 168, 0.25);
    background: rgba(78, 179, 168, 0.11);
}

.history-file {
    display: block;
    margin-bottom: 4px;
    overflow: hidden;
    font-size: 0.74rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-details {
    display: flex;
    justify-content: space-between;
    gap: 7px;
    color: #7f94aa;
    font-size: 0.61rem;
}

.history-item .history-details:last-child {
    display: block;
    margin-top: 2px;
    color: #6eb6ae;
}

.sidebar-empty {
    padding: 8px;
    color: #71869b;
    font-size: 0.72rem;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 15px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-footer strong,
.sidebar-footer small {
    display: block;
}

.sidebar-footer strong {
    color: #cad6e1;
    font-size: 0.7rem;
}

.sidebar-footer small {
    color: #6f8499;
    font-size: 0.6rem;
}

.status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #52c99a;
    box-shadow: 0 0 0 4px rgba(82, 201, 154, 0.12);
}

.sidebar-overlay {
    display: none;
}

.main-shell {
    min-height: 100vh;
    margin-left: 278px;
}

.topbar {
    position: sticky;
    z-index: 15;
    top: 0;
    display: flex;
    min-height: 84px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 36px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 13px;
}

.topbar h1 {
    margin: 1px 0 0;
    font-size: 1.35rem;
}

.breadcrumb {
    margin-bottom: 0;
    color: var(--subtle);
    font-size: 0.67rem;
}

.breadcrumb span {
    margin: 0 5px;
    color: #c2c9d2;
}

.menu-button {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
}

.topbar-meta,
.model-ready {
    display: flex;
    align-items: center;
}

.topbar-meta {
    gap: 16px;
}

.model-ready {
    gap: 9px;
    padding-right: 16px;
    border-right: 1px solid var(--line);
}

.model-ready-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 900;
}

.model-ready small,
.model-ready strong {
    display: block;
}

.model-ready small {
    color: var(--subtle);
    font-size: 0.61rem;
}

.model-ready strong {
    font-size: 0.72rem;
}

.faculty-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 10px;
    background: var(--sidebar);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
}

.workspace {
    width: min(1180px, calc(100% - 64px));
    margin: 0 auto;
    padding: 30px 0 60px;
}

.welcome-banner {
    position: relative;
    display: flex;
    min-height: 172px;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 22px;
    padding: 28px 34px;
    overflow: hidden;
    border-radius: 16px;
    background:
        radial-gradient(circle at 90% 20%, rgba(95, 197, 186, 0.25), transparent 25%),
        linear-gradient(115deg, #15314d, #19425a 62%, #236d69);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.welcome-banner::after {
    position: absolute;
    width: 250px;
    height: 250px;
    right: -115px;
    bottom: -160px;
    border: 30px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    content: "";
}

.welcome-banner h2 {
    max-width: 650px;
    margin-bottom: 7px;
    font-size: clamp(1.45rem, 2.4vw, 2.05rem);
}

.welcome-banner p:last-child {
    max-width: 680px;
    margin-bottom: 0;
    color: #c7dbe2;
    font-size: 0.85rem;
}

.section-kicker {
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 850;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.section-kicker.light {
    color: #68c6bc;
}

.banner-visual {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 0 0 220px;
    align-items: center;
    gap: 12px;
}

.mini-chart {
    display: flex;
    width: 128px;
    height: 88px;
    align-items: end;
    gap: 7px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(5px);
}

.mini-chart span {
    width: 14px;
    height: var(--height);
    border-radius: 3px 3px 1px 1px;
    background: linear-gradient(180deg, #71d1c7, #3d948b);
}

.visual-badge {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    align-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(9, 30, 46, 0.45);
}

.visual-badge strong,
.visual-badge small {
    display: block;
}

.visual-badge strong {
    font-size: 1rem;
}

.visual-badge small {
    color: #a7c7cd;
    font-size: 0.55rem;
}

.surface-card {
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.input-view {
    padding: 26px 28px;
}

.card-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf0f4;
}

.card-heading h2 {
    margin-bottom: 2px;
    font-size: 1.15rem;
}

.card-heading p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.79rem;
}

.heading-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 11px;
    font-size: 1.1rem;
    font-weight: 750;
}

.upload-heading-icon { background: var(--accent-soft); color: var(--accent); }
.manual-heading-icon { background: var(--blue-soft); color: var(--blue); }
.history-heading-icon { background: #f0edff; color: #6856b4; }

.upload-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(250px, 0.7fr);
    gap: 18px;
}

.drop-zone {
    display: grid;
    min-height: 248px;
    padding: 28px;
    place-items: center;
    align-content: center;
    border: 1.5px dashed #aab7c7;
    border-radius: 13px;
    outline: none;
    background: #fafbfd;
    text-align: center;
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.dragging {
    border-color: var(--accent);
    background: #f3faf8;
}

.drop-zone.dragging {
    transform: scale(1.005);
}

.file-illustration {
    position: relative;
    display: grid;
    width: 54px;
    height: 66px;
    margin-bottom: 14px;
    place-items: end center;
    padding-bottom: 10px;
    border: 1px solid #b8d7d2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(34, 99, 92, 0.09);
}

.file-illustration::before {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 16px;
    height: 16px;
    border-bottom: 1px solid #b8d7d2;
    border-left: 1px solid #b8d7d2;
    border-radius: 0 7px 0 4px;
    background: var(--accent-soft);
    content: "";
}

.file-illustration span {
    padding: 3px 6px;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 850;
}

.drop-zone h3 {
    margin-bottom: 4px;
    font-size: 0.98rem;
}

.drop-zone p {
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 0.76rem;
}

.drop-zone p strong {
    color: var(--accent);
}

.selected-file {
    max-width: 90%;
    padding: 5px 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf1f5;
    color: #69768a;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.format-guide {
    padding: 21px;
    border: 1px solid #e4e9ef;
    border-radius: 13px;
    background: #f8fafc;
}

.guide-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-heading > span {
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
    font-family: Georgia, serif;
    font-size: 0.8rem;
    font-weight: bold;
}

.guide-heading strong,
.guide-heading small {
    display: block;
}

.guide-heading strong { font-size: 0.79rem; }
.guide-heading small { color: var(--subtle); font-size: 0.64rem; }

.format-guide ul {
    display: grid;
    gap: 8px;
    margin: 19px 0;
    padding: 0;
    list-style: none;
}

.format-guide li {
    position: relative;
    padding-left: 18px;
    color: #58667a;
    font-size: 0.7rem;
}

.format-guide li::before {
    position: absolute;
    left: 0;
    color: var(--accent);
    content: "✓";
    font-weight: 800;
}

.format-guide > p {
    margin: 0;
    padding-top: 15px;
    border-top: 1px solid var(--line);
    color: var(--subtle);
    font-size: 0.63rem;
}

.form-footer {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
}

.field-control {
    display: grid;
    gap: 6px;
    color: #425066;
    font-size: 0.72rem;
    font-weight: 700;
}

.field-control input,
.field-control select,
.form-footer select {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ccd5e0;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 500;
    transition: border-color 130ms ease, box-shadow 130ms ease;
}

.form-footer .field-control {
    width: min(330px, 100%);
}

.field-control input:focus,
.field-control select:focus,
.form-footer select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(44, 122, 115, 0.1);
}

.primary-button,
.secondary-button,
.report-button {
    border-radius: 8px;
    font-weight: 750;
}

.primary-button {
    display: flex;
    min-width: 190px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 13px 11px 17px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 7px 16px rgba(44, 122, 115, 0.18);
    font-size: 0.78rem;
    transition: background 130ms ease, transform 130ms ease;
}

.primary-button:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}

.button-arrow {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
}

.secondary-button,
.report-button {
    border: 1px solid #cdd6e0;
    background: #fff;
    color: #46566c;
}

.secondary-button {
    padding: 9px 12px;
    font-size: 0.72rem;
    white-space: nowrap;
}

.secondary-button:hover,
.report-button:hover {
    border-color: #9aa9ba;
    background: #f7f9fb;
}

.report-button {
    padding: 6px 10px;
    color: var(--accent-dark);
    font-size: 0.68rem;
}

.message {
    margin-top: 17px;
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 0.75rem;
}

.message.error {
    border: 1px solid #fac9d0;
    background: #fff2f4;
    color: #a72f3d;
}

.message.success {
    border: 1px solid #bfe4d1;
    background: #effaf4;
    color: #1d704b;
}

.form-section {
    margin: 0 0 22px;
    padding: 0;
    border: 0;
}

.form-section legend {
    width: 100%;
    margin-bottom: 13px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf0f4;
    color: #334158;
    font-size: 0.75rem;
    font-weight: 800;
}

.manual-form-grid {
    display: grid;
    gap: 14px 17px;
}

.identity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.manual-footer {
    align-items: center;
    margin-top: 5px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}

.manual-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 0.7rem;
}

.manual-footer p span {
    margin-right: 5px;
    color: var(--accent);
    font-weight: 800;
}

.history-card-heading {
    position: relative;
}

.history-card-heading .secondary-button {
    margin-left: auto;
}

.history-table-heading,
.history-page-item {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) 100px minmax(200px, 1fr) 28px;
    align-items: center;
    gap: 16px;
}

.history-table-heading {
    padding: 0 14px 8px;
    color: var(--subtle);
    font-size: 0.61rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.history-page-list {
    display: grid;
    gap: 7px;
}

.history-page-item {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    text-align: left;
    transition: border-color 130ms ease, background 130ms ease;
}

.history-page-item::after {
    color: #9aa7b6;
    content: "›";
    font-size: 1.25rem;
}

.history-page-item:hover,
.history-page-item.active {
    border-color: #9bc9c4;
    background: #f5fbfa;
}

.history-page-file {
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-page-count {
    color: #536176;
    font-size: 0.7rem;
}

.history-page-meta {
    color: var(--muted);
    font-size: 0.68rem;
}

.empty-state {
    display: grid;
    min-height: 290px;
    margin-top: 22px;
    place-items: center;
    align-content: center;
    border: 1px dashed #cdd6e0;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.58);
    text-align: center;
}

.empty-state h2 {
    margin-bottom: 6px;
    font-size: 1.08rem;
}

.empty-state > p:last-child {
    max-width: 480px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.empty-orbit {
    position: relative;
    display: grid;
    width: 82px;
    height: 82px;
    margin-bottom: 14px;
    place-items: center;
    border: 1px solid #d4e8e5;
    border-radius: 50%;
    background: #f4faf9;
}

.orbit-dot {
    position: absolute;
    top: 8px;
    right: 13px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf9f;
    box-shadow: 0 0 0 4px rgba(76, 175, 159, 0.12);
}

.empty-bars {
    display: flex;
    height: 36px;
    align-items: end;
    gap: 4px;
}

.empty-bars i {
    width: 7px;
    border-radius: 2px 2px 0 0;
    background: #74aaa4;
}

.empty-bars i:nth-child(1) { height: 14px; }
.empty-bars i:nth-child(2) { height: 28px; }
.empty-bars i:nth-child(3) { height: 20px; }
.empty-bars i:nth-child(4) { height: 34px; }

.results-section {
    margin-top: 30px;
}

.results-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 13px;
}

.results-heading h2 {
    margin-bottom: 2px;
    font-size: 1.22rem;
}

.results-heading p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 0.7rem;
}

.risk-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 3px;
    color: var(--muted);
    font-size: 0.66rem;
}

.risk-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.risk-legend i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.risk-legend i.low { background: var(--low); }
.risk-legend i.moderate { background: #d19a21; }
.risk-legend i.high { background: var(--high); }
.risk-legend i.critical { background: var(--critical); }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 11px;
    margin-bottom: 18px;
}

.summary-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.summary-icon {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    place-items: center;
    border-radius: 9px;
    background: #edf2f7;
    color: #4f6074;
    font-size: 0.75rem;
    font-weight: 850;
}

.summary-card span,
.summary-card strong,
.summary-card small {
    display: block;
}

.summary-card span {
    color: #5e6c80;
    font-size: 0.64rem;
    font-weight: 750;
}

.summary-card strong {
    margin: 1px 0;
    font-size: 1.35rem;
    line-height: 1.05;
}

.summary-card small {
    color: #a0aab7;
    font-size: 0.57rem;
}

.risk-card .summary-icon { background: #f0edff; color: #6c55bd; }
.high-card .summary-icon { background: var(--high-bg); color: var(--high); }
.critical-card .summary-icon { background: var(--critical-bg); color: var(--critical); }
.low-card .summary-icon { background: var(--low-bg); color: var(--low); }

.student-panel {
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 19px 20px;
    border-bottom: 1px solid var(--line);
}

.table-toolbar h2 {
    margin-bottom: 1px;
    font-size: 1rem;
}

.table-toolbar p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 0.66rem;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    display: flex;
    min-width: 265px;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid #cdd6e0;
    border-radius: 8px;
    background: #fff;
    color: #8491a2;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(44, 122, 115, 0.09);
}

.search-box input {
    width: 100%;
    padding: 9px 0;
    border: 0;
    outline: 0;
    color: var(--ink);
    font-size: 0.73rem;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 16px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #f8fafb;
    color: #8490a1;
    font-size: 0.59rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

td {
    color: #526075;
    font-size: 0.72rem;
}

tbody tr {
    cursor: pointer;
    transition: background 100ms ease;
}

tbody tr:hover {
    background: #f6faf9;
}

.student-name {
    color: var(--ink);
    font-weight: 750;
}

.probability-cell {
    color: #35465c;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.risk-badge,
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.59rem;
    font-weight: 850;
    letter-spacing: 0.045em;
}

.risk-badge.low { background: var(--low-bg); color: var(--low); }
.risk-badge.moderate { background: var(--moderate-bg); color: var(--moderate); }
.risk-badge.high { background: var(--high-bg); color: var(--high); }
.risk-badge.critical { background: var(--critical-bg); color: var(--critical); }
.status-badge.at-risk { background: var(--critical-bg); color: var(--critical); }
.status-badge.not-at-risk { background: #edf1f5; color: #617084; }

.muted-message {
    margin: 0;
    color: var(--muted);
    font-size: 0.74rem;
}

.table-message {
    padding: 28px;
    text-align: center;
}

.modal {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: grid;
    padding: 22px;
    place-items: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 20, 34, 0.7);
    backdrop-filter: blur(3px);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(900px, 100%);
    max-height: calc(100vh - 44px);
    padding: 30px;
    overflow-y: auto;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.modal-accent {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), #4aa398, #7cbeb7);
}

.modal-close {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 17px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f1f4f7;
    color: #58667a;
    font-size: 1.25rem;
}

.report-loading {
    padding: 60px 20px;
    color: var(--muted);
    text-align: center;
}

.report-header {
    display: flex;
    align-items: center;
    gap: 13px;
    padding-right: 40px;
}

.student-avatar {
    display: grid;
    width: 49px;
    height: 49px;
    flex: 0 0 49px;
    place-items: center;
    border-radius: 13px;
    background: var(--sidebar);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
}

.report-identity h2 {
    margin-bottom: 0;
    font-size: 1.2rem;
}

.report-identity p:last-child {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.7rem;
}

.report-header > .risk-badge {
    margin-left: auto;
    padding: 6px 11px;
}

.report-score-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 23px 0;
}

.report-score-grid > div {
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fafbfc;
}

.report-score-grid span,
.report-score-grid strong {
    display: block;
}

.report-score-grid span {
    margin-bottom: 3px;
    color: var(--subtle);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.report-score-grid strong {
    font-size: 0.88rem;
}

.report-columns {
    display: grid;
    grid-template-columns: 1.12fr 0.88fr;
    gap: 18px;
}

.report-section {
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 11px;
}

.report-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-section-heading span {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 7px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.7rem;
}

.report-section-heading h3 {
    margin: 0;
    font-size: 0.83rem;
}

.method-note {
    margin: 5px 0 15px 33px;
    color: var(--muted);
    font-size: 0.62rem;
}

.factor-list {
    display: grid;
    gap: 12px;
}

.factor-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
    color: #47566b;
    font-size: 0.69rem;
}

.factor-heading strong {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.factor-track {
    height: 6px;
    overflow: hidden;
    border-radius: 99px;
    background: #e9edf2;
}

.factor-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #e69050, var(--critical));
}

.academic-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    margin: 13px 0 0;
}

.academic-grid dt,
.academic-grid dd {
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid #edf0f4;
    font-size: 0.67rem;
}

.academic-grid dt { color: var(--muted); }
.academic-grid dd { color: #354359; font-variant-numeric: tabular-nums; font-weight: 800; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 1120px) {
    .metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .summary-grid {
        grid-template-columns: repeat(3, minmax(130px, 1fr));
    }

    .banner-visual {
        display: none;
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close,
    .menu-button {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        z-index: 25;
        inset: 0;
        display: none;
        border: 0;
        background: rgba(7, 18, 31, 0.58);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .main-shell {
        margin-left: 0;
    }

    .upload-workspace {
        grid-template-columns: 1fr;
    }

    .history-table-heading {
        display: none;
    }

    .history-page-item {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .history-page-meta {
        grid-column: 1 / -1;
    }

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

@media (max-width: 700px) {
    .topbar {
        min-height: 72px;
        padding: 12px 18px;
    }

    .breadcrumb,
    .model-ready {
        display: none;
    }

    .topbar h1 {
        font-size: 1.12rem;
    }

    .workspace {
        width: min(100% - 28px, 1180px);
        padding-top: 16px;
    }

    .welcome-banner {
        min-height: 155px;
        padding: 23px;
    }

    .welcome-banner h2 {
        font-size: 1.35rem;
    }

    .input-view {
        padding: 20px;
    }

    .identity-grid,
    .metrics-grid,
    .summary-grid,
    .report-score-grid {
        grid-template-columns: 1fr;
    }

    .form-footer,
    .manual-footer,
    .results-heading,
    .table-toolbar,
    .table-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .form-footer .field-control,
    .primary-button,
    .search-box {
        width: 100%;
        min-width: 0;
    }

    .risk-legend {
        margin-top: 5px;
    }

    .history-card-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .history-card-heading .secondary-button {
        width: 100%;
        margin: 0;
    }

    .modal {
        padding: 8px;
    }

    .modal-card {
        max-height: calc(100vh - 16px);
        padding: 24px 17px;
    }

    .report-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .report-header > .risk-badge {
        margin-left: 62px;
    }
}
