:root {
    --ink: #0d1b2a;
    --paper: #f5ebe0;
    --steel: #778da9;
    --brass: #e0a458;
    --line: rgba(13, 27, 42, .18);
    --panel: rgba(245, 235, 224, .94);
    --shadow: 0 18px 60px rgba(13, 27, 42, .18);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(13, 27, 42, .07) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(rgba(13, 27, 42, .07) 1px, transparent 1px) 0 0 / 24px 24px,
        var(--paper);
}

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

button {
    cursor: pointer;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(14px, 2.5vw, 28px);
    color: var(--paper);
    background: var(--ink);
    border-bottom: 4px solid var(--brass);
}

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

.brand img {
    flex: 0 0 auto;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .25));
}

.brand strong {
    display: block;
    font-size: 18px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand small {
    display: block;
    color: rgba(245, 235, 224, .72);
    line-height: 1.2;
}

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

.tab {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(245, 235, 224, .28);
    color: var(--paper);
    background: rgba(245, 235, 224, .06);
    border-radius: 4px;
}

.tab.is-active {
    color: var(--ink);
    background: var(--brass);
    border-color: var(--brass);
}

.workspace {
    display: grid;
    grid-template-columns: minmax(144px, 168px) minmax(0, 1fr) minmax(240px, 300px);
    gap: 18px;
    padding: 18px;
}

.metrics-spine,
.quick-create {
    align-self: start;
    position: sticky;
    top: 18px;
}

.metrics-spine {
    display: grid;
    gap: 10px;
}

.metric,
.dial {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .34);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .36);
    padding: 12px;
    border-radius: 6px;
}

.metric span,
.dial span {
    display: block;
    color: rgba(13, 27, 42, .68);
    font-size: 12px;
    line-height: 1.25;
}

.metric strong {
    display: block;
    margin-top: 5px;
    font-size: clamp(24px, 4vw, 38px);
    line-height: .95;
}

.metric.featured {
    color: var(--paper);
    background: var(--ink);
    border-color: var(--ink);
}

.metric.featured span {
    color: rgba(245, 235, 224, .72);
}

.stage-dials {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dial strong {
    display: block;
    font-size: 24px;
}

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

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

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

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 48px);
    line-height: .95;
    letter-spacing: 0;
    text-transform: uppercase;
}

h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.08;
}

h3 {
    margin: 22px 0 10px;
    font-size: 13px;
    text-transform: uppercase;
}

.search {
    display: grid;
    gap: 6px;
    min-width: min(320px, 100%);
}

label span,
.search span {
    color: rgba(13, 27, 42, .66);
    font-size: 12px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--ink);
    background: rgba(255, 255, 255, .62);
    padding: 10px 11px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(224, 164, 88, .22);
}

.screen {
    display: none;
}

.screen.is-active {
    display: block;
}

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

.lane {
    min-width: 0;
    border-top: 5px solid var(--ink);
    background: rgba(255, 255, 255, .28);
    padding: 10px;
    box-shadow: inset 0 0 0 1px var(--line);
}

.lane header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
    margin-bottom: 10px;
}

.lane header span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: var(--ink);
    background: var(--brass);
    border-radius: 50%;
    font-weight: 900;
}

.lane-stack {
    display: grid;
    gap: 10px;
}

.work-card {
    border: 1px solid var(--line);
    border-left: 6px solid var(--steel);
    border-radius: 6px;
    background: var(--panel);
    padding: 12px;
    box-shadow: var(--shadow);
    transition: transform .16s ease, border-color .16s ease;
}

.work-card:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 27, 42, .42);
}

.work-card.status-risk,
.work-card.status-blocked {
    border-left-color: #b54d3f;
}

.work-card.status-ready {
    border-left-color: #4d7c59;
}

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

.card-head strong {
    min-width: 0;
    line-height: 1.15;
}

.card-head span,
.status-pill {
    align-self: start;
    flex: 0 0 auto;
    padding: 4px 7px;
    border-radius: 3px;
    color: var(--paper);
    background: var(--steel);
    font-size: 11px;
    font-weight: 800;
}

.card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    color: rgba(13, 27, 42, .68);
    font-size: 12px;
}

.work-card p {
    margin: 8px 0 12px;
    color: rgba(13, 27, 42, .78);
}

.stage-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: 12px;
}

.move-btn {
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: rgba(119, 141, 169, .12);
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
}

.move-btn.is-current {
    background: var(--ink);
    color: var(--paper);
}

