:root {
    --ink: #0f1f1c;
    --paper: #f8f9fa;
    --rose: #c9ada7;
    --green: #4a7c59;
    --line: rgba(15, 31, 28, 0.12);
    --muted: rgba(15, 31, 28, 0.62);
    --white: #ffffff;
    --amber: #e7b75f;
    --shadow: 0 24px 70px rgba(15, 31, 28, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(201, 173, 167, 0.2), transparent 38%),
        var(--paper);
    font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

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

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 28px 22px;
    color: var(--paper);
    background: var(--ink);
}

.brand {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.brand strong,
.brand small {
    display: block;
    overflow-wrap: anywhere;
}

.brand strong {
    font-size: 18px;
    line-height: 1.05;
}

.brand small {
    margin-top: 4px;
    color: rgba(248, 249, 250, 0.62);
    text-transform: uppercase;
    font-size: 11px;
}

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

.nav-item {
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(248, 249, 250, 0.16);
    border-radius: 8px;
    color: rgba(248, 249, 250, 0.76);
    background: transparent;
    text-align: left;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover,
.nav-item.is-active {
    color: var(--paper);
    background: rgba(201, 173, 167, 0.18);
    transform: translateX(2px);
}

.sidebar-note {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(248, 249, 250, 0.16);
}

.note-label,
.eyebrow,
.detail-kicker {
    display: block;
    color: var(--green);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
}

.sidebar-note .note-label {
    color: var(--rose);
}

.sidebar-note p {
    margin: 8px 0 0;
    color: rgba(248, 249, 250, 0.7);
    line-height: 1.7;
}

.workspace {
    min-width: 0;
    padding: 28px;
}

.topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
    gap: 20px;
    align-items: end;
}

.topline h1 {
    margin: 6px 0 0;
    font-size: clamp(30px, 4vw, 58px);
    line-height: 0.96;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0;
}

.search-box {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
}

.search-box input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--ink);
    background: var(--white);
    outline: none;
}

.search-box input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.16);
}

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

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

.metric-strip span {
    display: block;
    font-size: clamp(26px, 3vw, 42px);
    line-height: 1;
}

.metric-strip small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.35;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(240px, 0.86fr) minmax(280px, 1fr) minmax(300px, 0.9fr);
    gap: 18px;
    align-items: stretch;
    animation: riseIn 420ms ease both;
}

.case-column,
.timeline-column,
.detail-sheet,
.sheet-wide {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
}

.case-column,
.timeline-column {
    padding: 18px;
}

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

.section-heading h2,
.sheet-wide h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.15;
}

.section-heading span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
}

.case-list {
    display: grid;
    gap: 10px;
}

.case-row {
    display: grid;
    gap: 7px;
    width: 100%;
    min-height: 116px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: var(--paper);
    text-align: left;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.case-row:hover,
.case-row.is-selected {
    transform: translateY(-2px);
    border-color: rgba(74, 124, 89, 0.55);
    background: #ffffff;
}

.case-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}

.case-meta,
.case-foot em,
.empty-state {
    color: var(--muted);
    font-style: normal;
    line-height: 1.45;
}

.case-foot {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.case-foot strong {
    color: var(--green);
    font-size: 22px;
}

.timeline {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline li {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 13px;
    border-left: 4px solid var(--line);
    border-radius: 8px;
    background: rgba(248, 249, 250, 0.84);
}

.timeline li.active {
    border-left-color: var(--green);
    background: rgba(74, 124, 89, 0.1);
}

.timeline li.next {
    border-left-color: var(--rose);
}

.timeline time {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.timeline span {
    line-height: 1.55;
}

.detail-sheet {
    position: relative;
    overflow: hidden;
    padding: 22px;
    background:
        linear-gradient(145deg, rgba(15, 31, 28, 0.96), rgba(15, 31, 28, 0.86)),
        var(--ink);
    color: var(--paper);
}

.detail-sheet:before {
    position: absolute;
    inset: 18px 18px auto auto;
    width: 74px;
    height: 74px;
    border: 1px solid rgba(201, 173, 167, 0.5);
    border-radius: 8px;
    content: "";
}

.detail-sheet h2 {
    position: relative;
    margin: 10px 0;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.06;
}

.detail-meta {
    position: relative;
    margin: 0;
    color: rgba(248, 249, 250, 0.68);
    line-height: 1.5;
}

.quality-ring {
    display: grid;
    place-items: center;
    width: 124px;
    height: 124px;
    margin: 22px 0;
    border: 12px solid rgba(201, 173, 167, 0.32);
    border-top-color: var(--green);
    border-radius: 50%;
    color: var(--paper);
}

.quality-ring span {
    font-size: 30px;
    font-weight: 700;
}

.detail-grid {
    display: grid;
    gap: 14px;
    margin: 0;
}

.detail-grid div {
    padding-top: 13px;
    border-top: 1px solid rgba(248, 249, 250, 0.14);
}

.detail-grid dt {
    color: rgba(248, 249, 250, 0.52);
    font-size: 12px;
    text-transform: uppercase;
}

.detail-grid dd {
    margin: 6px 0 0;
    line-height: 1.55;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.primary-action,
.ghost-action {
    min-height: 42px;
    border-radius: 8px;
    padding: 0 14px;
    border: 1px solid rgba(248, 249, 250, 0.24);
    transition: transform 180ms ease, background 180ms ease;
}

.primary-action {
    border-color: var(--green);
    color: var(--paper);
    background: var(--green);
}

.ghost-action {
    color: var(--paper);
    background: transparent;
}

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

.action-status {
    min-height: 22px;
    margin: 12px 0 0;
    color: var(--rose);
}

.alt-screen {
    animation: riseIn 320ms ease both;
}

.sheet-wide {
    padding: 22px;
}

.info-grid,
.calendar-grid,
.report-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.info-tile,
.calendar-item,
.report-item,
.report-lead {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.info-tile span,
.calendar-item time,
.report-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.info-tile strong,
.calendar-item h3,
.report-item strong {
    display: block;
    margin-top: 8px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.calendar-item p,
.report-item p,
.report-lead p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.report-lead {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    background: rgba(74, 124, 89, 0.12);
}

.report-lead span {
    color: var(--green);
    font-size: clamp(38px, 5vw, 72px);
    line-height: 1;
}

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

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

    .timeline-column {
        grid-column: 1 / 2;
    }

    .detail-sheet {
        grid-column: 2 / 3;
        grid-row: 1 / span 2;
    }
}

@media (max-width: 860px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 4;
        display: grid;
        grid-template-columns: minmax(190px, 1fr) auto;
        gap: 14px;
        padding: 14px;
    }

    .nav-stack {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        align-self: center;
    }

    .nav-item {
        min-height: 38px;
        padding: 0 8px;
        text-align: center;
        font-size: 13px;
    }

    .sidebar-note {
        display: none;
    }

    .workspace {
        padding: 18px;
    }

    .topline,
    .dashboard,
    .info-grid,
    .calendar-grid,
    .report-grid {
        grid-template-columns: 1fr;
    }

    .detail-sheet,
    .timeline-column {
        grid-column: auto;
        grid-row: auto;
    }

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

@media (max-width: 560px) {
    .sidebar {
        position: static;
        grid-template-columns: 1fr;
    }

    .brand {
        max-width: 100%;
    }

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

    .metric-strip {
        grid-template-columns: 1fr;
    }

    .timeline li {
        grid-template-columns: 1fr;
    }

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