:root {
    --ink: #242423;
    --paper: #f7f7f2;
    --blue: #3a86ff;
    --amber: #ffbe0b;
    --line: rgba(36, 36, 35, 0.16);
    --muted: rgba(36, 36, 35, 0.62);
    --danger: #d9480f;
    --ok: #1b8a5a;
    --panel: #ffffff;
    --shadow: 0 18px 50px rgba(36, 36, 35, 0.10);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        repeating-linear-gradient(90deg, rgba(36, 36, 35, 0.045) 0 2px, transparent 2px 19px),
        linear-gradient(135deg, #f7f7f2 0%, #ecece5 48%, #f7f7f2 100%);
    font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 252px 1fr;
}

.rail {
    min-height: 100vh;
    padding: 22px 18px;
    color: var(--paper);
    background: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
}

.brand {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: center;
}

.brand img {
    width: 44px;
    height: 44px;
}

.brand strong,
.brand span,
.rail-status strong,
.rail-status span {
    display: block;
}

.brand strong {
    font-size: 20px;
    line-height: 1;
}

.brand span,
.rail-status span {
    color: rgba(247, 247, 242, 0.58);
    font-size: 12px;
    text-transform: uppercase;
}

.tabs {
    display: grid;
    gap: 8px;
}

.tab {
    border: 1px solid rgba(247, 247, 242, 0.18);
    border-radius: 6px;
    color: var(--paper);
    background: transparent;
    min-height: 42px;
    padding: 0 12px;
    text-align: left;
    text-transform: uppercase;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
    border-color: var(--amber);
    background: rgba(255, 190, 11, 0.12);
    transform: translateX(2px);
}

.scanner-strip {
    height: 124px;
    background: repeating-linear-gradient(90deg, var(--paper) 0 3px, transparent 3px 9px, var(--paper) 9px 11px, transparent 11px 18px);
    opacity: 0.86;
    border-radius: 4px;
}

.rail-status {
    margin-top: auto;
    border-top: 1px solid rgba(247, 247, 242, 0.18);
    padding-top: 16px;
    overflow-wrap: anywhere;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(280px, 0.82fr) minmax(390px, 1.36fr) minmax(260px, 0.72fr);
    min-height: 100vh;
}

.queue-panel,
.record-panel,
.action-panel {
    padding: 24px;
    min-width: 0;
}

.queue-panel,
.action-panel {
    border-right: 1px solid var(--line);
    background: rgba(247, 247, 242, 0.78);
}

.action-panel {
    border-right: 0;
    border-left: 1px solid var(--line);
}

.record-panel {
    background: rgba(255, 255, 255, 0.52);
}

.panel-head,
.record-top,
.progress-block > div,
.public-row,
.docs li,
.task,
.zone-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--blue);
    font-size: 12px;
    line-height: 1;
    text-transform: uppercase;
    font-weight: 800;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(27px, 3vw, 44px);
    line-height: 0.95;
}

h2 {
    font-size: clamp(24px, 2.2vw, 36px);
    line-height: 1.02;
    margin-bottom: 14px;
}

h3 {
    font-size: 16px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.live-dot,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.live-dot {
    color: var(--ink);
    background: var(--amber);
}

.badge {
    color: var(--ink);
    background: rgba(36, 36, 35, 0.09);
}

.badge-attention,
.badge-risk {
    color: #fff;
    background: var(--danger);
}

.badge-ready,
.badge-done {
    color: #fff;
    background: var(--ok);
}

.badge-checklist,
.badge-timing,
.badge-review {
    color: #fff;
    background: var(--blue);
}

.search-line {
    display: grid;
    grid-template-columns: 1fr 118px;
    gap: 8px;
    margin: 20px 0 14px;
}

.search-line input,
.search-line select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    padding: 0 10px;
}

.metric-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.metric {
    min-height: 68px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.54);
}

.metric span,
.record-grid span,
.progress-block span,
.public-row small,
.task small,
.case-row span,
.case-row small {
    color: var(--muted);
}

.metric strong {
    display: block;
    margin-top: 7px;
    font-size: 25px;
    line-height: 1;
}

.case-list {
    display: grid;
    gap: 8px;
}

.case-row {
    position: relative;
    display: grid;
    gap: 5px;
    width: 100%;
    min-height: 112px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    text-align: left;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.68);
    overflow: hidden;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.case-row:hover,
.case-row.is-selected {
    border-color: var(--blue);
    background: #fff;
    transform: translateY(-1px);
}

.case-row strong {
    font-size: 17px;
    line-height: 1.14;
}

.case-code {
    font-weight: 800;
    color: var(--blue) !important;
}

.case-row i {
    display: block;
    height: 4px;
    border-radius: 99px;
    background: var(--amber);
}

.screen {
    display: none;
}

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

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

.active-record,
.import-box,
.section-title {
    max-width: 920px;
}

.record-top {
    align-items: flex-start;
    margin-bottom: 18px;
}

.record-top h2 {
    margin-bottom: 0;
    max-width: 660px;
}

.record-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

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

.record-grid > div {
    min-height: 78px;
    padding: 12px;
    border-left: 4px solid var(--ink);
    background: rgba(247, 247, 242, 0.84);
}

.record-grid strong,
.record-grid span {
    display: block;
}

.record-grid strong {
    margin-top: 8px;
    font-size: 18px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.progress-block {
    margin: 22px 0;
}

.progress-block i,
.public-progress i {
    display: block;
    height: 10px;
    border-radius: 99px;
    background: rgba(36, 36, 35, 0.12);
    overflow: hidden;
}

.progress-block b,
.public-progress b {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--amber));
}

