:root {
    --ink: #0d1b2a;
    --panel: #12263a;
    --paper: #f5ebe0;
    --paper-2: #fffaf3;
    --steel: #778da9;
    --steel-dark: #49657f;
    --signal: #e0a458;
    --danger: #c94f4f;
    --green: #4f8f73;
    --line: rgba(13, 27, 42, .16);
    --shadow: 0 18px 42px rgba(13, 27, 42, .18);
}

* {
    box-sizing: border-box;
}

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

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

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 18px;
    color: var(--paper);
    background:
        linear-gradient(180deg, rgba(224, 164, 88, .14), transparent 34%),
        var(--ink);
    border-right: 6px solid var(--signal);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--paper);
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 900;
    line-height: .9;
    letter-spacing: 0;
}

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

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

.nav-item,
.icon-button,
.primary-action,
.segmented button {
    min-height: 42px;
    border: 1px solid rgba(245, 235, 224, .22);
    border-radius: 6px;
    color: var(--paper);
    background: rgba(245, 235, 224, .08);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25);
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.nav-item {
    width: 100%;
    padding: 0 12px;
    text-align: left;
}

.nav-item:hover,
.nav-item.is-active,
.icon-button:hover,
.segmented button:hover {
    transform: translateY(-1px);
    border-color: rgba(224, 164, 88, .8);
    background: rgba(224, 164, 88, .18);
}

.rail-footer {
    margin-top: auto;
    display: grid;
    gap: 6px;
    padding-top: 18px;
    border-top: 1px solid rgba(245, 235, 224, .2);
    font-size: 13px;
}

.mono {
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
    letter-spacing: 0;
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 0 16px;
    border-bottom: 3px solid var(--ink);
}

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

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

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

h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.05;
    text-transform: uppercase;
}

.top-actions {
    min-width: max-content;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 2px solid var(--ink);
    background: var(--paper-2);
    box-shadow: var(--shadow);
}

.sync-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(79, 143, 115, .18);
}

.sync-dot.is-hot {
    background: var(--signal);
    box-shadow: 0 0 0 4px rgba(224, 164, 88, .22);
}

.icon-button {
    width: 42px;
    padding: 0;
    color: var(--ink);
    background: var(--signal);
    border-color: var(--ink);
}

.metrics-spine {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin: 18px 0;
    border: 3px solid var(--ink);
    background: var(--paper-2);
}

.metrics-spine div {
    min-width: 0;
    padding: 14px;
    border-right: 1px solid var(--line);
}

.metrics-spine div:last-child {
    border-right: 0;
}

