/*  Source Logistics dock scanners - shared shell.

    Designed for the conditions rather than for a desk: a handheld or a wall tablet, held at
    arm's length, in a cold aisle, by someone wearing gloves and not looking closely. That
    drives most of what follows.

      - Nothing smaller than 16px, and the answer itself is huge. It has to be readable
        without bringing the device to your face.
      - The result card is colour-coded and the colour block is large. Across a dock you
        read the colour first and the words second.
      - Touch targets are 48px minimum. Gloves are imprecise.
      - Dark by default. Screens are glare sources on a dock at night, and this is the same
        palette as the KPI app so the two do not look like different companies.
      - No hover states carry meaning. There is no mouse.
*/

:root {
    --bg: #141414;
    --panel: #1f1f1f;
    --panel-2: #272727;
    --line: #383838;
    --ink: #f2f2f2;
    --muted: #a2a2a2;
    --accent: #ffcc00;
    --on-accent: #141414;

    --ok: #2f7d33;
    --ok-ink: #d8f0d9;
    --warn: #8a6100;
    --warn-ink: #ffeab0;
    --bad: #9c2019;
    --bad-ink: #ffdad6;

    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 17px;
    /* A dock user never means to zoom by double-tapping, but they do it by accident. */
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}

.wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 14px 40px;
}

/* ---- Header ------------------------------------------------------------- */

.top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 14px;
}

.brand {
    font-weight: 700;
    letter-spacing: .02em;
    font-size: 1.05rem;
}

.brand span { color: var(--accent); }

.site-pick {
    margin-left: auto;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 1rem;
    min-height: 48px;
}

/* ---- Scan box ----------------------------------------------------------- */

.scan-label {
    display: block;
    color: var(--muted);
    font-size: .95rem;
    margin-bottom: 6px;
}

.scan-row { display: flex; gap: 8px; }

/* Deliberately a plain text input. A handheld in keyboard-wedge mode types the barcode and
   presses Enter, so the input must accept characters and a submit - not a numeric keypad,
   which some devices will not fill, and not a search box that offers autocomplete. */
.scan-input {
    flex: 1;
    background: var(--panel);
    color: var(--ink);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    font-size: 1.35rem;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: .04em;
    min-height: 58px;
}

.scan-input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn {
    background: var(--panel-2);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 18px;
    font-size: 1rem;
    min-height: 58px;
    min-width: 48px;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    font-weight: 700;
}

.btn:active { transform: translateY(1px); }

.hint {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 8px;
    min-height: 1.2em;
}

/* ---- Result card -------------------------------------------------------- */

.card {
    margin-top: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

/* The band is the thing you read from three metres away. */
.band {
    padding: 16px 18px;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: .01em;
    line-height: 1.15;
}

.band small {
    display: block;
    font-size: .95rem;
    font-weight: 600;
    opacity: .9;
    margin-top: 4px;
    letter-spacing: 0;
}

.band.ok   { background: var(--ok);   color: var(--ok-ink); }
.band.warn { background: var(--warn); color: var(--warn-ink); }
.band.bad  { background: var(--bad);  color: var(--bad-ink); }

.rows { padding: 4px 0; }

.row {
    display: flex;
    gap: 12px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    align-items: baseline;
}

.row:last-child { border-bottom: 0; }

.row .k {
    color: var(--muted);
    font-size: .95rem;
    flex: 0 0 40%;
}

.row .v {
    font-size: 1.15rem;
    font-weight: 600;
    word-break: break-word;
}

.row .v.mono {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: .03em;
}

.section-title {
    padding: 12px 18px 6px;
    color: var(--muted);
    font-size: .9rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ---- Contents ----------------------------------------------------------- */

.line {
    display: flex;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line);
    align-items: baseline;
}

.line .sku {
    font-family: ui-monospace, Consolas, monospace;
    font-weight: 700;
    flex: 0 0 30%;
}

.line .desc { color: var(--muted); flex: 1; font-size: .95rem; }
.line .qty { font-weight: 700; font-size: 1.1rem; }

/* ---- Recent ------------------------------------------------------------- */

.recent { margin-top: 22px; }

.recent h2 {
    font-size: .9rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 8px;
}

.recent-item {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 9px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: .95rem;
}

.recent-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.recent-item .code {
    font-family: ui-monospace, Consolas, monospace;
    flex: 1;
}

.recent-item .when { color: var(--muted); font-size: .85rem; }

/* ---- Offline ------------------------------------------------------------ */

/* Warehouse wifi drops. The app keeps working and says so rather than failing silently. */
.offline {
    display: none;
    background: var(--warn);
    color: var(--warn-ink);
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 12px;
}

.offline.show { display: block; }

.busy { opacity: .55; }

@media (max-width: 420px) {
    .row .k { flex: 0 0 45%; }
    .band { font-size: 1.6rem; }
}