.workflow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 24px;
}

.flow-step {
    min-height: 72px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.64);
}

.flow-step span {
    display: block;
    width: 100%;
    height: 18px;
    margin-bottom: 10px;
    background: repeating-linear-gradient(90deg, rgba(36, 36, 35, 0.28) 0 3px, transparent 3px 7px);
}

.flow-step.is-done {
    border-color: var(--blue);
}

.flow-step.is-done span {
    background: repeating-linear-gradient(90deg, var(--blue) 0 4px, transparent 4px 8px);
}

.split-lists {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

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

.docs li,
.task {
    min-height: 58px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.docs strong,
.task strong {
    line-height: 1.15;
}

.doc-type {
    min-width: 72px;
    color: var(--blue);
    font-weight: 800;
    text-transform: uppercase;
}

.task {
    align-items: flex-start;
}

.task > span {
    flex: 0 0 12px;
    height: 42px;
    background: var(--blue);
    border-radius: 2px;
}

.task-risk > span {
    background: var(--danger);
}

.task-done > span {
    background: var(--ok);
}

.next-action {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.next-action h2 {
    font-size: 25px;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.next-action p {
    color: var(--muted);
    line-height: 1.5;
}

.action-stack {
    display: grid;
    gap: 8px;
}

.primary-action,
.secondary-action {
    width: 100%;
    min-height: 44px;
    border-radius: 6px;
    padding: 0 14px;
    text-align: left;
    font-weight: 800;
    text-transform: uppercase;
}

.primary-action {
    border: 1px solid var(--ink);
    color: #fff;
    background: var(--ink);
}

.secondary-action {
    border: 1px solid var(--line);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.56);
}

.barcode-card {
    margin: 18px 0;
    padding: 14px;
    border-radius: 6px;
    color: var(--paper);
    background: var(--ink);
}

.barcode-card span {
    display: block;
    margin-bottom: 12px;
    font-weight: 800;
}

.barcode-card div {
    height: 74px;
    background: repeating-linear-gradient(90deg, var(--paper) 0 2px, transparent 2px 8px, var(--amber) 8px 10px, transparent 10px 15px);
}

.notes-feed {
    display: grid;
    gap: 10px;
}

.note {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.note strong {
    display: block;
    margin-bottom: 5px;
}

.note p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.analytics-board {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
    gap: 24px;
    min-height: 420px;
}

.bars {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: 12px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.62);
}

.bar {
    min-height: 300px;
    display: grid;
    grid-template-rows: 1fr auto auto;
    gap: 8px;
}

.bar i {
    align-self: end;
    display: block;
    border-radius: 5px 5px 0 0;
    background: repeating-linear-gradient(0deg, var(--blue) 0 8px, #236bd5 8px 12px);
}

.bar strong {
    font-size: 26px;
}

.zone-list {
    display: grid;
    align-content: start;
    gap: 8px;
}

.zone-list div {
    min-height: 58px;
    padding: 12px;
    border-left: 4px solid var(--amber);
    background: rgba(255, 255, 255, 0.62);
}

.import-box {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: var(--shadow);
}

.import-box p {
    max-width: 620px;
    color: var(--muted);
    line-height: 1.65;
}

pre {
    min-height: 90px;
    overflow: auto;
    margin: 18px 0 0;
    padding: 14px;
    border-radius: 6px;
    color: var(--paper);
    background: var(--ink);
    white-space: pre-wrap;
}

.public-status {
    display: grid;
    gap: 10px;
}

.public-row {
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.66);
}

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

.public-row strong {
    line-height: 1.15;
}

.public-progress {
    min-width: 140px;
}

.public-progress span {
    margin-top: 5px;
    text-align: right;
    font-weight: 800;
}

.empty,
.error {
    padding: 18px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.72);
}

.error {
    color: #fff;
    background: var(--danger);
}

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

    .rail {
        position: static;
        min-height: auto;
        display: grid;
        grid-template-columns: minmax(190px, 1fr) 2fr;
        align-items: center;
    }

    .scanner-strip,
    .rail-status {
        display: none;
    }

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

    .tab {
        text-align: center;
        padding: 0 8px;
    }

    .workspace {
        grid-template-columns: minmax(280px, 0.82fr) minmax(390px, 1.18fr);
    }

    .action-panel {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid var(--line);
        display: grid;
        grid-template-columns: minmax(260px, 0.8fr) minmax(200px, 0.5fr) minmax(280px, 1fr);
        gap: 18px;
    }

    .barcode-card {
        margin: 0;
    }
}

@media (max-width: 820px) {
    .rail {
        grid-template-columns: 1fr;
    }

    .tabs,
    .workspace,
    .record-grid,
    .split-lists,
    .analytics-board,
    .action-panel {
        grid-template-columns: 1fr;
    }

    .queue-panel,
    .record-panel,
    .action-panel {
        padding: 18px;
        border-left: 0;
        border-right: 0;
    }

    .search-line {
        grid-template-columns: 1fr;
    }

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

    .record-top,
    .public-row,
    .docs li,
    .task {
        align-items: flex-start;
        flex-direction: column;
    }

    .record-status {
        justify-content: flex-start;
    }

    .public-progress {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 460px) {
    .metric-row,
    .bars {
        grid-template-columns: 1fr;
    }

    .bar {
        min-height: 150px;
    }
}