.metrics-spine span {
    display: block;
    color: var(--steel-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metrics-spine strong {
    display: block;
    margin-top: 4px;
    font-size: 34px;
    line-height: .95;
}

.screen {
    display: none;
    animation: screenIn .22s ease both;
}

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

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

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin: 0 0 14px;
}

.search-box {
    width: min(310px, 100%);
    display: grid;
    gap: 5px;
    color: var(--steel-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.search-box input,
.quick-create input,
.quick-create select {
    width: 100%;
    min-height: 42px;
    border: 2px solid var(--ink);
    border-radius: 4px;
    padding: 0 10px;
    color: var(--ink);
    background: var(--paper-2);
    outline: none;
}

.search-box input:focus,
.quick-create input:focus,
.quick-create select:focus {
    border-color: var(--signal);
}

.control-grid {
    display: grid;
    grid-template-columns: 288px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.quick-create,
.board-panel,
.record-sheet,
.event-lane,
.calendar-board,
.report-grid {
    border: 3px solid var(--ink);
    background: rgba(255, 250, 243, .94);
    box-shadow: var(--shadow);
}

.quick-create {
    padding: 14px;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--steel-dark);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.quick-create form {
    display: grid;
    gap: 11px;
}

.quick-create label {
    display: grid;
    gap: 5px;
    color: var(--steel-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.primary-action {
    padding: 0 14px;
    color: var(--ink);
    background: var(--signal);
    border-color: var(--ink);
    font-weight: 900;
    text-transform: uppercase;
}

.board-panel {
    min-width: 0;
    padding: 14px;
}

.kanban {
    display: grid;
    grid-template-columns: repeat(4, minmax(190px, 1fr));
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.lane {
    min-height: 440px;
    padding: 10px;
    background:
        linear-gradient(90deg, rgba(13, 27, 42, .05) 1px, transparent 1px),
        linear-gradient(0deg, rgba(13, 27, 42, .05) 1px, transparent 1px),
        rgba(119, 141, 169, .18);
    background-size: 18px 18px;
    border: 1px solid rgba(13, 27, 42, .24);
}

.lane header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(13, 27, 42, .18);
}

.lane header strong,
.lane header span {
    display: block;
}

.lane header strong {
    text-transform: uppercase;
}

.lane header span {
    margin-top: 2px;
    color: var(--steel-dark);
    font-size: 12px;
}

.lane header b {
    width: 42px;
    height: 30px;
    display: grid;
    place-items: center;
    color: var(--paper);
    background: var(--ink);
    border-radius: 4px;
}

.case-card {
    width: 100%;
    margin-bottom: 9px;
    padding: 11px;
    color: var(--ink);
    background: var(--paper-2);
    border: 2px solid rgba(13, 27, 42, .82);
    border-radius: 6px;
    box-shadow: inset 0 -4px 0 rgba(13, 27, 42, .1);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.case-card:hover,
.case-card.is-selected {
    transform: translateY(-2px);
    border-color: var(--signal);
    box-shadow: inset 0 -4px 0 rgba(224, 164, 88, .32), 0 10px 22px rgba(13, 27, 42, .14);
}

.card-topline,
.card-gauges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.case-card h3 {
    margin: 9px 0 6px;
    font-size: 15px;
    line-height: 1.15;
}

.case-card p {
    margin: 0 0 10px;
    color: var(--steel-dark);
    font-size: 13px;
    line-height: 1.35;
}

.card-gauges span {
    min-width: 0;
    padding: 5px 7px;
    color: var(--paper);
    background: var(--steel-dark);
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.priority {
    padding: 4px 7px;
    border-radius: 999px;
    color: var(--ink);
    background: var(--steel);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.priority-high {
    background: var(--signal);
}

.priority-low {
    background: #b8c1a5;
}

.empty-lane {
    min-height: 82px;
    display: grid;
    place-items: center;
    color: var(--steel-dark);
    border: 1px dashed rgba(13, 27, 42, .35);
    font-size: 13px;
}

.segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.segmented button {
    padding: 0 12px;
    color: var(--ink);
    background: var(--paper-2);
    border-color: var(--ink);
    font-weight: 800;
}

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

.record-sheet,
.event-lane {
    padding: 16px;
}

.record-header {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.record-header strong {
    font-size: 28px;
    line-height: 1.05;
    text-transform: uppercase;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    border-top: 2px solid var(--ink);
    border-left: 2px solid var(--ink);
}

.spec-grid div {
    min-width: 0;
    padding: 12px;
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
}

.spec-grid dt {
    color: var(--steel-dark);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.spec-grid dd {
    margin: 4px 0 0;
    font-weight: 800;
}

.record-note {
    margin: 16px 0 0;
    padding: 14px;
    color: var(--paper);
    background: var(--ink);
    border-left: 8px solid var(--signal);
    line-height: 1.45;
}

.event-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
    padding: 11px 0;
    border-top: 1px solid var(--line);
}

.event-row time {
    color: var(--signal);
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-weight: 900;
}

.event-row p {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--steel-dark);
    font-size: 13px;
    font-weight: 800;
}

.legend i {
    width: 18px;
    height: 10px;
    background: var(--signal);
    border: 1px solid var(--ink);
}

.calendar-board {
    padding: 14px;
    overflow-x: auto;
}

.time-scale {
    min-width: 780px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    margin-left: 190px;
    color: var(--steel-dark);
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

.resource-row {
    min-width: 970px;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    border-top: 1px solid var(--line);
}

.resource-name {
    font-weight: 900;
}

.resource-name span {
    display: block;
    margin-top: 3px;
    color: var(--steel-dark);
    font-size: 12px;
}

.slot-line {
    position: relative;
    height: 48px;
    background:
        repeating-linear-gradient(90deg, rgba(13, 27, 42, .1) 0 1px, transparent 1px 16.66%),
        rgba(119, 141, 169, .14);
    border: 1px solid rgba(13, 27, 42, .24);
}

.slot-block {
    position: absolute;
    top: 6px;
    height: 34px;
    min-width: 148px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    color: var(--ink);
    background: #d9e0e9;
    border: 2px solid var(--ink);
    border-radius: 4px;
    overflow: hidden;
    text-align: left;
}

.slot-block.is-critical {
    background: var(--signal);
}

.slot-block strong,
.slot-block span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-grid {
    display: grid;
    gap: 0;
    overflow: hidden;
}

.report-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 160px 140px 170px;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    transition: background .16s ease;
}

.report-row:hover,
.report-row.is-selected {
    background: rgba(224, 164, 88, .16);
}

.report-row strong,
.report-row b {
    display: block;
    overflow-wrap: anywhere;
}

.report-row p,
.report-row span {
    margin: 2px 0 0;
    color: var(--steel-dark);
    font-size: 12px;
}

.act-ready {
    color: var(--green);
}

.act-pending {
    color: var(--signal);
}

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

    .rail {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        border-right: 0;
        border-bottom: 5px solid var(--signal);
        overflow-x: auto;
    }

    .rail-nav {
        display: flex;
        min-width: max-content;
    }

    .rail-footer {
        display: none;
    }

    .control-grid,
    .record-layout {
        grid-template-columns: 1fr;
    }

    .quick-create {
        order: 2;
    }

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

@media (max-width: 720px) {
    .workspace {
        padding: 14px;
    }

    .topbar,
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .top-actions {
        width: 100%;
        min-width: 0;
        justify-content: space-between;
    }

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

    .metrics-spine div:nth-child(2) {
        border-right: 0;
    }

    .metrics-spine div:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .kanban {
        grid-template-columns: minmax(235px, 1fr);
        overflow: visible;
    }

    .lane {
        min-height: 180px;
    }

    .spec-grid,
    .report-row {
        grid-template-columns: 1fr;
    }

    .report-row {
        gap: 8px;
    }

    h1 {
        font-size: 32px;
    }
}

