/* Southend Yard — allocation & fulfilment intake.
 *
 * Built for a phone held in a gloved hand in a warehouse, and for a desktop in
 * the office. Large touch targets, high contrast, no hover-only affordances.
 * One stylesheet, no framework, no external fonts — the CSP forbids them and a
 * yard with poor signal should not wait on a CDN.
 */

:root {
    --ink: #16130f;
    --ink-soft: #5c5347;
    --ink-faint: #8b8172;
    --paper: #f7f4ef;
    --card: #ffffff;
    --line: #ddd5c8;
    --accent: #7a4a1f;      /* reclaimed oak */
    --accent-ink: #ffffff;
    --good: #2f6b3a;
    --warn: #8a5a00;
    --bad: #9b2c1f;
    --radius: 10px;
    --pad: 1rem;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #f2ede5;
        --ink-soft: #b9b0a2;
        --ink-faint: #8b8172;
        --paper: #171512;
        --card: #211e1a;
        --line: #3a352e;
        --accent: #c98a4b;
        --accent-ink: #171512;
        --good: #7ec08a;
        --warn: #d9a34a;
        --bad: #e08573;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

/* ── Chrome ─────────────────────────────────────────────────────── */

.bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem var(--pad);
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}
.brand span { color: var(--accent); }

.bar nav { display: flex; gap: 0.75rem; margin-left: auto; }
.bar nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; padding: 0.35rem 0; }
.bar nav a:hover, .bar nav a:focus { color: var(--accent); text-decoration: underline; }

.signout { display: flex; align-items: center; gap: 0.6rem; }
.who { color: var(--ink-faint); font-size: 0.85rem; }

main { max-width: 62rem; margin: 0 auto; padding: var(--pad); }

footer {
    max-width: 62rem;
    margin: 0 auto;
    padding: 1.5rem var(--pad) 3rem;
    color: var(--ink-faint);
    font-size: 0.85rem;
}

/* ── Cards & type ───────────────────────────────────────────────── */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--pad);
    margin-bottom: var(--pad);
}
.card.narrow { max-width: 24rem; margin-inline: auto; }

h1 { font-size: 1.5rem; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; letter-spacing: -0.01em; }

.subtitle { color: var(--ink-soft); margin: 0 0 1rem; }
.note { color: var(--ink-faint); font-size: 0.85rem; margin: 0.35rem 0; }
.note.sheet { border-top: 1px dashed var(--line); padding-top: 0.75rem; margin-top: 1rem; }
.empty { color: var(--ink-faint); font-style: italic; margin: 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--ink-faint); }
.good { color: var(--good); }

.sr {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Figures ────────────────────────────────────────────────────── */

.figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: 0.75rem;
    margin: 0;
}
.figures > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
}
.figures dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
}
.figures dd { margin: 0.15rem 0 0; }
.figures .big {
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* ── Forms ──────────────────────────────────────────────────────── */

label { display: block; font-weight: 600; font-size: 0.85rem; margin: 0.75rem 0 0.25rem; }

input[type="text"], input[type="search"], input[type="password"],
input[type="date"], select {
    width: 100%;
    padding: 0.7rem 0.75rem;
    font: inherit;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 2.9rem;   /* comfortable with gloves */
}

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

button {
    font: inherit;
    font-weight: 600;
    padding: 0.7rem 1.1rem;
    min-height: 2.9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
}
button:hover { border-color: var(--accent); }

button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { border-color: var(--bad); color: var(--bad); }
button.link {
    background: none; border: none; padding: 0; min-height: 0;
    color: var(--ink-soft); text-decoration: underline; font-weight: 600;
}

.stack { margin-top: 0.5rem; }
.stack button { margin-top: 1rem; }

.findbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: var(--pad);
}
.findbar input[type="search"] { flex: 1 1 14rem; }
.findbar select { flex: 0 1 11rem; }
.findbar.inline { margin-bottom: 0.5rem; }

/* ── Tables ─────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }

/* Wide tables scroll inside the card rather than the page. */
.card > table { display: block; overflow-x: auto; white-space: nowrap; }

/* ── Allocations ────────────────────────────────────────────────── */

.alloc {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}
.alloc:last-of-type { margin-bottom: 0; }
.alloc header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.pill {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid currentColor;
}
.pill.committed { color: var(--warn); }
.pill.staged { color: var(--accent); }
.pill.shipped { color: var(--ink-faint); }
.pill.held { color: var(--good); }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--line);
}
.actions form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.actions input[type="date"] { width: auto; }
.actions .release { flex: 1 1 18rem; }
.actions .release input[type="text"] { flex: 1 1 8rem; }
.actions .note { margin: 0; }

details summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 0;
    color: var(--accent);
}
details.spaced { margin-top: 1rem; border-top: 1px solid var(--line); }
.notes pre {
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: var(--ink-soft);
    background: var(--paper);
    padding: 0.75rem;
    border-radius: 8px;
    margin: 0;
}

/* ── Disagreements ──────────────────────────────────────────────── */

.pill.sev-critical { color: var(--bad); border-width: 2px; }
.pill.sev-high     { color: var(--bad); }
.pill.sev-medium   { color: var(--warn); }
.pill.sev-low      { color: var(--ink-faint); }
.pill.kind         { color: var(--ink-faint); font-weight: 600; }

.money {
    margin-left: auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* The sentence explaining the disagreement is the point of the row, so it is
   set at body size rather than as secondary note text. */
.detail {
    margin: 0.5rem 0 0;
    line-height: 1.45;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
}

.chip {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 2.4rem;
    line-height: 1.5rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.chip.export { margin-left: auto; }

/* ── Audit ──────────────────────────────────────────────────────── */

.audit { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.audit li {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
}
.audit li:last-child { border-bottom: none; }
.audit .when { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.audit .what { font-weight: 600; }
.audit .who { color: var(--ink-soft); margin-left: auto; }

/* ── Flash ──────────────────────────────────────────────────────── */

.flash {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid;
    margin: 0 0 var(--pad);
    font-weight: 500;
}
.flash.success { color: var(--good); border-color: var(--good); background: color-mix(in srgb, var(--good) 8%, transparent); }
.flash.error { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
