:root {
    --ink: #2d3142;
    --paper: #f7fff7;
    --accent: #ff9f1c;
    --mint: #2ec4b6;
    --line: rgba(45, 49, 66, 0.16);
    --muted: rgba(45, 49, 66, 0.66);
    --danger: #b83227;
    --shadow: 0 18px 50px rgba(45, 49, 66, 0.12);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(45, 49, 66, 0.055) 1px, transparent 1px),
        linear-gradient(0deg, rgba(45, 49, 66, 0.045) 1px, transparent 1px),
        var(--paper);
    background-size: 44px 44px;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
}

.command-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 72px;
    display: grid;
    grid-template-columns: minmax(170px, 240px) minmax(320px, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 12px 24px;
    background: var(--ink);
    color: var(--paper);
    border-bottom: 4px solid var(--accent);
}

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

.brand img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
}

.brand span {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    line-height: 1;
    white-space: nowrap;
}

.screen-tabs {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
    overflow-x: auto;
}

.tab-button,
.icon-button,
.primary-button,
.secondary-button {
    border: 0;
    min-height: 40px;
    border-radius: 7px;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.tab-button {
    padding: 0 14px;
    color: rgba(247, 255, 247, 0.74);
    background: transparent;
    white-space: nowrap;
}

.tab-button:hover,
.tab-button.is-active {
    color: var(--paper);
    background: rgba(247, 255, 247, 0.12);
}

.command-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-button {
    width: 42px;
    color: var(--paper);
    background: rgba(247, 255, 247, 0.1);
    font-size: 1.35rem;
}

.primary-button {
    padding: 0 18px;
    color: #151826;
    background: var(--accent);
    font-weight: 800;
}

.secondary-button {
    padding: 0 16px;
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--line);
    font-weight: 800;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.workspace {
    padding: 22px 24px 34px;
}

.screen {
    display: none;
}

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

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

.board-head,
.section-head,
.stream-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
    line-height: 1.05;
}

h1 {
    font-size: clamp(2rem, 4vw, 4rem);
}

h2 {
    font-size: 1.7rem;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    gap: 8px;
    min-width: min(720px, 100%);
}

.metric {
    min-height: 70px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric span,
.metric strong {
    display: block;
}

.metric span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.metric strong {
    margin-top: 5px;
    font-size: 1.45rem;
}

.public-alerts {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 12px;
}

.alert-pill {
    min-width: 250px;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
}

.alert-pill span,
.alert-pill strong,
.alert-pill em {
    display: block;
}

.alert-pill span,
.alert-pill em {
    color: var(--muted);
    font-size: 0.74rem;
    font-style: normal;
}

.alert-pill strong {
    margin: 3px 0;
    font-size: 0.93rem;
}

.filters {
    display: grid;
    grid-template-columns: 150px 160px 210px minmax(220px, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

label {
    display: grid;
    gap: 6px;
}

label span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
}

select,
input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    outline: none;
}

select:focus,
input:focus {
    border-color: var(--mint);
    box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.16);
}

.registry-layout,
.finance-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
    gap: 14px;
    align-items: start;
}

.dense-board,
.inspector,
.request-panel,
.event-stream,
.finance-total {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.dense-board {
    overflow: hidden;
}

.stage-ruler {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 42px;
    background: rgba(45, 49, 66, 0.06);
    border-bottom: 1px solid var(--line);
}

.stage-ruler span {
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.lane-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(210px, 1fr));
    min-height: 520px;
    overflow-x: auto;
}

.stage-column {
    min-width: 210px;
    border-right: 1px solid var(--line);
}

.stage-column:last-child {
    border-right: 0;
}

.stage-column header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 46px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    font-weight: 900;
}

.stage-column header strong {
    min-width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--mint);
    color: #09211f;
    font-size: 0.86rem;
}

.asset-list {
    display: grid;
    gap: 7px;
    padding: 8px;
}

.asset-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "main status"
        "progress meta";
    gap: 8px 10px;
    width: 100%;
    min-height: 102px;
    border: 1px solid rgba(45, 49, 66, 0.14);
    border-radius: 8px;
    padding: 11px;
    background: rgba(247, 255, 247, 0.78);
    color: var(--ink);
    text-align: left;
}

