/* eFLD — design §9.3. Marine signage and shipping documents: sea blue, chart-paper white, one buoy orange reserved
   for the primary action. One family (Atkinson Hyperlegible Next), sentence case, flat surfaces, hairline borders. */

/* ---------- tokens ---------- */
:root {
    --sea: #0B3C5D;
    --sea-ink: #0B3C5D;          /* sea used as text */
    --sea-tint: #E2ECF3;
    --ice: #F3F7FA;
    --paper: #FFFFFF;
    --ink: #15202B;
    --muted: #4A5866;
    --line: #C9D3DC;
    --line-strong: #8A99A8;
    --buoy: #FF7A00;
    --buoy-ink: #15202B;
    --buoy-tint: #FFF1E3;
    --kelp: #1E7F4F;
    --kelp-tint: #E3F2EA;
    --flag: #B42318;
    --flag-tint: #FBE9E7;
    --bar: #0B3C5D;
    --bar-ink: #FFFFFF;
    --focus: #FF7A00;
    --border: 1px;
    --radius: 8px;
    --tap: 48px;
    --rail: 96px;
    --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --sea: #8CC4EA; --sea-ink: #8CC4EA; --sea-tint: #142B3C;
        --ice: #0E1620; --paper: #16212C; --ink: #E8EEF3; --muted: #A9B6C2;
        --line: #2A3947; --line-strong: #4A5D70;
        --buoy: #FF8A1F; --buoy-ink: #15202B; --buoy-tint: #3A2410;
        --kelp: #4CC28A; --kelp-tint: #12301F; --flag: #FF8A80; --flag-tint: #3A1715;
        --bar: #10283B; --bar-ink: #FFFFFF;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --sea: #8CC4EA; --sea-ink: #8CC4EA; --sea-tint: #142B3C;
    --ice: #0E1620; --paper: #16212C; --ink: #E8EEF3; --muted: #A9B6C2;
    --line: #2A3947; --line-strong: #4A5D70;
    --buoy: #FF8A1F; --buoy-ink: #15202B; --buoy-tint: #3A2410;
    --kelp: #4CC28A; --kelp-tint: #12301F; --flag: #FF8A80; --flag-tint: #3A1715;
    --bar: #10283B; --bar-ink: #FFFFFF;
    color-scheme: dark;
}

/* Outdoor (§9.6): pure black on white, 25 % larger type, thicker borders. Wins over light and dark. */
:root[data-outdoor="true"] {
    --sea: #002B49; --sea-ink: #000000; --sea-tint: #FFFFFF;
    --ice: #FFFFFF; --paper: #FFFFFF; --ink: #000000; --muted: #1F1F1F;
    --line: #000000; --line-strong: #000000;
    --buoy: #FF7A00; --buoy-ink: #000000; --buoy-tint: #FFFFFF;
    --kelp: #0B5A35; --kelp-tint: #FFFFFF; --flag: #8E1A11; --flag-tint: #FFFFFF;
    --bar: #000000; --bar-ink: #FFFFFF;
    --border: 2px;
    color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }          /* 18 px on phones */
@media (min-width: 840px) { html { font-size: 125%; } }                                        /* 20 px on tablets */
:root[data-outdoor="true"] { font-size: 140.6%; }
@media (min-width: 840px) { :root[data-outdoor="true"] { font-size: 156.25%; } }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--ink);
    background: var(--ice);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
