:root {
    --ink: #1a1a2e;
    --paper: #f2e9e4;
    --mauve: #9a8c98;
    --clay: #c9ada7;
    --cream: #fffaf3;
    --line: rgba(26, 26, 46, 0.22);
    --green: #476f5a;
    --red: #a3423f;
    --amber: #9f6b32;
}

* {
    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(26, 26, 46, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(0deg, rgba(26, 26, 46, 0.04) 1px, transparent 1px) 0 0 / 32px 32px,
        var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

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

.rail,
.inspector {
    position: sticky;
    top: 0;
    height: 100vh;
    background: rgba(255, 250, 243, 0.72);
    backdrop-filter: blur(16px);
}

.rail {
    display: flex;
    flex-direction: column;
    border-right: 2px solid var(--ink);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 96px;
    padding: 20px;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 2px solid var(--ink);
}

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

.rail-nav {
    display: grid;
}

.nav-item {
    width: 100%;
    padding: 18px 20px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 160ms ease, padding-left 160ms ease;
}

.nav-item:hover,
.nav-item.is-active {
    background: var(--clay);
    padding-left: 28px;
}

.rail-note {
    margin-top: auto;
    padding: 20px;
    border-top: 2px solid var(--ink);
    font-size: 13px;
    line-height: 1.45;
}

.rail-kicker,
.eyebrow,
.drawer-label {
    display: block;
    margin: 0 0 8px;
    color: var(--mauve);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

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

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

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

h1 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 6vw, 82px);
    line-height: 0.9;
}

h2 {
    margin-bottom: 6px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    line-height: 1;
}

h3 {
    margin-bottom: 8px;
    font-size: 18px;
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(220px, 340px) 150px;
    gap: 10px;
    width: min(100%, 520px);
}

.search-bar input,
.search-bar select,
.action-form textarea {
    min-width: 0;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--cream);
    color: var(--ink);
    outline: 0;
}

.search-bar input,
.search-bar select {
    height: 44px;
    padding: 0 12px;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 26px;
    border: 2px solid var(--ink);
    background: var(--cream);
}

.metric-strip div {
    min-width: 0;
    padding: 18px;
    border-right: 1px solid var(--line);
}

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

.metric-strip span {
    display: block;
    margin-bottom: 8px;
    color: var(--mauve);
    font-size: 12px;
}

.metric-strip strong {
    display: block;
    overflow-wrap: anywhere;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(30px, 4vw, 56px);
    line-height: 0.9;
}

.canvas {
    display: none;
}

.canvas.is-active {
    display: block;
    animation: enter 220ms ease both;
}

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

.section-head p {
    max-width: 620px;
    margin-bottom: 0;
    color: rgba(26, 26, 46, 0.72);
}

.stage-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.stage-chip {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--ink);
    background: var(--paper);
    cursor: pointer;
}

.stage-chip.is-active,
.stage-chip:hover {
    background: var(--ink);
    color: var(--paper);
}

.queue-list {
    display: grid;
    border-top: 2px solid var(--ink);
}

.queue-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 132px 156px 88px;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 88px;
    padding: 16px 18px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 250, 243, 0.64);
    text-align: left;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

.queue-row:hover,
.queue-row.is-selected {
    background: var(--cream);
    transform: translateX(4px);
}

.row-main {
    min-width: 0;
}

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

.row-main small {
    margin-top: 7px;
    color: rgba(26, 26, 46, 0.66);
}

.stage-mark {
    font-size: 13px;
    font-weight: 700;
}

.risk-meter {
    display: grid;
    grid-template-columns: 1fr 44px;
    align-items: center;
    gap: 10px;
}

.risk-meter i {
    display: block;
    height: 8px;
    border: 1px solid var(--ink);
    background: linear-gradient(90deg, var(--red) var(--risk), transparent 0);
}

.risk-meter b {
    font-size: 13px;
}

.status-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--ink);
    font-size: 12px;
    font-weight: 800;
}

.status-at_risk {
    background: #f1c1b7;
}

.status-in_review {
    background: #ead1a0;
}

.status-ready {
    background: #c9d9c3;
}

.inspector {
    overflow: auto;
    padding: 24px;
    border-left: 2px solid var(--ink);
}

.inspect-head {
    padding-bottom: 18px;
    border-bottom: 2px solid var(--ink);
}

.inspect-head h2 {
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}

.inspect-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: 18px 0;
    border: 1px solid var(--ink);
    background: var(--cream);
}

.inspect-facts div {
    min-width: 0;
    padding: 12px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.inspect-facts dt {
    margin-bottom: 5px;
    color: var(--mauve);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.inspect-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.next-step {
    margin-bottom: 18px;
    padding: 16px;
    background: var(--ink);
    color: var(--paper);
}

.next-step span {
    display: block;
    margin-bottom: 7px;
    color: var(--clay);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.next-step p {
    margin-bottom: 0;
    line-height: 1.45;
}

.action-form {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.action-form label {
    font-weight: 800;
}

.action-form textarea {
    width: 100%;
    min-height: 112px;
    padding: 12px;
    resize: vertical;
}

.action-form button {
    min-height: 42px;
    border: 2px solid var(--ink);
    background: var(--clay);
    cursor: pointer;
    font-weight: 800;
}

.item-actions {
    display: grid;
    gap: 10px;
}

.item-actions article,
.timeline-item,
.workflow-step,
.team-member,
.empty-state {
    background: rgba(255, 250, 243, 0.74);
    border: 1px solid var(--ink);
}

.item-actions article {
    padding: 12px;
}

.item-actions p {
    margin: 6px 0;
    line-height: 1.4;
}

.item-actions time,
.timeline-item span {
    color: var(--mauve);
    font-size: 12px;
}

.timeline {
    display: grid;
}

.timeline-item {
    display: grid;
    grid-template-columns: 170px 150px minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
    border-bottom: 0;
}

.timeline-item p {
    margin-bottom: 0;
}

.workflow-grid,
.team-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.workflow-step,
.team-member {
    min-height: 190px;
    padding: 18px;
}

.workflow-step span,
.team-member span {
    display: block;
    margin-bottom: 22px;
    color: var(--mauve);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
}

.workflow-step p,
.team-member p {
    color: rgba(26, 26, 46, 0.72);
    line-height: 1.45;
}

.workflow-step strong {
    display: block;
    margin-top: 18px;
}

.empty-state {
    padding: 24px;
    color: rgba(26, 26, 46, 0.72);
}

.empty-state.error {
    border-color: var(--red);
    color: var(--red);
}

.muted {
    color: rgba(26, 26, 46, 0.62);
}

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

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

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

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

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

    .rail {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 2px solid var(--ink);
    }

    .brand {
        min-height: 76px;
    }

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

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

    .nav-item:hover,
    .nav-item.is-active {
        padding-left: 8px;
    }

    .rail-note {
        display: none;
    }

    .workspace,
    .inspector {
        padding: 18px;
    }

    .topline,
    .section-head {
        display: grid;
    }

    .search-bar {
        grid-template-columns: 1fr;
        width: 100%;
    }

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

    .metric-strip div:nth-child(2) {
        border-right: 0;
    }

    .queue-row {
        grid-template-columns: 1fr;
        gap: 10px;
        transform: none;
    }

    .queue-row:hover,
    .queue-row.is-selected {
        transform: none;
    }

    .risk-meter {
        grid-template-columns: 1fr 52px;
    }

    .timeline-item,
    .workflow-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }

    .inspect-facts {
        grid-template-columns: 1fr;
    }
}

