:root {
    --ink: #202c39;
    --paper: #f4f1de;
    --blue: #3d5a80;
    --clay: #e07a5f;
    --leaf: #81b29a;
    --line: rgba(32, 44, 57, 0.16);
    --muted: rgba(32, 44, 57, 0.66);
    --white: #fffdf5;
    --shadow: 0 22px 60px rgba(32, 44, 57, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(61, 90, 128, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(61, 90, 128, 0.06) 1px, transparent 1px),
        var(--paper);
    background-size: 42px 42px;
    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 {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 0;
    min-height: 100vh;
}

.field-view {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 24px;
    color: var(--paper);
    background: var(--ink);
    border-right: 1px solid rgba(244, 241, 222, 0.18);
}

.phone-bar,
.brand-block,
.sample-top,
.section-head,
.query-tools {
    display: flex;
    align-items: center;
}

.phone-bar {
    gap: 12px;
}

.phone-bar strong,
.brand-block h1,
.section-head h2 {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

.phone-bar strong {
    display: block;
    font-size: 22px;
}

.phone-bar span {
    display: block;
    color: rgba(244, 241, 222, 0.68);
    font-size: 12px;
    text-transform: uppercase;
}

.nursery-map {
    position: relative;
    flex: 1;
    min-height: 380px;
    margin: 28px 0;
    overflow: hidden;
    border: 1px solid rgba(244, 241, 222, 0.22);
    border-radius: 8px;
    background:
        linear-gradient(140deg, rgba(129, 178, 154, 0.35), transparent 42%),
        linear-gradient(20deg, rgba(224, 122, 95, 0.18), transparent 46%),
        #263545;
}

.map-grid {
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(244, 241, 222, 0.18);
    background:
        linear-gradient(90deg, rgba(244, 241, 222, 0.12) 1px, transparent 1px),
        linear-gradient(0deg, rgba(244, 241, 222, 0.12) 1px, transparent 1px);
    background-size: 44px 44px;
}

.map-point {
    position: absolute;
    width: 52px;
    min-height: 32px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(244, 241, 222, 0.38);
    border-radius: 999px;
    color: var(--paper);
    background: var(--clay);
    box-shadow: 0 0 0 8px rgba(224, 122, 95, 0.16);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.map-point:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 0 12px rgba(224, 122, 95, 0.22);
}

.map-point span {
    display: block;
    overflow: hidden;
    padding: 4px;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
}

.field-ticket {
    border-top: 1px solid rgba(244, 241, 222, 0.18);
    padding-top: 18px;
}

.field-ticket span,
.field-ticket small {
    display: block;
    color: rgba(244, 241, 222, 0.68);
}

.field-ticket strong {
    display: block;
    margin: 8px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 6vw, 36px);
    line-height: 1.05;
}

.primary-action,
.sample-actions button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    font-weight: 800;
}

.primary-action {
    margin-top: 18px;
    color: var(--ink);
    background: var(--paper);
}

.dispatch-console {
    min-width: 0;
    padding: 24px clamp(18px, 4vw, 48px) 42px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 22px;
}

.brand-block {
    gap: 14px;
    min-width: 250px;
}

.brand-block h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 0.95;
}

.brand-block p,
.section-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.tabs {
    display: flex;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 245, 0.64);
}

.tab {
    flex: 0 0 auto;
    min-height: 34px;
    border: 0;
    border-radius: 5px;
    padding: 0 12px;
    color: var(--muted);
    background: transparent;
}

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

.metric-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.metric {
    min-width: 0;
    padding: 16px;
    background: rgba(255, 253, 245, 0.82);
}

.metric span,
.metric small,
.sample-card p,
.action-row p,
.team-member span,
.team-member p,
.workflow-step p,
.evidence-row em,
.route-stop em {
    color: var(--muted);
}

.metric strong {
    display: block;
    margin: 8px 0 3px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1;
}

.screen {
    display: none;
    padding-top: 28px;
}

.screen.active {
    display: block;
    animation: lift 220ms ease both;
}

.section-head {
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.section-head h2 {
    margin: 0;
    font-size: clamp(24px, 3vw, 38px);
}

.query-tools {
    gap: 8px;
}

.query-tools input,
.query-tools select {
    width: min(220px, 40vw);
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--ink);
    background: var(--white);
}

.route-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 22px;
    align-items: start;
}

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

.sample-card,
.workflow-step,
.team-member,
.action-row,
.locker-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 245, 0.88);
}