p { margin: 0; }
a { color: var(--sea-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { max-width: 100%; }

.num { font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.icon { flex: none; display: inline-block; vertical-align: middle; }
.spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
    width: 1.1em; height: 1.1em; flex: none;
    border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ---------- boot and error ---------- */
.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--ice); }
.boot-mark { width: 72px; height: 72px; border-radius: 16px; background: var(--bar) url("../icon-192.png") center / cover no-repeat; }
.boot-title { font-size: 1.6rem; font-weight: 700; color: var(--sea-ink); }
.boot-progress { width: 160px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.boot-bar { width: 40%; height: 100%; background: var(--sea); animation: boot 1.2s ease-in-out infinite; }
.boot-text { color: var(--muted); }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

#blazor-error-ui {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    padding: 16px 48px 16px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background: var(--flag); color: #fff;
}
#blazor-error-ui .reload { color: #fff; font-weight: 700; margin-left: 12px; }
#blazor-error-ui .dismiss { position: absolute; right: 12px; top: 12px; background: none; border: 0; color: #fff; font-size: 1.2rem; }

/* ---------- frame ---------- */
.frame { min-height: 100dvh; }

.appbar {
    position: sticky; top: 0; z-index: 30;
    background: var(--bar); color: var(--bar-ink);
    padding-top: env(safe-area-inset-top);
}
.appbar-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 8px 0 12px; max-width: 1200px; margin: 0 auto; }
.appbar-mark { width: 32px; height: 32px; border-radius: 8px; margin: 0 4px; }
.appbar-back { color: var(--bar-ink); }
.appbar-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appbar-title { font-size: 1.15rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.appbar-sub { font-size: 0.8rem; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: var(--tap); min-height: var(--tap); padding: 0;
    background: none; border: 0; border-radius: 50%; color: inherit; text-decoration: none;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }

/* sync chip */
.sync-chip {
    display: inline-flex; align-items: center; gap: 6px; flex: none;
    min-height: 40px; padding: 0 12px; border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--bar-ink) 40%, transparent);
    background: transparent; color: var(--bar-ink); font-size: 0.85rem; font-weight: 600; white-space: nowrap;
}
.sync-waiting { background: var(--buoy); border-color: var(--buoy); color: var(--buoy-ink); }
.sync-error { background: var(--flag); border-color: var(--flag); color: #fff; }
.sync-offline { opacity: 0.9; }

/* flow steps */
.flow { border-top: 1px solid color-mix(in srgb, var(--bar-ink) 18%, transparent); }
.flow ol { list-style: none; margin: 0 auto; padding: 8px 12px 10px; display: flex; gap: 4px; max-width: 1200px; }
.flow-step { flex: 1 1 24px; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 0.8rem; opacity: 0.75; }
.flow-dot {
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid currentColor; font-size: 0.75rem; font-weight: 700;
}
.flow-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: none; }
.flow-done { opacity: 0.9; }
.flow-done .flow-dot { background: var(--bar-ink); color: var(--bar); border-color: var(--bar-ink); }
.flow-current { opacity: 1; flex: 0 0 auto; margin-right: 8px; }
.flow-current .flow-dot { background: var(--buoy); border-color: var(--buoy); color: var(--buoy-ink); }
.flow-current .flow-label { display: inline; font-weight: 700; }
@media (min-width: 600px) { .flow-label { display: inline; } .flow-step, .flow-current { flex: 1 1 0; } }

/* navigation: bottom bar on phones, side rail on tablets */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    display: flex; background: var(--paper); border-top: var(--border) solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-item {
    flex: 1; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 0.8rem; font-weight: 600;
}
.bottom-item.active { color: var(--sea-ink); }
.bottom-item.active .icon { background: var(--sea-tint); border-radius: 16px; padding: 2px 16px; width: 56px; }

.rail { display: none; }
@media (min-width: 840px) {
    .bottom-nav { display: none; }
    .rail {
        display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 20;
        left: 0; top: calc(60px + env(safe-area-inset-top)); bottom: 0; width: var(--rail);
        padding: 16px 8px; background: var(--paper); border-right: var(--border) solid var(--line);
    }
    .rail-item {
        display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: var(--radius);
        color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600;
    }
    .rail-item.active { color: var(--sea-ink); background: var(--sea-tint); }
    .with-nav .content { margin-left: var(--rail); }
    .in-flow .rail { top: calc(104px + env(safe-area-inset-top)); }
}

