/* Gorilla Inventory — phone and desktop portal.
   Built for the shop floor: big tap targets (56px+), high contrast, one column on phones. */

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #ecebe5;
  --ink: #1b1d1a;
  --ink-2: #4c524a;
  --line: #d6d4cc;
  --brand: #1f2a1f;
  --accent: #f2b632;
  --accent-ink: #1b1d1a;
  --go: #1f7a3a;
  --go-ink: #ffffff;
  --amber: #b86e00;
  --amber-bg: #fff1d6;
  --red: #b3261e;
  --red-bg: #fde4e1;
  --hold: #6b3fa0;
  --hold-bg: #efe6fa;
  --focus: #1a5fd0;
  --radius: 12px;
  --tap: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121411; --surface: #1c1f1b; --surface-2: #262a25; --ink: #eef0ea; --ink-2: #b4baae;
    --line: #353a33; --brand: #0d110d; --amber: #f0a637; --amber-bg: #3a2a0c; --red: #ff8a80; --red-bg: #3d1513;
    --hold: #c9a7f2; --hold-bg: #2c1f3d; --go: #2f9e52; --focus: #7fb0ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121411; --surface: #1c1f1b; --surface-2: #262a25; --ink: #eef0ea; --ink-2: #b4baae;
  --line: #353a33; --brand: #0d110d; --amber: #f0a637; --amber-bg: #3a2a0c; --red: #ff8a80; --red-bg: #3d1513;
  --hold: #c9a7f2; --hold-bg: #2c1f3d; --go: #2f9e52; --focus: #7fb0ff; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; margin-top: 1.5rem; }
