:root {
    --ink: #242423;
    --paper: #f7f7f2;
    --blue: #3a86ff;
    --amber: #ffbe0b;
    --line: rgba(36, 36, 35, 0.16);
    --muted: rgba(36, 36, 35, 0.62);
    --soft: #ecece5;
    --danger: #ef476f;
    --ok: #2a9d8f;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
    color: var(--ink);
    font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        repeating-linear-gradient(90deg, rgba(36, 36, 35, 0.045) 0 2px, transparent 2px 18px),
        linear-gradient(180deg, #f7f7f2 0%, #e9e9df 100%);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.scan-shell {
    display: grid;
    grid-template-columns: minmax(250px, 19vw) minmax(0, 1fr) minmax(280px, 22vw);
    min-height: 100vh;
}

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

.queue-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    color: var(--paper);
    background: var(--ink);
    border-right: 6px solid var(--amber);
}

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

.brand img {
    flex: 0 0 auto;
}

.brand strong {
    display: block;
    font-size: 22px;
    line-height: 1;
    letter-spacing: 0;
}

.brand small,
.eyebrow,
.tab,
.search-box span,
.panel-title span,
.metric span {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.brand small {
    color: rgba(247, 247, 242, 0.68);
    font-size: 11px;
}

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

.tab {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    color: rgba(247, 247, 242, 0.74);
    text-align: left;
    background: transparent;
    border: 1px solid rgba(247, 247, 242, 0.18);
    border-radius: 6px;
}

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

.search-box {
    display: grid;
    gap: 7px;
}

.search-box span {
    color: rgba(247, 247, 242, 0.58);
    font-size: 11px;
}

.search-box input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    color: var(--paper);
    background: rgba(247, 247, 242, 0.08);
    border: 1px solid rgba(247, 247, 242, 0.24);
    border-radius: 6px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--blue);
}

.queue-list {
    display: grid;
    gap: 10px;
    overflow: auto;
    padding-right: 4px;
}

.case-row {
    position: relative;
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 12px;
    color: var(--paper);
    text-align: left;
    background: rgba(247, 247, 242, 0.06);
    border: 1px solid rgba(247, 247, 242, 0.16);
    border-radius: 7px;
}

.case-row::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: repeating-linear-gradient(180deg, var(--blue) 0 9px, transparent 9px 14px);
}

.case-row.is-active {
    border-color: var(--amber);
    background: rgba(255, 190, 11, 0.13);
}

.case-row strong {
    overflow-wrap: anywhere;
}

.case-row small {
    color: rgba(247, 247, 242, 0.66);
    line-height: 1.4;
}

.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    color: var(--ink);
    background: var(--paper);
    font-size: 12px;
    white-space: nowrap;
}

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

.badge.warm {
    background: var(--amber);
}

.badge.stage {
    background: var(--blue);
    color: #fff;
}

.system-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    color: rgba(247, 247, 242, 0.66);
    font-size: 13px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 5px rgba(255, 190, 11, 0.14);
}

.record-panel {
    padding: 22px;
    overflow: auto;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 12px;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(30px, 4.2vw, 58px);
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 8px;
    font-size: 24px;
    line-height: 1.05;
}

h3 {
    margin-bottom: 10px;
    font-size: 17px;
}

p {
    color: var(--muted);
    line-height: 1.65;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
}

.icon-button,
.primary-action {
    min-height: 42px;
    border-radius: 6px;
    border: 1px solid var(--ink);
}

.icon-button {
    width: 42px;
    color: var(--paper);
    background: var(--ink);
    font-size: 20px;
}

.primary-action {
    padding: 0 15px;
    color: var(--paper);
    background: var(--blue);
    border-color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    margin: 18px 0;
    background: var(--line);
    border: 1px solid var(--line);
}

.metric {
    display: grid;
    gap: 6px;
    min-height: 92px;
    padding: 13px;
    background: rgba(247, 247, 242, 0.86);
}

.metric span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.metric strong {
    align-self: end;
    font-size: 26px;
    line-height: 1;
}

