:root {
    --ink: #1a1a2e;
    --paper: #f2e9e4;
    --muted: #9a8c98;
    --clay: #c9ada7;
    --ember: #b75d37;
    --moss: #536b55;
    --line: rgba(26, 26, 46, 0.18);
    --soft: rgba(255, 255, 255, 0.42);
    --shadow: 0 24px 60px rgba(26, 26, 46, 0.14);
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(90deg, rgba(26, 26, 46, 0.035) 1px, transparent 1px),
        linear-gradient(rgba(26, 26, 46, 0.035) 1px, transparent 1px),
        var(--paper);
    background-size: 28px 28px;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand span {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 26px;
    line-height: 1;
}

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

.nav-button {
    width: 100%;
    padding: 13px 12px;
    color: rgba(242, 233, 228, 0.78);
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0;
}

.nav-button:hover,
.nav-button.is-active {
    color: var(--paper);
    background: rgba(242, 233, 228, 0.08);
    border-color: rgba(242, 233, 228, 0.24);
}

.rail-note {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(242, 233, 228, 0.25);
}

.rail-note span,
.eyebrow,
.metric-block span,
.row-meta,
.rule-tile span,
.person-tile span,
.detail-grid dt {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 760;
    letter-spacing: 0;
    text-transform: uppercase;
}

.rail-note strong {
    display: block;
    margin-top: 8px;
    color: var(--paper);
    font-size: 18px;
    line-height: 1.25;
}

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

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 22px;
    border-bottom: 2px solid var(--ink);
}

.topbar h1 {
    margin: 2px 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 5vw, 64px);
    font-weight: 500;
    line-height: 0.94;
}

.searchbar {
    display: grid;
    gap: 7px;
    width: min(320px, 100%);
}

.searchbar label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 780;
    text-transform: uppercase;
}

.searchbar input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid var(--ink);
    border-radius: 0;
    outline: none;
}

.searchbar input:focus {
    box-shadow: 4px 4px 0 var(--clay);
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
    border: 2px solid var(--ink);
    background: rgba(255, 255, 255, 0.35);
}

.metric-block {
    min-width: 0;
    padding: 16px;
    border-right: 2px solid var(--ink);
}

.metric-block:last-child {
    border-right: 0;
}

.metric-block strong {
    display: block;
    margin-top: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(28px, 4vw, 52px);
    font-weight: 500;
    line-height: 0.9;
}

.flow-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
    border-top: 2px solid var(--line);
    border-bottom: 2px solid var(--line);
}

.flow-step {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 15px 14px;
    text-align: left;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line);
}

.flow-step:hover {
    background: rgba(183, 93, 55, 0.08);
}

.flow-step.is-active {
    background: rgba(183, 93, 55, 0.12);
    box-shadow: inset 0 -4px 0 var(--ember);
}

.flow-step span {
    color: var(--ember);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
}

.flow-step strong,
.flow-step em {
    overflow-wrap: anywhere;
}

.flow-step em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.screen {
    display: none;
    margin-top: 22px;
}

.screen.is-visible {
    display: block;
    animation: rise 220ms ease-out both;
}

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

.queue-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: 2px solid var(--ink);
}

.segmented button {
    min-height: 38px;
    padding: 8px 12px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.35);
    border: 0;
    border-right: 1px solid var(--line);
}

.segmented button:last-child {
    border-right: 0;
}

.segmented button.is-active {
    color: var(--paper);
    background: var(--ink);
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

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

.queue-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 116px;
    gap: 14px;
    align-items: stretch;
    padding: 14px;
    background: rgba(255, 255, 255, 0.45);
    border: 2px solid var(--line);
    box-shadow: none;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.queue-row:hover,
.queue-row.is-selected {
    background: rgba(255, 255, 255, 0.72);
    border-color: var(--ink);
    transform: translateX(4px);
}

.row-index {
    display: grid;
    place-items: center;
    color: var(--paper);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
    background: var(--ember);
}

.row-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.row-title h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.row-main p {
    margin: 7px 0 10px;
    color: rgba(26, 26, 46, 0.72);
    font-size: 13px;
}

.status-pill {
    flex: 0 0 auto;
    padding: 5px 8px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 780;
    border: 1px solid var(--line);
}

.status-blocked {
    background: #f0b49f;
}

.status-review,
.status-modeling {
    background: #dccbcf;
}

.status-ready,
.status-presented {
    background: #c8d6be;
}

.row-progress,
.load-line,
.inspection-meter i {
    display: block;
    height: 7px;
    overflow: hidden;
    background: rgba(26, 26, 46, 0.12);
}

.row-progress i,
.load-line i,
.inspection-meter b {
    display: block;
    height: 100%;
    background: var(--ember);
}

.row-meta {
    display: grid;
    align-content: center;
    gap: 9px;
    text-align: right;
}

.row-meta strong {
    color: var(--ink);
    font-size: 20px;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding-bottom: 13px;
    border-bottom: 2px solid var(--line);
}

.section-head h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
    font-weight: 500;
}