h3 { font-size: 1.05rem; }
p { margin: .4rem 0; }
.muted { color: var(--ink-2); }
.center { text-align: center; }
.pad { padding: 16px; }
.small { font-size: .88rem; }
.big { font-size: 1.3rem; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.form-top { position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.view .form-top { top: 56px; }
.sheet .form-top { top: -18px; margin-top: -18px; padding-top: 18px; }
.form-top h1, .form-top h2 { margin-bottom: 8px; }
.order-actions { padding: 10px; background: var(--surface-2); border-radius: var(--radius); }
.hot-toggle { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 2px solid var(--red); border-radius: 10px; color: var(--red); }
button.pick { justify-content: flex-start; text-align: left; gap: 12px; min-height: 64px; font-weight: 400; }
button.pick .tick { width: 32px; height: 32px; border: 2px solid var(--line); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; flex-shrink: 0; }
button.pick[aria-pressed="true"] { border-color: var(--accent); background: var(--amber-bg); }
button.pick[aria-pressed="true"] .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.actionbar { position: sticky; bottom: 8px; z-index: 5; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px; box-shadow: 0 6px 24px #0004; }
.dims { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 6px; align-items: center; font-weight: 400; }
.dims span { color: var(--ink-2); }
.code { font-family: "Bahnschrift SemiCondensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif; font-weight: 800; letter-spacing: .02em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.big-code { font-size: 1.8rem; display: inline-block; padding: 2px 10px; }
.code-preview { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 1.05rem; }
.code-preview strong { font-family: "Bahnschrift SemiCondensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif; font-size: 1.3rem; }
.line-pick { flex-direction: column; align-items: flex-start; text-align: left; padding: 10px 16px; }
.line-pick .sub { font-weight: 400; font-size: .9rem; color: var(--ink-2); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand); color: #fff;
}
.brand { font-weight: 800; letter-spacing: .08em; text-decoration: none; font-size: 1.1rem; }
.brand span { font-weight: 500; letter-spacing: 0; color: var(--accent); margin-left: 6px; }
.who { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.who button { min-height: 40px; padding: 0 12px; background: transparent; color: #fff; border: 1px solid #ffffff55; border-radius: 8px; font: inherit; }

.view { max-width: 760px; margin: 0 auto; padding: 16px; }
.view.wide { max-width: 1100px; }

/* buttons */
button, .btn {
  -webkit-appearance: none; appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; text-decoration: none; touch-action: manipulation; text-align: center;
}
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
.primary { background: var(--go); color: var(--go-ink); border-color: var(--go); }
.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.danger { color: var(--red); border-color: var(--red); }
.quiet { border-color: transparent; background: transparent; text-decoration: underline; font-weight: 500; min-height: 44px; }
.block { width: 100%; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles .btn, .tiles button { min-height: 96px; flex-direction: column; font-size: 1.1rem; padding: 12px; }
.tiles .sub { font-weight: 400; font-size: .85rem; color: var(--ink-2); }
.tiles .primary .sub, .tiles .accent .sub { color: inherit; opacity: .85; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, 1fr); } }

/* stage buttons on the ticket screen */
.stage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stage-grid button { min-height: 72px; font-size: 1.05rem; line-height: 1.2; padding: 8px; flex-direction: column; gap: 2px; }
.stage-grid button.current { background: var(--surface-2); color: var(--ink); border: 3px solid var(--ink); opacity: 1; }
.stage-grid button .sub { display: block; font-size: .8rem; font-weight: 400; opacity: .8; }
@media (min-width: 700px) { .stage-grid { grid-template-columns: repeat(3, 1fr); } }

/* cards and lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card + .card { margin-top: 10px; }
a.card { display: block; text-decoration: none; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list > a, .list > .item {
  display: flex; gap: 12px; justify-content: space-between; align-items: center; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-height: var(--tap);
}
.list > a, .list > .item { border-left: 8px solid var(--line); }
.list .title { font-weight: 700; }
.list .meta { color: var(--ink-2); font-size: .9rem; }
.lvl-amber { border-left: 8px solid var(--amber) !important; }
.lvl-red { border-left: 8px solid var(--red) !important; }
.lvl-hold { border-left: 8px solid var(--hold) !important; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.hold { background: var(--hold-bg); color: var(--hold); }
.chip.go { background: var(--go); color: #fff; }

.ticket-head .num { font-size: 2.2rem; font-weight: 800; letter-spacing: .02em; }
.ticket-head .piece { font-size: 1.1rem; font-weight: 700; color: var(--ink-2); }
.ticket-head .cust { font-size: 1.3rem; font-weight: 700; }
.where { font-size: 1.15rem; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.where strong { font-size: 1.3rem; }

.banner { padding: 14px 16px; border-radius: var(--radius); font-weight: 600; }
.banner.hold { background: var(--hold-bg); color: var(--hold); border: 2px solid var(--hold); }
.banner.red { background: var(--red-bg); color: var(--red); }
.banner.info { background: var(--surface-2); }

.qty-stepper { display: flex; align-items: center; gap: 10px; }
.qty-stepper button { width: var(--tap); padding: 0; font-size: 1.6rem; }
.qty-stepper output { min-width: 3ch; text-align: center; font-size: 1.6rem; font-weight: 800; }

/* forms */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
label .hint { font-weight: 400; color: var(--ink-2); font-size: .85rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line);
  border-radius: 10px; min-height: var(--tap); padding: 10px 12px;
}
textarea { min-height: 90px; }
input[type="checkbox"] { width: 28px; min-height: 28px; height: 28px; }
.pin-input { font-size: 2rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button { min-height: 48px; font-weight: 600; padding: 0 14px; }
.choices button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two label { margin-top: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px 14px; margin: 16px 0 0; }
legend { font-weight: 700; padding: 0 6px; }
.err { color: var(--red); font-weight: 600; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--ink-2); }
td input, td select { min-height: 44px; padding: 6px 8px; }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.tabs button { min-height: 44px; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history .when { color: var(--ink-2); font-size: .85rem; }

.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.secret { word-break: break-all; font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 12px; border-radius: 8px; user-select: all; }

/* toast + bottom sheet */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 14px 20px; border-radius: 12px; font-weight: 600;
  max-width: calc(100% - 32px); z-index: 50; box-shadow: 0 6px 24px #0005;
}
.toast.bad { background: var(--red); color: #fff; }
.toast.good { background: var(--go); color: #fff; }
.sheet-backdrop { position: fixed; inset: 0; background: #0008; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } }

.truckbar { position: sticky; bottom: 0; background: var(--accent); color: var(--accent-ink); padding: 12px 16px; border-radius: var(--radius); font-weight: 700; margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.truckbar a { min-height: 44px; display: inline-flex; align-items: center; }