.metric.warn strong {
    color: var(--danger);
}

.view {
    display: none;
}

.view.is-visible {
    display: block;
    animation: rise 180ms ease-out;
}

.record-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.75fr);
    gap: 18px;
}

.active-record,
.path-strip,
.import-log,
.public-status,
.analytics-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(247, 247, 242, 0.78);
}

.active-record {
    min-height: 480px;
    padding: 20px;
}

.placeholder {
    display: grid;
    min-height: 300px;
    place-items: center;
    color: var(--muted);
    border: 1px dashed var(--line);
}

.record-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.record-head strong {
    display: block;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1;
    overflow-wrap: anywhere;
}

.barcode {
    height: 48px;
    min-width: 136px;
    background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 7px, var(--ink) 7px 9px, transparent 9px 15px);
    border-bottom: 6px solid var(--amber);
}

.stage-track {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 18px 0;
}

.stage-cell {
    min-height: 70px;
    padding: 10px;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.stage-cell.is-current {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.stage-cell span {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
}

.checklist {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.check-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.path-strip {
    padding: 16px;
}

.path-list {
    display: grid;
    gap: 12px;
}

.path-item {
    display: grid;
    gap: 8px;
}

.path-item .bar {
    height: 9px;
    background: var(--soft);
    border-radius: 999px;
    overflow: hidden;
}

.path-item .bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--amber));
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

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

.analytics-card {
    min-height: 170px;
    padding: 18px;
}

.analytics-card strong {
    display: block;
    font-size: 42px;
    line-height: 1;
}

.analytics-card .scan-bars {
    display: grid;
    grid-template-columns: repeat(18, minmax(3px, 1fr));
    align-items: end;
    gap: 4px;
    height: 58px;
    margin-top: 20px;
}

.scan-bars i {
    display: block;
    min-height: 10px;
    background: var(--ink);
}

.scan-bars i:nth-child(3n) {
    background: var(--blue);
}

.scan-bars i:nth-child(4n) {
    background: var(--amber);
}

.import-log {
    min-height: 260px;
    margin: 0;
    padding: 18px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.65;
}

.public-status {
    display: grid;
    gap: 14px;
    max-width: 620px;
    padding: 22px;
}

.public-status strong {
    font-size: 36px;
    line-height: 1;
}

.progress-ring {
    display: grid;
    width: 132px;
    height: 132px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: conic-gradient(var(--blue) var(--value), var(--soft) 0);
}

.progress-ring span {
    display: grid;
    width: 92px;
    height: 92px;
    place-items: center;
    border-radius: 50%;
    background: var(--ink);
    font-size: 24px;
}

.action-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    background: #ffffff;
    border-left: 1px solid var(--line);
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    border-bottom: 4px solid var(--ink);
}

.panel-title span {
    color: var(--muted);
    font-size: 12px;
}

.deadline-list,
.documents,
.activity ol {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.deadline,
.doc-row,
.activity li {
    list-style: none;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
}

.deadline {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.deadline button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.deadline.is-done {
    opacity: 0.58;
}

.doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.activity {
    min-height: 0;
    overflow: auto;
}

.activity li {
    line-height: 1.45;
}

.activity small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

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

@media (max-width: 1120px) {
    .scan-shell {
        grid-template-columns: 230px minmax(0, 1fr);
    }

    .action-panel {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid var(--line);
    }

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

@media (max-width: 760px) {
    .scan-shell,
    .record-grid,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .queue-panel {
        min-height: auto;
        border-right: 0;
        border-bottom: 6px solid var(--amber);
    }

    .queue-list {
        max-height: 340px;
    }

    .record-panel,
    .action-panel {
        padding: 14px;
    }

    .topbar,
    .section-head,
    .record-head {
        display: grid;
    }

    .top-actions {
        justify-content: start;
    }

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

    .active-record {
        min-height: auto;
    }

    .barcode {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 440px) {
    .metrics,
    .stage-track {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 34px;
    }

    .primary-action {
        width: 100%;
    }
}