.asset-row:hover,
.asset-row.is-selected {
    border-color: var(--ink);
    transform: translateY(-1px);
}

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

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

.row-main strong {
    line-height: 1.18;
}

.row-main small {
    margin-top: 5px;
    color: var(--muted);
}

.row-status {
    grid-area: status;
    align-self: start;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 900;
    white-space: nowrap;
}

.progress-cell {
    grid-area: progress;
    height: 8px;
    background: rgba(45, 49, 66, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

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

.row-meta {
    grid-area: meta;
    align-self: center;
    font-weight: 900;
}

.tone-ok,
.tone-low {
    background: rgba(46, 196, 182, 0.18);
    color: #0c5d55;
}

.tone-warn,
.tone-critical,
.tone-high {
    background: rgba(255, 159, 28, 0.2);
    color: #7b4300;
}

.tone-neutral,
.tone-medium {
    background: rgba(45, 49, 66, 0.1);
    color: var(--ink);
}

.empty {
    margin: 16px 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.inspector {
    position: sticky;
    top: 94px;
    padding: 18px;
}

.muted {
    color: var(--muted);
}

.dossier-status,
.gate-box,
.mini-note {
    margin-top: 14px;
    border-radius: 8px;
    padding: 12px;
}

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

.dossier-grid div {
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}

dt {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

dd {
    margin: 4px 0 0;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.gate-box {
    background: var(--ink);
    color: var(--paper);
}

.gate-box span,
.gate-box strong {
    display: block;
}

.gate-box span {
    color: rgba(247, 255, 247, 0.72);
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.gate-box strong {
    margin-top: 4px;
}

.inspector-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.mini-note {
    background: rgba(45, 49, 66, 0.06);
    color: var(--muted);
    font-size: 0.86rem;
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
    gap: 14px;
}

.request-panel,
.event-stream,
.finance-total {
    padding: 18px;
}

form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

form .wide,
form button {
    grid-column: 1 / -1;
}

.event-stream {
    min-height: 520px;
}

#eventStream {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

.stream-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.stream-item time,
.stream-item strong,
.stream-item p {
    display: block;
}

.stream-item time {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
}

.stream-item strong {
    margin-top: 5px;
}

.stream-item p {
    margin: 6px 0 0;
    color: var(--muted);
}

.document-table,
.finance-table {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.table-head,
.table-row {
    display: grid;
    grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 1fr) minmax(140px, 0.7fr) minmax(130px, 0.55fr);
    gap: 14px;
    align-items: center;
    padding: 13px 16px;
}

.finance-head,
.finance-row {
    grid-template-columns: minmax(240px, 1.4fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(110px, 0.5fr);
}

.table-head {
    color: var(--muted);
    background: rgba(45, 49, 66, 0.06);
    font-size: 0.77rem;
    font-weight: 900;
    text-transform: uppercase;
}

.table-row {
    border-top: 1px solid var(--line);
}

.table-row strong,
.table-row small,
.table-row em {
    display: block;
}

.table-row small {
    margin-top: 4px;
    color: var(--muted);
    font-weight: 600;
}

.table-row em {
    font-style: normal;
    font-weight: 900;
}

.finance-total {
    position: sticky;
    top: 94px;
}

.finance-total strong {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 4rem;
    line-height: 1;
}

.finance-total span {
    color: var(--muted);
}

.finance-total dl {
    display: grid;
    gap: 12px;
    margin: 22px 0 0;
}

@media (max-width: 1100px) {
    .command-bar,
    .board-head,
    .registry-layout,
    .finance-layout,
    .form-layout {
        grid-template-columns: 1fr;
    }

    .command-bar {
        align-items: stretch;
    }

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

    .inspector,
    .finance-total {
        position: static;
    }
}

@media (max-width: 680px) {
    .workspace {
        padding: 16px 12px 26px;
    }

    .command-bar {
        padding: 12px;
    }

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

    .metric-strip,
    .filters,
    form,
    .dossier-grid {
        grid-template-columns: 1fr;
    }

    .lane-board {
        grid-template-columns: repeat(4, 230px);
    }

    .table-head {
        display: none;
    }

    .table-row,
    .finance-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    h1 {
        font-size: 2.25rem;
    }
}