.content { padding: 16px 16px 112px; }
.with-nav .content { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
.no-nav .content { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
@media (min-width: 840px) { .with-nav .content { padding-bottom: 120px; } }

.page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-narrow { max-width: 600px; }
.page-wide { max-width: 1160px; }
.page-sign { max-width: 1160px; }

.demo-banner {
    max-width: 760px; margin: 0 auto 12px; padding: 8px 12px; border-radius: var(--radius);
    background: var(--buoy-tint); border: var(--border) dashed var(--buoy); font-size: 0.85rem; font-weight: 600; text-align: center;
}

/* ---------- surfaces ---------- */
.card {
    background: var(--paper); border: var(--border) solid var(--line); border-radius: var(--radius);
    padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 1.1rem; font-weight: 700; }
.card-text { color: var(--muted); }
.form { gap: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 2px 0; }
.section-title { font-size: 1.05rem; font-weight: 700; }
.section-meta { color: var(--muted); font-size: 0.9rem; }

.facts { margin: 0; display: grid; gap: 8px; }
.facts > div { display: grid; grid-template-columns: 8.5em 1fr; gap: 12px; align-items: baseline; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
/* Phones and outdoor type: label above value, so values are never squeezed into a narrow column. */
@media (max-width: 520px) { .facts > div { grid-template-columns: 1fr; gap: 0; } .facts { gap: 12px; } }

.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plain-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap); padding: 0 20px; border-radius: var(--radius);
    font-weight: 700; font-size: 1rem; text-decoration: none; text-align: center;
    border: var(--border) solid transparent; background: none; color: var(--sea-ink);
}
.btn:disabled { opacity: 0.45; }
/* Orange means "you can do this now": an unavailable primary action goes grey, not dim orange. */
.btn-primary:disabled { background: var(--line); border-color: var(--line); color: var(--muted); opacity: 1; }
:root[data-outdoor="true"] .btn-primary:disabled { background: #FFFFFF; border: 2px dashed #000000; color: #000000; }
.btn-wide { width: 100%; min-height: 56px; }
.btn-primary { background: var(--buoy); border-color: var(--buoy); color: var(--buoy-ink); }
.btn-primary:not(:disabled):active { filter: brightness(0.94); }
.btn-secondary { background: var(--paper); border-color: var(--sea); color: var(--sea-ink); border-width: max(var(--border), 2px); }
.btn-text { padding: 0 12px; }
.btn-danger { background: var(--flag); border-color: var(--flag); color: #fff; }
:root[data-theme="dark"] .btn-danger, :root:not([data-theme="light"]) .btn-danger { color: #fff; }
.btn-danger-text { color: var(--flag); }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field-label { font-weight: 700; font-size: 0.95rem; }
legend.field-label { padding: 0; margin-bottom: 6px; }
.field-hint { color: var(--muted); font-size: 0.85rem; margin-top: -4px; }
.field-message { color: var(--flag); font-weight: 600; font-size: 0.9rem; }
.field-error .input, .field-error .pick, .field-error .stepper { border-color: var(--flag); border-width: 2px; }

.input {
    width: 100%; min-height: 56px; padding: 0 14px;
    background: var(--paper); border: var(--border) solid var(--line-strong); border-radius: var(--radius);
    font-size: 1.05rem;
}
.input:focus { outline: none; border-color: var(--sea); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 55%, transparent); }
.input:disabled { background: var(--ice); color: var(--muted); }
.input-upper { text-transform: uppercase; }
.input-code { font-size: 1.8rem; letter-spacing: 0.45em; text-align: center; font-weight: 700; padding-left: 0.45em; }
input[type="date"].input { appearance: none; -webkit-appearance: none; }
.readout { min-height: 32px; display: flex; align-items: center; font-weight: 700; font-size: 1.05rem; }
.readout-empty { font-weight: 400; color: var(--muted); font-size: 0.95rem; }

/* pick field */
.pick {
    width: 100%; min-height: 56px; padding: 8px 8px 8px 14px; display: flex; align-items: center; gap: 8px; text-align: left;
    background: var(--paper); border: var(--border) solid var(--line-strong); border-radius: var(--radius);
}
.pick:disabled { background: var(--ice); }
.pick-value { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-name { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.pick-detail { color: var(--muted); font-size: 0.85rem; }
.pick-placeholder { color: var(--muted); }
.pick .icon { color: var(--muted); }

/* full-screen pick sheet on phones, a dialog on tablets */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(8, 20, 30, 0.45); }
.sheet {
    position: fixed; inset: 0; z-index: 61; display: flex; flex-direction: column;
    background: var(--paper); padding-top: env(safe-area-inset-top);
}
@media (min-width: 640px) {
    .sheet { inset: auto; left: 50%; top: 8vh; transform: translateX(-50%); width: min(560px, 92vw); height: 84vh; border-radius: 12px; border: var(--border) solid var(--line); }
}
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: var(--border) solid var(--line); }
.sheet-title { font-size: 1.1rem; font-weight: 700; }
.sheet-search { display: flex; align-items: center; gap: 8px; margin: 12px 16px; padding: 0 12px; min-height: 52px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--ice); }
.sheet-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 1.05rem; min-height: 48px; }
.sheet-list { flex: 1; overflow-y: auto; padding: 0 8px calc(16px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.sheet-group { margin: 12px 8px 4px; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.sheet-empty { padding: 24px 12px; color: var(--muted); }
.sheet-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.sheet-row.selected { background: var(--sea-tint); border-radius: var(--radius); }
.sheet-item { flex: 1; min-height: 56px; padding: 8px; display: flex; flex-direction: column; justify-content: center; text-align: left; background: none; border: 0; }
.sheet-item-name { font-weight: 600; font-size: 1.05rem; }
.sheet-item-detail { color: var(--muted); font-size: 0.85rem; }
.fav { color: var(--muted); }
.fav.on { color: var(--buoy); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    min-height: var(--tap); padding: 0 16px; display: inline-flex; align-items: center; gap: 6px;
    background: var(--paper); border: var(--border) solid var(--line-strong); border-radius: 24px; font-weight: 600;
}
.chip.on { background: var(--sea); border-color: var(--sea); color: var(--paper); }
:root[data-outdoor="true"] .chip.on { background: #000; color: #fff; }
.chip-square { min-width: var(--tap); padding: 0; justify-content: center; border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.chip-code { font-weight: 700; }
.chip-name { font-weight: 400; font-size: 0.85rem; }
.chip.on .chip-name { opacity: 0.9; }
@media (max-width: 420px) { .chip-name { display: none; } }

/* stepper */
.stepper { display: flex; align-items: stretch; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.stepper-btn { width: 56px; min-height: 56px; display: inline-flex; align-items: center; justify-content: center; background: var(--ice); border: 0; color: var(--sea-ink); }
.stepper-btn:disabled { color: var(--line-strong); }
.stepper-input { flex: 1; min-width: 3ch; border: 0; background: none; text-align: right; font-size: 1.3rem; font-weight: 700; outline: none; padding: 0 4px; }
.stepper-unit { display: flex; align-items: center; padding: 0 10px 0 6px; color: var(--muted); }

/* toggle row */
.toggle {
    width: 100%; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 8px 14px; text-align: left;
    background: var(--paper); border: var(--border) solid var(--line-strong); border-radius: var(--radius);
}
.toggle-text { flex: 1; display: flex; flex-direction: column; }
.toggle-label { font-weight: 700; }
.toggle-hint { color: var(--muted); font-size: 0.85rem; }
.toggle-track { width: 52px; height: 32px; border-radius: 16px; background: var(--line-strong); position: relative; flex: none; transition: background 0.15s; }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.toggle.on .toggle-track { background: var(--kelp); }
.toggle.on .toggle-thumb { transform: translateX(20px); }
.toggle-state { width: 2.2em; font-weight: 700; color: var(--muted); }
.toggle.on .toggle-state { color: var(--kelp); }

/* segmented */
.segmented { display: flex; border: var(--border) solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg { flex: 1; min-height: var(--tap); border: 0; background: var(--paper); font-weight: 600; padding: 0 8px; }
.seg + .seg { border-left: var(--border) solid var(--line-strong); }
.seg.on { background: var(--sea); color: var(--paper); }

/* ---------- status ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    padding: 3px 10px 3px 8px; border-radius: 14px; font-size: 0.8rem; font-weight: 700;
    border: var(--border) solid transparent;
}
.pill-draft { background: var(--ice); color: var(--muted); border-color: var(--line-strong); }
.pill-waiting { background: var(--buoy-tint); color: var(--ink); border-color: var(--buoy); }
.pill-sent { background: var(--sea-tint); color: var(--sea-ink); border-color: var(--sea); }
.pill-done { background: var(--kelp-tint); color: var(--kelp); border-color: var(--kelp); }
.pill-attention { background: var(--flag-tint); color: var(--flag); border-color: var(--flag); }

.notice {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
    border-radius: var(--radius); border: var(--border) solid var(--line); border-left-width: 5px;
    background: var(--paper); text-decoration: none; color: var(--ink);
}
.notice > .icon { margin-top: 2px; }
.notice { flex-wrap: wrap; }
.notice-body { flex: 1 1 12em; min-width: 0; }
.notice .btn-text { margin: -8px -8px -8px auto; flex: none; }
.notice-info { border-left-color: var(--sea); background: var(--sea-tint); }
.notice-info > .icon { color: var(--sea-ink); }
.notice-success { border-left-color: var(--kelp); background: var(--kelp-tint); }
.notice-success > .icon { color: var(--kelp); }
.notice-warning { border-left-color: var(--buoy); background: var(--buoy-tint); }
.notice-error { border-left-color: var(--flag); background: var(--flag-tint); }
.notice-error > .icon { color: var(--flag); }
.notice-link { align-items: center; }
.notice-list { margin: 6px 0 0; padding-left: 1.2em; }
.notice-hint { display: block; margin-top: 4px; color: var(--muted); font-size: 0.9rem; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 16px; }
.empty-icon { width: 72px; height: 72px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--sea-tint); color: var(--sea-ink); }
.empty-title { font-size: 1.15rem; font-weight: 700; }
.empty-text { color: var(--muted); max-width: 32ch; }
.empty .btn { margin-top: 8px; }

/* ---------- landings ---------- */
.list-tools { display: flex; flex-direction: column; gap: 6px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 52px; background: var(--paper); border: var(--border) solid var(--line-strong); border-radius: var(--radius); }
.search .icon { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; min-height: 48px; font-size: 1rem; }
.sync-line { color: var(--muted); font-size: 0.9rem; padding: 0 2px; min-height: 1.3em; }

.day { display: flex; flex-direction: column; gap: 8px; }
.day-title { font-size: 0.95rem; font-weight: 700; color: var(--muted); margin: 8px 2px 0; }
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.landing-card, .fld-card {
    display: flex; gap: 12px; align-items: center; padding: 14px 16px; min-height: 76px;
    background: var(--paper); border: var(--border) solid var(--line); border-radius: var(--radius);
    color: var(--ink); text-decoration: none;
}
.landing-card:active, .fld-card:active { background: var(--sea-tint); }
.landing-main, .fld-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.landing-vessel { font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.landing-meta, .fld-truck, .fld-summary { color: var(--muted); font-size: 0.9rem; }
.landing-numbers { font-size: 0.85rem; color: var(--sea-ink); font-weight: 700; white-space: pre-wrap; }
.landing-side, .fld-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.landing-count, .fld-next { color: var(--muted); font-size: 0.85rem; }
.fld-number { font-size: 1.1rem; font-weight: 700; }
.fld-truck { display: inline-flex; gap: 6px; align-items: center; }

.fab-bar {
    position: fixed; z-index: 24; left: 16px; right: 16px;
    bottom: calc(64px + 12px + env(safe-area-inset-bottom));
    max-width: 728px; margin: 0 auto;
}
@media (min-width: 840px) { .fab-bar { left: calc(var(--rail) + 24px); bottom: 24px; } }
.btn-fab { box-shadow: 0 6px 18px rgba(11, 60, 93, 0.25); }
:root[data-outdoor="true"] .btn-fab { box-shadow: none; border: 2px solid #000; }

/* ---------- action bar ---------- */
.action-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 26;
    background: var(--paper); border-top: var(--border) solid var(--line);
    box-shadow: 0 -6px 16px rgba(11, 30, 45, 0.08);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.with-nav .action-bar { bottom: calc(64px + env(safe-area-inset-bottom)); padding-bottom: 10px; }
@media (min-width: 840px) { .with-nav .action-bar { bottom: 0; left: var(--rail); } }
.action-bar-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.action-reason { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 0.95rem; font-weight: 600; }
.action-reason .icon { color: var(--buoy); }
.action-row { display: flex; gap: 8px; }

/* ---------- landing / FLD ---------- */
.confirm { padding: 14px; border: var(--border) solid var(--flag); border-radius: var(--radius); background: var(--flag-tint); display: flex; flex-direction: column; gap: 10px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ---------- catch ---------- */
.catch-grid { display: grid; gap: 20px; }
.catch-lines, .catch-temps { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 1000px) {
    .catch-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
    .catch-temps { position: sticky; top: 124px; }
}
.line-card { gap: 16px; }
.line-head { display: flex; align-items: center; justify-content: space-between; }
.line-no { width: 32px; height: 32px; border-radius: 50%; background: var(--sea); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.line-tools { display: flex; gap: 4px; color: var(--muted); }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 520px) { .line-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }

.temp-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 7.5em; grid-template-areas: "no sp t"; gap: 10px; align-items: end; }
.temp-row > :nth-child(1) { grid-area: no; }
.temp-row > :nth-child(2) { grid-area: sp; }
.temp-row > :nth-child(3) { grid-area: t; }
/* Narrow phones and outdoor type: species on its own line, the temperature beneath it, so neither is squeezed. */
@media (max-width: 520px) {
    :root[data-outdoor="true"] .temp-row { grid-template-columns: 28px minmax(0, 1fr); grid-template-areas: "no sp" ". t"; }
    :root[data-outdoor="true"] .temp-head { display: none; }
}
@media (max-width: 360px) {
    .temp-row { grid-template-columns: 28px minmax(0, 1fr); grid-template-areas: "no sp" ". t"; }
    .temp-head { display: none; }
}
.temp-row + .temp-row { padding-top: 12px; border-top: 1px solid var(--line); }
.temp-no { height: 56px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.temp-input { display: flex; align-items: center; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--paper); }
.temp-input .input { border: 0; text-align: right; font-size: 1.2rem; font-weight: 700; padding-right: 4px; }
.temp-input .input:focus { box-shadow: none; }
.temp-input:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 55%, transparent); border-color: var(--sea); }
.unit { padding: 0 10px 0 2px; color: var(--muted); }
.temp-head { color: var(--muted); font-size: 0.85rem; font-weight: 700; padding-bottom: 0 !important; border-top: 0 !important; }
.temp-head + .temp-row { border-top: 0; padding-top: 4px; }
.temp-row { align-items: center; }

/* Visually hidden, still read by screen readers. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- the docket, set like a printed form ---------- */
.docket-sheet {
    background: var(--paper); border: var(--border) solid var(--line); border-top: 6px solid var(--sea);
    border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.docket-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.docket-company { display: flex; flex-direction: column; }
.docket-company-name { font-weight: 700; font-size: 1.05rem; }
.docket-lfr { color: var(--muted); font-size: 0.85rem; }
.docket-number { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.docket-number-label { color: var(--muted); font-size: 0.8rem; }
.docket-number-value { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.02em; }
.docket-note { color: var(--muted); font-size: 0.9rem; margin-top: -6px; }
.docket-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(13em, 1fr)); gap: 10px 16px; }
.docket-grid > div { display: flex; flex-direction: column; border-bottom: 1px dotted var(--line-strong); padding-bottom: 4px; }
.docket-grid dt { color: var(--muted); font-size: 0.8rem; }
.docket-grid dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.docket-lines { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.docket-lines caption { text-align: left; font-weight: 700; margin-bottom: 4px; }
.docket-lines th, .docket-lines td { text-align: left; padding: 6px 6px 6px 0; border-bottom: 1px solid var(--line); }
.docket-lines thead th { color: var(--muted); font-size: 0.8rem; font-weight: 700; border-bottom: 1px solid var(--ink); }
.docket-lines tfoot th, .docket-lines tfoot td { border-bottom: 0; font-weight: 700; }
.num-col { text-align: right !important; padding-right: 0 !important; }
.docket-temps { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.docket-temps > div { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.docket-temps dt { color: var(--muted); font-size: 0.85rem; }
.docket-temps dd { margin: 0; font-weight: 700; }
.docket-signatures { display: grid; grid-template-columns: repeat(auto-fit, minmax(14em, 1fr)); gap: 16px; padding-top: 12px; border-top: 2px solid var(--ink); }
.docket-sig { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.docket-sig img { background: #fff; border: 1px solid var(--line); border-radius: 6px; width: 100%; height: 110px; object-fit: contain; }
.docket-sig-missing { height: 110px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--muted); }
.docket-sig figcaption { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; font-size: 0.9rem; }
.docket-sig figcaption > span:first-child { color: var(--muted); }

/* ---------- signing ---------- */
.sign-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .sign-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.sign-col { display: flex; flex-direction: column; gap: 14px; }
.sign-intro { font-weight: 600; }
.signed-by { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius); background: var(--kelp-tint); color: var(--kelp); font-weight: 700; border: var(--border) solid var(--kelp); }
.signed-by .muted { color: var(--kelp); opacity: 0.85; font-weight: 600; margin-left: 0.35em; }

/* The one bold moment (§9.2 principle 7): paper-white in every theme, black ink. */
.sign-sheet { background: #FFFFFF; color: #15202B; border: 2px solid var(--sea); border-radius: 10px; padding: 10px 12px 12px; }
:root[data-outdoor="true"] .sign-sheet { border: 3px solid #000; }
.sign-top { display: flex; align-items: center; justify-content: space-between; }
.sign-caption { font-weight: 700; color: #0B3C5D; }
.sign-sheet .btn-text { color: #0B3C5D; }
.sign-area { position: relative; height: 220px; }
@media (orientation: landscape) and (max-height: 600px) { .sign-area { height: 180px; } }
@media (min-width: 900px) { .sign-area { height: 260px; } }
.sign-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; border-radius: 4px; cursor: crosshair; }
.sign-placeholder { position: absolute; left: 0; right: 0; top: 38%; text-align: center; color: #8A99A8; font-size: 1.05rem; pointer-events: none; }
.sign-line { position: absolute; left: 36px; right: 12px; bottom: 34px; border-bottom: 2px solid #15202B; pointer-events: none; }
.sign-cross { position: absolute; left: 10px; bottom: 30px; color: #15202B; font-weight: 700; pointer-events: none; }
.sign-name { border-top: 1px solid #C9D3DC; padding-top: 6px; font-weight: 700; min-height: 1.6em; }
.sign-sheet.disabled { opacity: 0.6; }
.rotate-hint { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
@media (orientation: landscape), (min-width: 900px) { .rotate-hint { display: none; } }

/* ---------- docket view ---------- */
.docket-hero {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    padding: 20px 16px; background: var(--paper); border: var(--border) solid var(--line); border-radius: var(--radius);
}
.docket-hero-label { color: var(--muted); font-size: 0.9rem; }
.docket-hero-number { font-size: 2rem; font-weight: 700; letter-spacing: 0.02em; color: var(--sea-ink); overflow-wrap: anywhere; }
.docket-hero-signed { color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 4px 0; display: grid; gap: 0; }
.timeline-step { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; min-height: 40px; color: var(--muted); position: relative; }
.timeline-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; background: var(--paper); justify-self: center; z-index: 1; }
.timeline-step:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 30px; bottom: -10px; border-left: 2px solid var(--line); }
.timeline-step.done { color: var(--ink); }
.timeline-step.done .timeline-dot { background: var(--kelp); border-color: var(--kelp); color: #fff; }
.timeline-label { font-weight: 600; }
@media (min-width: 600px) {
    .timeline { grid-template-columns: repeat(4, 1fr); }
    .timeline-step { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 4px; }
    .timeline-step:not(:last-child)::after { left: calc(50% + 14px); right: calc(-50% + 14px); top: 11px; bottom: auto; border-left: 0; border-top: 2px solid var(--line); }
    .timeline-step.done:not(:last-child)::after { border-top-color: var(--kelp); }
}

/* ---------- account ---------- */
.profile { flex-direction: row; align-items: center; gap: 16px; }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--sea); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; flex: none; }

/* ---------- PIN and lock ---------- */
.pinpad { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.pin-dots { display: flex; gap: 14px; min-height: 20px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--sea); }
.pin-dot.filled { background: var(--sea); }
.pin-keys { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.pin-key { width: 76px; height: 76px; border-radius: 50%; border: var(--border) solid var(--line-strong); background: var(--paper); font-size: 1.6rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pin-key:active { background: var(--sea-tint); }
.pin-del { border-color: transparent; background: none; }

.lock { position: fixed; inset: 0; z-index: 100; background: var(--ice); display: flex; align-items: center; justify-content: center; padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.lock-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 360px; text-align: center; }
.lock-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--sea); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; }
.lock-title { font-size: 1.3rem; }
.lock-who { color: var(--muted); }

/* ---------- sign-in ---------- */
.bare { min-height: 100dvh; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.signin { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.signin-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 4vh; }
.signin-mark { padding: 0; border: 0; background: none; border-radius: 22px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.signin-mark img { width: 88px; height: 88px; border-radius: 22px; display: block; }
.signin-title { font-size: 2rem; font-weight: 700; color: var(--sea-ink); outline: none; }
.signin-sub { color: var(--muted); }
.signin-card { background: var(--paper); border: var(--border) solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.signin-card form { display: flex; flex-direction: column; gap: 16px; }
.signin-info { font-weight: 600; }
.signin-help { color: var(--muted); font-size: 0.9rem; }
.signin-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.signin-foot { text-align: center; color: var(--muted); font-size: 0.8rem; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { min-height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--paper); text-align: left; }
.choice-name { font-weight: 700; }

/* ---------- install ---------- */
.install { background: var(--paper); border: var(--border) solid var(--sea); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.install-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -6px -6px 0 0; }
.install-head h2 { font-size: 1.05rem; }
.install-why { color: var(--muted); }
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: step; }
.install-steps li { display: flex; align-items: center; gap: 12px; }
.install-glyph { width: 40px; height: 40px; border-radius: var(--radius); background: var(--sea-tint); color: var(--sea-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.install-compact { flex-direction: column; }
.install-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- toast ---------- */
.toast-host { position: fixed; left: 16px; right: 16px; z-index: 80; bottom: calc(150px + env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 560px; width: 100%;
    padding: 6px 4px 6px 16px; min-height: 52px; border-radius: var(--radius);
    background: var(--ink); color: var(--paper); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: toast-in 0.18s ease-out;
}
:root[data-outdoor="true"] .toast { background: #000; color: #fff; box-shadow: none; }
.toast-success { border-left: 5px solid var(--kelp); }
.toast-warning { border-left: 5px solid var(--buoy); }
.toast-error { border-left: 5px solid var(--flag); }
.toast-text { flex: 1; font-weight: 600; }
.toast-action { background: none; border: 0; color: var(--buoy); font-weight: 700; min-height: var(--tap); padding: 0 12px; }
.toast-close { color: inherit; opacity: 0.8; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- design page ---------- */
.design { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; }
.design section { display: flex; flex-direction: column; gap: 12px; }
.design h2 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.design-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.design .action-bar { position: static; box-shadow: none; border: 1px solid var(--line); border-radius: var(--radius); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.swatch { display: flex; gap: 10px; align-items: center; }
.swatch-chip { width: 48px; height: 48px; border-radius: var(--radius); border: 1px solid var(--line-strong); flex: none; }
.t-display { font-size: 2rem; font-weight: 700; }
.t-title { font-size: 1.55rem; font-weight: 700; }
.t-heading { font-size: 1.22rem; font-weight: 700; }

/* ---------- phone width guard: no horizontal scroll at 360 px ---------- */
@media (max-width: 380px) {
    .content { padding-left: 12px; padding-right: 12px; }
    .facts > div { grid-template-columns: 7em 1fr; }
    .temp-row { grid-template-columns: 22px minmax(0, 1fr) 6.5em; gap: 8px; }
    .pin-keys { grid-template-columns: repeat(3, 68px); }
    .pin-key { width: 68px; height: 68px; }
}

/* A secondary value beside a main one (code, FIN, time): spaced in CSS so Razor whitespace can never glue them together. */
dd .muted, .landing-meta .num { margin-left: 0.35em; }