.section-head p {
    max-width: 440px;
    margin: 0;
    color: rgba(26, 26, 46, 0.68);
    font-size: 14px;
    line-height: 1.45;
}

.timeline,
.rules-grid,
.team-grid {
    display: grid;
    gap: 12px;
}

.timeline-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.timeline-row time {
    color: var(--ember);
    font-size: 13px;
    font-weight: 760;
}

.timeline-row strong,
.timeline-row p {
    margin: 0 0 4px;
}

.timeline-row span {
    color: var(--muted);
    font-size: 13px;
}

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

.rule-tile,
.person-tile {
    min-width: 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.45);
    border: 2px solid var(--line);
}

.rule-tile h3,
.person-tile h3 {
    margin: 8px 0 7px;
    font-size: 19px;
    line-height: 1.2;
}

.rule-tile p,
.person-tile p {
    margin: 0 0 14px;
    color: rgba(26, 26, 46, 0.72);
    font-size: 14px;
    line-height: 1.45;
}

.toggle-rule {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--line);
}

.toggle-rule i {
    width: 32px;
    height: 18px;
    background: var(--muted);
    box-shadow: inset 14px 0 0 var(--paper);
}

.toggle-rule.is-on i {
    background: var(--moss);
    box-shadow: inset -14px 0 0 var(--paper);
}

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

.person-tile {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    color: var(--paper);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 28px;
    background: var(--ink);
}

.person-tile em {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.inspector {
    position: sticky;
    top: 0;
    height: 100vh;
    min-width: 0;
    padding: 24px;
    overflow: auto;
    background: rgba(201, 173, 167, 0.34);
    border-left: 3px solid var(--ink);
}

.inspector h2 {
    margin: 4px 0 12px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 31px;
    font-weight: 500;
    line-height: 1;
}

.inspector-empty {
    padding-top: 26vh;
}

.inspector-empty p,
.inspector-lead,
.next-step {
    color: rgba(26, 26, 46, 0.72);
    line-height: 1.5;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.detail-grid div,
.evidence-box,
.inspection-meter,
.next-step {
    padding: 12px;
    background: rgba(242, 233, 228, 0.58);
    border: 1px solid var(--line);
}

.detail-grid dd {
    margin: 4px 0 0;
    font-weight: 760;
    overflow-wrap: anywhere;
}

.inspection-meter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.inspection-meter i {
    grid-column: 1 / -1;
}

.evidence-box {
    display: grid;
    gap: 7px;
    margin-top: 10px;
}

.evidence-box span,
.evidence-box em {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
}

.evidence-box strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 500;
}

.action-stack {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.action-stack button {
    min-height: 42px;
    color: var(--paper);
    background: var(--ink);
    border: 2px solid var(--ink);
}

.action-stack button:hover {
    color: var(--ink);
    background: transparent;
}

.empty-line {
    padding: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.45);
    border: 2px dashed var(--line);
}

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

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

    .inspector-empty {
        padding-top: 0;
    }
}

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

    .rail {
        position: static;
        height: auto;
        padding: 16px;
    }

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

    .topbar,
    .queue-toolbar,
    .section-head {
        display: grid;
    }

    .workspace {
        padding: 18px 14px 24px;
    }

    .metric-strip,
    .flow-strip,
    .rules-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }

    .metric-block {
        border-right: 0;
        border-bottom: 2px solid var(--ink);
    }

    .metric-block:last-child {
        border-bottom: 0;
    }

    .queue-row {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .row-title {
        display: grid;
    }

    .row-meta {
        grid-column: 2;
        display: flex;
        justify-content: space-between;
        text-align: left;
    }

    .timeline-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

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