:root {
    --ink: #0b132b;
    --paper: #f6fff8;
    --mint: #5bc0be;
    --gold: #ffd166;
    --blue-soft: #d8f3f1;
    --line: rgba(11, 19, 43, 0.14);
    --muted: #64707d;
    --danger: #e85d75;
    --shadow: 0 24px 60px rgba(11, 19, 43, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    min-height: 100vh;
    margin: 0;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr) 324px;
    min-height: 100vh;
}

.left-rail {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: 100vh;
    padding: 24px 18px;
    background: var(--ink);
    color: var(--paper);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0;
}

.brand img {
    width: 42px;
    height: 42px;
}

.nav-list {
    display: grid;
    gap: 8px;
}

.nav-item,
.stage-chip,
.queue-item,
.primary-action,
.ghost-action {
    border: 0;
    border-radius: 8px;
}

.nav-item {
    width: 100%;
    padding: 13px 14px;
    background: transparent;
    color: rgba(246, 255, 248, 0.72);
    text-align: left;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(91, 192, 190, 0.18);
    color: var(--paper);
    transform: translateX(3px);
}

.rail-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    color: rgba(246, 255, 248, 0.66);
    font-size: 13px;
}

.signal-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--gold);
    box-shadow: 0 0 0 7px rgba(255, 209, 102, 0.16);
}

.workspace {
    min-width: 0;
    padding: 28px clamp(18px, 3vw, 42px);
    background:
        linear-gradient(90deg, rgba(91, 192, 190, 0.08), transparent 38%),
        var(--paper);
}

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

.eyebrow {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(34px, 6vw, 78px);
    line-height: 0.92;
}

h2 {
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1;
}

.searchbar {
    display: flex;
    gap: 10px;
    width: min(520px, 100%);
}

.searchbar input {
    min-width: 0;
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.62);
    color: var(--ink);
}

.searchbar button,
.primary-action,
.ghost-action {
    min-height: 44px;
    padding: 0 16px;
    font-weight: 800;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.searchbar button,
.ghost-action {
    border: 1px solid var(--line);
    background: white;
    color: var(--ink);
}

.primary-action {
    background: var(--ink);
    color: var(--paper);
    box-shadow: 0 14px 30px rgba(11, 19, 43, 0.22);
}

.primary-action:hover,
.ghost-action:hover,
.searchbar button:hover {
    transform: translateY(-1px);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.metric {
    min-width: 0;
    padding: 18px;
    background: rgba(255, 255, 255, 0.68);
}

.metric span,
.queue-item span,
.line-item span,
.calendar-item span,
.report-block span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 0.9;
}

.progress-map {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.track-line {
    position: absolute;
    top: 27px;
    right: 10%;
    left: 10%;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--mint), var(--mint) 18px, transparent 18px, transparent 28px);
    opacity: 0.7;
}

.stage-chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 10px;
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: 0 10px 22px rgba(11, 19, 43, 0.05);
    transition: transform 180ms ease, background 180ms ease, border 180ms ease;
}

.stage-chip span {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--blue-soft);
    font-weight: 900;
}

.stage-chip.active {
    background: var(--gold);
    border-color: rgba(11, 19, 43, 0.28);
    transform: translateY(-2px);
}

.screen {
    display: none;
    animation: rise 220ms ease both;
}

.screen.active {
    display: block;
}

.case-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.22fr) minmax(260px, 0.78fr);
    gap: 18px;
    align-items: start;
}

.active-card,
.queue,
.inspector,
.line-item,
.calendar-item,
.report-block {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
}