.sample-card {
    min-width: 0;
    padding: 16px;
    box-shadow: 0 12px 34px rgba(32, 44, 57, 0.08);
    transition: transform 160ms ease, border-color 160ms ease;
}

.sample-card:hover {
    transform: translateY(-2px);
    border-color: rgba(224, 122, 95, 0.46);
}

.sample-card[data-status="hold"],
.sample-card[data-status="risk"] {
    border-color: rgba(224, 122, 95, 0.72);
}

.sample-top {
    justify-content: space-between;
    gap: 10px;
}

.sample-top strong {
    font-size: 12px;
    color: var(--blue);
}

.sample-top span,
.sample-meta span,
.live-stamp {
    border-radius: 999px;
    padding: 5px 8px;
    color: var(--paper);
    background: var(--blue);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.sample-card h3 {
    margin: 12px 0 8px;
    font-size: 20px;
    line-height: 1.16;
}

.sample-card p {
    min-height: 44px;
    margin: 0;
    line-height: 1.45;
}

.sample-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0;
}

.sample-meta span {
    color: var(--ink);
    background: rgba(61, 90, 128, 0.12);
}

.sample-meta .risk {
    color: var(--paper);
    background: var(--clay);
}

.sample-meta .ok {
    background: rgba(129, 178, 154, 0.34);
}

.progress,
.load {
    position: relative;
    overflow: hidden;
    height: 18px;
    border-radius: 999px;
    background: rgba(32, 44, 57, 0.1);
}

.progress span,
.load span {
    display: block;
    height: 100%;
    min-width: 4px;
    color: var(--paper);
    background: linear-gradient(90deg, var(--leaf), var(--clay));
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: right;
    padding-right: 6px;
    transition: width 220ms ease;
}

.sample-actions {
    display: grid;
    grid-template-columns: 1fr 104px;
    gap: 8px;
    margin-top: 14px;
}

.sample-actions button {
    color: var(--paper);
    background: var(--ink);
}

.sample-actions button[data-action="hold"] {
    color: var(--ink);
    background: rgba(224, 122, 95, 0.28);
}

.locker-panel {
    position: sticky;
    top: 22px;
    padding: 18px;
}

.route-line {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
}

.route-stop {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.route-stop span {
    width: 14px;
    height: 14px;
    border: 3px solid var(--paper);
    border-radius: 50%;
    background: var(--clay);
    box-shadow: 0 0 0 1px var(--line);
}

.route-stop strong,
.evidence-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.evidence-stack h3 {
    margin: 0 0 12px;
    font-family: Georgia, "Times New Roman", serif;
}

.evidence-row {
    display: grid;
    gap: 3px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.evidence-row span {
    color: var(--clay);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.timeline {
    display: grid;
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
}

.action-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 18px;
    padding: 16px;
    border: 0;
    border-radius: 0;
}

.action-row time {
    color: var(--clay);
    font-weight: 900;
}

.action-row strong {
    display: block;
    overflow-wrap: anywhere;
}

.action-row p {
    margin: 4px 0 0;
}

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

.workflow-step,
.team-member {
    padding: 18px;
}

.workflow-step span {
    color: var(--clay);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
}

.workflow-step strong,
.team-member strong {
    display: block;
    margin-top: 8px;
    font-size: 19px;
}

.workflow-step p,
.team-member p {
    min-height: 44px;
    margin: 10px 0;
    line-height: 1.42;
}

.workflow-step em,
.team-member em {
    color: var(--blue);
    font-style: normal;
    font-weight: 900;
}

.team-member .load {
    height: 10px;
    margin: 12px 0;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 26px;
    border: 1px dashed rgba(32, 44, 57, 0.28);
    border-radius: 8px;
    background: rgba(255, 253, 245, 0.74);
}

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

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

    .field-view {
        position: relative;
        min-height: auto;
    }

    .nursery-map {
        min-height: 260px;
    }

    .route-board {
        grid-template-columns: 1fr;
    }

    .locker-panel {
        position: static;
    }
}

@media (max-width: 760px) {
    .dispatch-console {
        padding: 18px 14px 32px;
    }

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

    .tabs {
        width: 100%;
    }

    .metric-row,
    .queue-list,
    .workflow-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }

    .query-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .query-tools input,
    .query-tools select {
        width: 100%;
    }

    .sample-actions {
        grid-template-columns: 1fr;
    }

    .action-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}