.empty {
    margin: 0;
    padding: 14px;
    color: rgba(13, 27, 42, .55);
    border: 1px dashed var(--line);
}

.quick-create {
    background: var(--ink);
    color: var(--paper);
    border-radius: 6px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.quick-create h2 {
    margin-bottom: 14px;
    text-transform: uppercase;
}

.quick-create form,
.decision-panel {
    display: grid;
    gap: 12px;
}

.quick-create label,
.decision-panel label {
    display: grid;
    gap: 6px;
}

.quick-create label span {
    color: rgba(245, 235, 224, .7);
}

.quick-create input {
    color: var(--paper);
    border-color: rgba(245, 235, 224, .22);
    background: rgba(245, 235, 224, .08);
}

.quick-create button,
.decision-panel button {
    min-height: 42px;
    border: 0;
    border-radius: 5px;
    color: var(--ink);
    background: var(--brass);
    font-weight: 900;
}

.panel-note {
    min-height: 42px;
    margin: 14px 0 0;
    color: rgba(245, 235, 224, .72);
    font-size: 13px;
    line-height: 1.35;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
    gap: 16px;
}

.detail-pane,
.decision-panel,
.calendar-row,
.report-grid section {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, .45);
    padding: 16px;
    box-shadow: var(--shadow);
}

.detail-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.detail-top h2 {
    font-size: clamp(24px, 3vw, 38px);
    text-transform: uppercase;
}

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

.detail-facts div {
    border-top: 3px solid var(--steel);
    padding-top: 8px;
}

dt {
    color: rgba(13, 27, 42, .62);
    font-size: 12px;
    font-weight: 800;
}

dd {
    margin: 2px 0 0;
    font-weight: 800;
}

.notes {
    margin: 0;
    padding: 14px;
    background: rgba(224, 164, 88, .18);
    border-left: 5px solid var(--brass);
}

.decision-list,
.invoice-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.decision-list li,
.invoice-list li,
.report-line,
.load-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: rgba(245, 235, 224, .62);
}

.decision-list li strong {
    grid-column: 1 / -1;
}

.vote-plus {
    border-left: 5px solid #4d7c59 !important;
}

.vote-neutral {
    border-left: 5px solid var(--brass) !important;
}

.vote-minus {
    border-left: 5px solid #b54d3f !important;
}

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

.calendar-row {
    width: 100%;
    display: grid;
    grid-template-columns: 150px minmax(0, 1.2fr) minmax(120px, .8fr) auto;
    gap: 12px;
    text-align: left;
    color: var(--ink);
}

.calendar-row:hover {
    border-color: var(--brass);
}

.time {
    font-weight: 900;
}

.calendar-row em {
    justify-self: end;
    font-style: normal;
    font-weight: 900;
    color: var(--steel);
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.report-grid section {
    display: grid;
    gap: 10px;
}

.report-line {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.report-line em {
    color: var(--steel);
    font-style: normal;
    font-weight: 800;
}

.load-row {
    grid-template-columns: minmax(0, 1fr) minmax(80px, .7fr) auto;
}

meter {
    width: 100%;
    height: 12px;
    accent-color: var(--brass);
}

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

    .quick-create {
        grid-column: 1 / -1;
        position: static;
    }

    .quick-create form {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
    }

    .quick-create h2,
    .panel-note {
        grid-column: 1 / -1;
    }

    .kanban {
        grid-template-columns: repeat(2, minmax(230px, 1fr));
    }
}

@media (max-width: 780px) {
    .topbar,
    .board-toolbar,
    .detail-top {
        align-items: stretch;
        flex-direction: column;
    }

    .tabs {
        justify-content: start;
    }

    .workspace {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .metrics-spine {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stage-dials {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .kanban,
    .detail-layout,
    .report-grid,
    .quick-create form {
        grid-template-columns: 1fr;
    }

    .calendar-row {
        grid-template-columns: 1fr;
    }

    .calendar-row em {
        justify-self: start;
    }

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

@media (max-width: 480px) {
    .brand {
        min-width: 0;
    }

    .brand strong {
        font-size: 16px;
    }

    .tab {
        flex: 1 1 42%;
        padding: 0 8px;
    }

    .metrics-spine,
    .stage-dials,
    .detail-facts {
        grid-template-columns: 1fr;
    }

    .stage-actions,
    .card-meta {
        grid-template-columns: 1fr;
    }
}