.active-card {
    min-height: 460px;
    padding: clamp(20px, 3vw, 34px);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.badge {
    align-self: start;
    padding: 8px 10px;
    border-radius: 999px;
    background: var(--mint);
    color: var(--ink);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.case-copy {
    max-width: 720px;
    color: #364254;
    font-size: 16px;
    line-height: 1.55;
}

.route-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 30px 0;
}

.route-node {
    min-height: 118px;
    padding: 14px;
    border: 1px dashed rgba(11, 19, 43, 0.2);
    border-radius: 8px;
    background: rgba(246, 255, 248, 0.7);
    transition: transform 180ms ease, background 180ms ease;
}

.route-node.done {
    border-style: solid;
    background: #e7fbf9;
}

.route-node.current {
    background: var(--gold);
    transform: translateY(-4px);
}

.route-node span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.route-node strong {
    display: block;
    margin-top: 26px;
    font-size: 20px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.queue {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.queue-item {
    display: grid;
    gap: 5px;
    width: 100%;
    padding: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink);
    text-align: left;
    transition: background 160ms ease, border 160ms ease, transform 160ms ease;
}

.queue-item:hover,
.queue-item.selected {
    background: var(--blue-soft);
    border-color: rgba(91, 192, 190, 0.55);
    transform: translateX(-2px);
}

.queue-item strong,
.line-item strong,
.calendar-item strong,
.report-block strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.queue-item em,
.line-item em,
.calendar-item em,
.report-block em {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
}

.queue-code {
    color: var(--ink) !important;
}

.detail-columns,
.report-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.84fr);
    gap: 18px;
}

.stack-list,
.calendar-grid,
.report-grid {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.line-item {
    padding: 16px;
}

.line-item p {
    margin: 8px 0 0;
    color: #465469;
    line-height: 1.45;
}

.line-item.route {
    border-left: 5px solid var(--mint);
}

.line-item.material {
    border-left: 5px solid var(--gold);
}

.line-item.payment {
    border-left: 5px solid var(--ink);
}

.calendar-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.calendar-head span {
    color: var(--muted);
}

.calendar-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.calendar-item {
    min-height: 150px;
    padding: 16px;
    background:
        linear-gradient(135deg, rgba(91, 192, 190, 0.2), transparent 45%),
        white;
}

.calendar-item b {
    display: inline-block;
    margin-top: 22px;
    padding: 7px 9px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 12px;
}

.report-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.report-block {
    min-height: 134px;
    padding: 16px;
}

.report-block strong {
    display: block;
    margin: 12px 0 8px;
    font-size: 42px;
    line-height: 0.95;
}

.inspector {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    padding: 26px 22px;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 0;
    background: #ffffff;
}

.drawer-head {
    margin-bottom: 24px;
}

.drawer-body {
    display: grid;
    gap: 18px;
}

.risk-dial {
    --risk: 0;
    display: grid;
    place-items: center;
    width: min(100%, 230px);
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 999px;
    background:
        radial-gradient(circle at center, white 0 57%, transparent 58%),
        conic-gradient(var(--danger) calc(var(--risk) * 1%), #e8ecef 0);
}

.risk-dial span {
    font-size: 52px;
    font-weight: 950;
    line-height: 0.92;
}

.risk-dial small {
    color: var(--muted);
    font-weight: 800;
}

.fact-list {
    display: grid;
    gap: 1px;
    overflow: hidden;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.fact-list div {
    display: grid;
    gap: 5px;
    padding: 14px;
    background: white;
}

.fact-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.fact-list dd {
    margin: 0;
    font-weight: 800;
}

.drawer-note,
.empty {
    padding: 14px;
    border-radius: 8px;
    background: var(--blue-soft);
    color: #26364a;
    line-height: 1.45;
}

.empty.error {
    background: #ffe2e7;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1180px) {
    .shell {
        grid-template-columns: 210px minmax(0, 1fr);
    }

    .inspector {
        position: static;
        grid-column: 1 / -1;
        height: auto;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
}

@media (max-width: 880px) {
    .shell {
        display: block;
    }

    .left-rail {
        position: static;
        height: auto;
        padding: 14px;
    }

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

    .nav-item {
        text-align: center;
        padding: 10px 8px;
    }

    .topbar,
    .calendar-head,
    .card-head {
        align-items: start;
        flex-direction: column;
    }

    .metrics,
    .progress-map,
    .route-board,
    .case-grid,
    .detail-columns,
    .report-layout {
        grid-template-columns: 1fr;
    }

    .track-line {
        display: none;
    }
}

@media (max-width: 560px) {
    .workspace {
        padding: 18px 12px;
    }

    .searchbar,
    .action-row {
        flex-direction: column;
    }

    .searchbar button,
    .primary-action,
    .ghost-action {
        width: 100%;
    }

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

    h1 {
        font-size: 40px;
    }

    .metric strong {
        font-size: 40px;
    }
}
