:root {
    --ink: #141414;
    --paper: #faf7f0;
    --muted: #756f66;
    --line: rgba(20, 20, 20, 0.16);
    --violet: #7c3aed;
    --green: #10b981;
    --amber: #d97706;
    --red: #be123c;
    --white: #fffdf8;
    --shadow: 0 22px 55px rgba(20, 20, 20, 0.12);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(20, 20, 20, 0.05) 1px, transparent 1px) 0 0 / 34px 34px,
        var(--paper);
}

.command-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(280px, 1fr) minmax(300px, 430px);
    gap: 18px;
    align-items: center;
    padding: 14px clamp(14px, 3vw, 34px);
    border-bottom: 2px solid var(--ink);
    background: rgba(250, 247, 240, 0.94);
    backdrop-filter: blur(18px);
}

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

.brand img {
    flex: 0 0 auto;
    box-shadow: 5px 5px 0 var(--ink);
}

.brand strong,
.workspace-head h1 {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

.brand strong {
    display: block;
    font-size: 1.34rem;
    line-height: 1;
}

.brand small,
.metric small,
.request-row small,
.lane p,
.workspace-head p,
.board-head p,
.event small {
    color: var(--muted);
}

.tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    min-width: 0;
}

.tab,
.icon-button,
.primary-button,
.request-row,
.lane-card {
    border: 2px solid var(--ink);
    color: var(--ink);
    background: var(--white);
}

.tab {
    min-height: 40px;
    padding: 8px 12px;
    transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.tab:hover,
.lane-card:hover,
.request-row:hover {
    transform: translateY(-1px);
}

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

.toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.toolbar input {
    width: min(100%, 240px);
    min-height: 42px;
    border: 2px solid var(--ink);
    background: var(--white);
    padding: 9px 11px;
}

.icon-button {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    line-height: 1;
}

.primary-button {
    min-height: 42px;
    padding: 9px 14px;
    font-weight: 800;
    background: var(--green);
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 4px 4px 0 var(--ink);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.wide {
    width: 100%;
}

.workspace {
    padding: 24px clamp(14px, 3vw, 34px) 34px;
}

.workspace-head,
.board-head,
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.workspace-head {
    margin-bottom: 18px;
}

.eyebrow,
.mono,
.event-type {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workspace-head h1 {
    margin: 4px 0 0;
    font-size: clamp(2.35rem, 5vw, 5.8rem);
    line-height: 0.93;
    max-width: 900px;
}

.source-pill {
    flex: 0 0 auto;
    min-width: 190px;
    border-left: 5px solid var(--violet);
    padding-left: 14px;
}

.source-pill strong {
    display: block;
    word-break: break-word;
}

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

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

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

.metric strong {
    display: block;
    margin: 4px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 0.95;
}

.metric-accent {
    background: rgba(16, 185, 129, 0.14);
}

.metric-alert {
    background: rgba(190, 18, 60, 0.08);
}

.view {
    display: none;
}

.view.is-visible {
    display: block;
    animation: reveal 220ms ease both;
}

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

.board-head,
.section-head {
    margin: 0 0 12px;
}

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

.board-head h2,
.section-head h2 {
    margin-bottom: 2px;
    font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.lane-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.lane {
    min-width: 0;
    border-top: 5px solid var(--ink);
    background: rgba(255, 253, 248, 0.74);
    padding: 12px;
}

.lane-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.lane-title h3 {
    margin: 0;
}

.lane-title span {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    border: 2px solid var(--ink);
    background: var(--violet);
    color: var(--paper);
    font-weight: 900;
}

.lane p {
    min-height: 38px;
    font-size: 0.88rem;
}

.lane-cards {
    display: grid;
    gap: 9px;
}

.lane-card {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 6px 9px;
    width: 100%;
    min-height: 92px;
    padding: 10px;
    text-align: left;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.lane-card.is-selected,
.request-row.is-selected {
    box-shadow: 4px 4px 0 var(--violet);
}

.lane-card strong,
.lane-card small,
.progress-line {
    grid-column: 2;
    min-width: 0;
}

.lane-card small {
    color: var(--muted);
}

.status-dot {
    grid-row: 1 / 4;
    width: 12px;
    height: 12px;
    margin-top: 3px;
    background: var(--green);
}

.status-dot.watch,
.chip.watch {
    background: var(--amber);
}

.status-dot.conflict,
.chip.conflict {
    background: var(--red);
    color: var(--paper);
}

.progress-line {
    display: block;
    height: 8px;
    background: rgba(20, 20, 20, 0.13);
    overflow: hidden;
}

.progress-line i {
    display: block;
    height: 100%;
    background: var(--green);
}

.split-zone,
.analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 18px;
    align-items: start;
}

.table-zone,
.inspector,
.analysis-panel,
.import-panel,
.public-status,
.event-stream {
    border: 2px solid var(--ink);
    background: var(--white);
}

.table-zone,
.inspector,
.analysis-panel,
.import-panel,
.public-status {
    padding: 16px;
}

.request-table {
    display: grid;
    gap: 8px;
}

.request-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.35fr) minmax(120px, 0.75fr) minmax(150px, 0.9fr) 78px;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 68px;
    padding: 10px 12px;
    text-align: left;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.request-row span {
    min-width: 0;
}

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

.chip {
    justify-self: end;
    min-width: 64px;
    border: 2px solid var(--ink);
    padding: 7px 8px;
    background: var(--green);
    text-align: center;
    font-weight: 900;
}

.inspector {
    position: sticky;
    top: 104px;
}

.inspector h2 {
    margin: 8px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.2rem;
    line-height: 1;
}

.inspector dl {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 16px 0;
}

.inspector dt {
    color: var(--muted);
    font-weight: 800;
}

.inspector dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.analysis-panel h3 {
    margin-bottom: 18px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
}

.analysis-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 12px;
    align-items: center;
    min-height: 48px;
    border-top: 2px solid var(--line);
}

.analysis-row i {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 5px;
    background: var(--violet);
}

.workflow-line,
.status-list div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 0;
    border-top: 2px solid var(--line);
}

.import-panel {
    max-width: 780px;
}

.import-panel h2,
.status-stamp h3 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 0.98;
}

