:root {
    color-scheme: light;
    --ink: #14242c;
    --muted: #5d6e78;
    --line: #d7e0e6;
    --paper: #eef2f4;
    --card: #ffffff;
    --brand: #0e2f3a;
    --brand-2: #164554;
    --accent: #0f6f86;
    --accent-soft: #e5f4f8;
    --warn: #9a5410;
    --danger: #9f2d24;
    --ok: #166534;
    --shadow: 0 1px 2px rgba(14, 47, 58, 0.06), 0 8px 24px rgba(14, 47, 58, 0.05);
    --rail: 272px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.app { display: flex; min-height: 100vh; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.rail {
    width: var(--rail);
    flex: 0 0 var(--rail);
    background: var(--brand);
    color: #e7f1f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    color: white;
    text-decoration: none;
    padding: 1.1rem 1rem 0.85rem;
}
.brand strong, .brand small { display: block; }
.brand small { color: #b7c9d0; font-weight: 500; }
.mark {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #c4a35a;
    color: #1c1406;
    font-weight: 750;
    letter-spacing: 0.02em;
}
.finder { display: block; padding: 0 1rem 0.75rem; }
.finder input, .login input, .filters input, .batch-tools input, textarea, input[type="date"] {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
}
.finder input {
    background: #123743;
    border-color: #2a5563;
    color: white;
}
.finder input::placeholder { color: #9eb4bc; }
.rail-nav { overflow: auto; padding: 0.25rem 0.7rem 1rem; flex: 1; }
.rail-group { margin: 0.85rem 0 0.2rem; }
.rail-group h2 {
    margin: 0 0 0.25rem;
    padding: 0 0.45rem;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8eacb6;
}
.rail-link {
    display: block;
    color: #e7f1f4;
    text-decoration: none;
    border-radius: 8px;
    padding: 0.42rem 0.55rem;
}
.rail-link:hover { background: rgba(255, 255, 255, 0.06); }
.rail-link.is-current { background: rgba(196, 163, 90, 0.22); color: white; }
.rail-empty { color: #b7c9d0; padding: 0.4rem 0.55rem; }
.rail-user {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.9rem 1rem 1rem;
}
.rail-user strong, .rail-user small, .rail-user a { display: block; }
.rail-user small { color: #b7c9d0; margin: 0.15rem 0 0.45rem; }
.rail-user a { color: #f3e2bc; text-decoration: none; }
.scrim { display: none; }
.stage { flex: 1; min-width: 0; }
.top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.55rem 1.25rem;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.crumb { margin: 0; font-weight: 650; }
.who { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
.menu-btn { display: none; }
.desk, .queue { padding: 1.25rem 1.4rem 2.5rem; }
.hero, .panel, .kpis { margin-bottom: 1rem; }
.hero { display: flex; justify-content: space-between; gap: 1rem; align-items: end; }
.eyebrow, .kicker {
    margin: 0 0 0.25rem;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
h1 { font-size: 1.7rem; line-height: 1.15; margin: 0; }
.lede, .panel-head p, .note, .hint, .case-head p, .actions p { color: var(--muted); }
.lede { max-width: 42rem; margin: 0.4rem 0 0; }
.resume {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    min-width: 14rem;
    box-shadow: var(--shadow);
}
.resume span { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.resume a { font-weight: 650; text-decoration: none; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.kpis article, .service, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.kpis article { padding: 0.9rem 1rem 1rem; }
.kpis span, .metric { color: var(--muted); font-size: 0.82rem; }
.kpis strong, .metric strong {
    display: block;
    margin: 0.25rem 0;
    font-size: 1.8rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}
.kpis small { color: var(--muted); }
.panel { padding: 0.3rem 0.3rem 0.6rem; }
.panel-head, .page-head { padding: 0.85rem 0.9rem 0.4rem; }
.panel-head h2, .page-head h1 { margin: 0; font-size: 1.05rem; }
.panel-head p { margin: 0.25rem 0 0.55rem; }
.page-head { padding: 0 0 0.8rem; }
.page-head h1 { font-size: 1.45rem; }
.workload { font-variant-numeric: tabular-nums; }
.workload td:not(:first-child), .workload th:not(:first-child) { text-align: right; }
.workload a { font-weight: 650; text-decoration: none; }
.services { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; padding: 0.3rem 0.7rem 0.8rem; }
.services.is-filtered-empty::after {
    content: "No queue matches that search.";
    color: var(--muted);
}
.service { padding: 1rem; display: flex; flex-direction: column; gap: 0.45rem; }
.service h3 { margin: 0; font-size: 1.02rem; }
.service p { margin: 0; }
.service-actions { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; align-items: center; margin-top: auto; padding-top: 0.45rem; }
.service-actions a:not(.btn) { font-size: 0.88rem; }
.btn, .login button, button.primary, .filters .btn {
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.48rem 0.8rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; list-style: none; margin: 0; padding: 0.2rem 0.9rem 0.4rem; }
.steps li {
    background: var(--paper);
    border-radius: 10px;
    padding: 0.7rem;
}
.steps strong, .steps span { display: block; }
.steps span { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }
.note { margin: 0.2rem 0.9rem 0.7rem; }
.chips, .filters, .pager, .batch-tools, .viewer-actions, .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; }
.chips { margin-bottom: 0.8rem; }
.chip {
    border: 1px solid var(--line);
    background: white;
    border-radius: 999px;
    padding: 0.38rem 0.75rem;
}
.chip.on { background: var(--brand); color: white; border-color: var(--brand); }
button.warn { background: var(--warn); color: white; border-color: var(--warn); border-radius: 8px; padding: 0.48rem 0.8rem; }
button.danger { background: var(--danger); color: white; border-color: var(--danger); border-radius: 8px; padding: 0.48rem 0.8rem; }
button.icon { background: transparent; }
.filters { margin-bottom: 0.65rem; }
.filters label, .login label, .side label { display: block; font-size: 0.78rem; color: var(--muted); margin: 0; }
.filters label { min-width: 12rem; flex: 1; }
.more-filters { flex-basis: 100%; }
.more-filters summary { cursor: pointer; color: var(--accent); margin: 0.15rem 0; }
.filter-grid { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 0.65rem; }
.hint { min-height: 1.2rem; margin: 0.2rem 0 0.55rem; }
.table-wrap { overflow: auto; background: white; border-top: 1px solid var(--line); max-height: 68vh; }
.panel > .table-wrap { border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.queue .table-wrap { border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: #f3f7f8; font-size: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase; color: #3e5560; }
tbody tr:hover { background: #f4fafb; }
.is-openable tbody tr { cursor: pointer; }
.empty { white-space: normal; color: var(--muted); padding: 1.2rem 0.8rem; }
.badge { border-radius: 999px; padding: 0.12rem 0.5rem; font-size: 0.75rem; background: #e2e8f0; }
.badge.s0 { background: #dbeafe; color: #1e3a8a; }
.badge.s1 { background: #fef3c7; color: #92400e; }
.badge.s2 { background: #cffafe; color: #155e75; }
.badge.s3 { background: #fee2e2; color: #991b1b; }
.badge.s4, .badge.s5 { background: #dcfce7; color: var(--ok); }
.badge.s6 { background: #e5e7eb; color: #374151; }
.pager { margin-top: 0.75rem; }
.pager button, .viewer-actions button, .batch-tools button, #requirements button {
    border: 1px solid var(--line);
    background: white;
    border-radius: 8px;
    padding: 0.42rem 0.7rem;
}
dialog {
    width: min(1120px, 96vw);
    border: 0;
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 24px 70px rgba(14, 47, 58, 0.28);
}
dialog::backdrop { background: rgba(14, 31, 38, 0.45); }
.case-head, .actions { padding: 0.9rem 1rem; }
.case-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border-bottom: 1px solid var(--line); }
.case-head h2 { margin: 0; font-size: 1.15rem; }
.case-body { display: grid; grid-template-columns: minmax(260px, 34%) 1fr; min-height: 62vh; }
.side, .viewer { padding: 0.9rem 1rem; }
.side { border-right: 1px solid var(--line); overflow: auto; background: #f8fbfb; }
.viewer iframe { width: 100%; height: 58vh; border: 1px solid var(--line); border-radius: 10px; background: white; }
textarea, input[type="date"] { margin-top: 0.25rem; }
#requirements article { padding: 0.55rem 0; border-top: 1px solid var(--line); }
#requirements p { margin: 0 0 0.25rem; font-weight: 650; }
.actions { border-top: 1px solid var(--line); align-items: center; }
.actions p { flex: 1; min-width: 12rem; }
details summary { cursor: pointer; }
.batch-tools, #batch .table-wrap { margin: 0.8rem 1rem; }
.gate-body { background: var(--brand); }
.gate {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
    align-items: center;
    padding: 4vh 8vw;
    color: white;
}
.gate-copy h1 { font-size: 3rem; max-width: 12ch; }
.gate-copy p, .gate-copy li { color: #d5e4e9; }
.gate-copy ol { padding-left: 1.1rem; }
.gate-copy li { margin: 0.35rem 0; }
.login {
    background: white;
    color: var(--ink);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.login h2 { margin: 0; }
.login p { color: var(--muted); }
.login label { margin-top: 0.85rem; }
.login button { margin-top: 1.1rem; width: 100%; justify-content: center; background: var(--brand); border-color: var(--brand); }
.error { color: var(--danger); background: #fef2f2; border-radius: 8px; padding: 0.5rem 0.7rem; }
@media (max-width: 1100px) {
    .kpis, .steps { grid-template-columns: repeat(2, 1fr); }
    .services { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .menu-btn {
        display: inline-flex;
        border: 1px solid var(--line);
        background: white;
        border-radius: 8px;
        padding: 0.35rem 0.6rem;
    }
    .rail {
        position: fixed;
        z-index: 20;
        transform: translateX(-105%);
        transition: transform 0.18s ease;
    }
    .nav-toggle:checked ~ .rail { transform: none; }
    .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 20, 26, 0.45); z-index: 15; }
    .hero, .gate, .case-body { grid-template-columns: 1fr; display: grid; }
    .gate { padding: 1.5rem; }
    .gate-copy h1 { font-size: 2.2rem; }
    .side { border-right: 0; border-bottom: 1px solid var(--line); }
    .kpis { grid-template-columns: 1fr 1fr; }
}