pre {
    max-width: 100%;
    overflow: auto;
    border: 2px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    padding: 14px;
}

.status-stamp {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.status-stamp img {
    flex: 0 0 auto;
    box-shadow: 5px 5px 0 var(--ink);
}

.status-list {
    margin-top: 18px;
}

.status-list span {
    min-width: 42px;
    text-align: right;
    font-weight: 900;
}

.event-stream {
    margin-top: 22px;
    padding: 14px 16px 16px;
}

.timeline {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 330px);
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.event {
    min-height: 128px;
    border-left: 5px solid var(--violet);
    background: rgba(250, 247, 240, 0.72);
    padding: 12px;
}

.event p {
    margin: 6px 0 12px;
}

.event-type {
    color: var(--violet);
}

.empty-state,
.empty-lane {
    border: 2px dashed var(--line);
    padding: 16px;
    color: var(--muted);
}

dialog {
    width: min(520px, calc(100vw - 24px));
    border: 2px solid var(--ink);
    background: var(--paper);
    box-shadow: 10px 10px 0 var(--ink);
}

dialog::backdrop {
    background: rgba(20, 20, 20, 0.45);
}

.dialog-form {
    display: grid;
    gap: 16px;
}

.dialog-form h2 {
    margin: 4px 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
}

.dialog-form label {
    display: grid;
    gap: 8px;
    font-weight: 800;
}

textarea {
    min-width: 0;
    resize: vertical;
    border: 2px solid var(--ink);
    padding: 10px;
    background: var(--white);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.dialog-actions button:not(.primary-button) {
    min-height: 42px;
    border: 2px solid var(--ink);
    background: var(--white);
    padding: 9px 14px;
}

@media (max-width: 1040px) {
    .command-bar {
        grid-template-columns: 1fr;
    }

    .tabs,
    .toolbar {
        justify-content: flex-start;
        overflow-x: auto;
    }

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

    .split-zone,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .inspector {
        position: static;
    }
}

@media (max-width: 680px) {
    .workspace {
        padding-inline: 10px;
    }

    .workspace-head,
    .board-head,
    .section-head,
    .status-stamp {
        display: block;
    }

    .source-pill {
        margin-top: 14px;
    }

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

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

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

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

    .chip {
        justify-self: start;
    }

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

    .toolbar {
        display: grid;
        grid-template-columns: 1fr 42px;
    }

    .toolbar input,
    .toolbar .primary-button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .inspector dl {
        grid-template-columns: 1fr;
    }
}
