/* =====================================================================
   app.css - all styling for SKU Keeper.
   To change the look, edit the colors in :root below (one place).
   ===================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap");

:root {
  --bg: #0e1014;
  --panel: #191c23;
  --panel2: #1f232b;
  --line: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa1ad;
  --accent: #f26b2a;
  --ok: #2f9e6a;
  --ok-text: #7fe0ad;
  --warn: #e0a526;
  --held: #8b6cf0;
  --bad: #ff9a9d;
  --blue: #7cc4ff;
  /* a few helper shades derived from the colors above */
  --ok-bg: #1f3a2c;
  --ok-soft: #bfead4;
  --held-text: #cfc3ff;
  --held-line: #5a47a8;
  --held-bg: #201a33;
  --warn-bg: #241d12;
  --warn-line: #6b4f1d;
  --warn-soft: #c9b48a;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.4;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #ff8a52; }
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---------- page containers ---------- */
.page { max-width: 560px; margin: 0 auto; padding: 22px 16px 110px; display: flex; flex-direction: column; gap: 10px; }
.page.wide-pad { padding: 24px 20px 32px; gap: 12px; }
.page.center { min-height: 100vh; justify-content: center; }
h1 { font-size: 24px; font-weight: 800; }
h1.big { font-size: 28px; line-height: 1.15; }
.lead { font-size: 14px; color: var(--muted); line-height: 1.45; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row.base { align-items: baseline; }
.section-title { font-size: 16px; font-weight: 800; }
.small { font-size: 12px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; text-align: center; border: 0; border-radius: 14px; padding: 15px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
}
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn.ok { background: var(--ok); }
.btn.ghost { background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.btn.small-btn { width: auto; padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.sheet-btn { padding: 13px; border-radius: 12px; font-size: 15px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 12px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px stops phones zooming in */
  color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
select option { background: var(--panel); }
.search { border-radius: 12px; padding: 12px 14px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.msg { font-size: 13px; line-height: 1.4; padding: 10px 12px; border-radius: 10px; }
.msg.err { background: #3a1d1f; color: var(--bad); border: 1px solid #6b2b2e; }
.msg.info { background: var(--ok-bg); color: var(--ok-soft); border: 1px solid var(--ok); }

/* ---------- cards & tiles ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.card-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.card-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-row .big { font-size: 17px; font-weight: 800; }
.banner-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.banner-warn .small { color: var(--warn-soft); }
.banner-held { background: var(--held-bg); border-color: var(--held-line); }

/* Tiles: equal-width columns, labels never wrap, numbers line up */
.tiles { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 6px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; min-width: 0; }
.tile b { display: block; font-size: 22px; line-height: 28px; height: 28px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles.small-nums .tile b { font-size: 18px; }
.tile span { display: block; margin-top: 2px; font-size: clamp(10px, 2.75vw, 11.5px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-ok { color: var(--ok-text); } .c-held { color: var(--held-text); } .c-blue { color: var(--blue); }
.c-warn { color: var(--warn); } .c-bad { color: var(--bad); }

/* ---------- setup ---------- */
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }
.radio-card {
  all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; width: 100%;
}
.radio-card .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #4a5160; flex: 0 0 20px; margin-top: 1px; }
.radio-card .t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.radio-card .t b { font-size: 15px; font-weight: 700; }
.radio-card .t span { font-size: 13px; line-height: 1.4; color: var(--muted); }
.radio-card.on { background: #1f1a17; border: 2px solid var(--accent); padding: 11px 13px; }
.radio-card.on .dot { border: 6px solid var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; border: 0; }
.chip.add { background: none; border: 1px dashed #4a5160; color: #c5cad4; font-weight: 600; }
.preview { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.preview .mono { font-size: 18px; font-weight: 700; }
.toggle { width: 46px; height: 28px; flex: 0 0 46px; border-radius: 999px; background: var(--line); position: relative; border: 0; padding: 0; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #c5cad4; transition: left .15s; }
.toggle.on { background: var(--ok); }
.toggle.on::after { left: 21px; background: #fff; }
.summary-list { display: grid; grid-template-columns: 120px minmax(0, 1fr); row-gap: 10px; font-size: 14px; }
.summary-list dt { color: var(--muted); } .summary-list dd { margin: 0; font-weight: 600; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: #14161b; border-top: 1px solid var(--line); z-index: 20; }
.nav-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 8px 4px calc(10px + env(safe-area-inset-bottom)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; min-width: 0; }
.nav a span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a.on { color: var(--accent); font-weight: 700; }

/* ---------- picks & items ---------- */
.item-row { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); width: 100%; text-align: left; }
.item-row.pick { border-color: var(--held-line); }
.thumb { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 8px; background: #262a33; object-fit: cover; }
.item-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-row .where { font-size: 13px; font-weight: 800; color: var(--held-text); }
.item-row .ttl { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-card { background: var(--panel); border: 1px solid var(--held-line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pick-card.done { border-color: var(--line); opacity: .75; }
.pick-head { display: flex; gap: 10px; align-items: center; }
.pick-head .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.facts { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 6px; }
.fact { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-width: 0; }
.fact b { display: block; font-size: 14px; line-height: 20px; height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.fact span { display: block; font-size: clamp(10px, 2.75vw, 11.5px); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }

/* ---------- board ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.i-in { background: var(--ok); } .i-gap { border: 1px dashed var(--warn); } .i-pick { background: var(--held); }
.i-empty { background: var(--bg); border: 1px solid var(--line); }
.unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.unit-head b { font-size: 15px; font-weight: 700; white-space: nowrap; }
.unit-head .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cells { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cell {
  all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; height: 34px; min-width: 0;
  border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; overflow: hidden;
  background: #1f3a2c; color: var(--ok-soft); font-variant-numeric: tabular-nums;
}
.cell.gap { background: none; border: 1.5px dashed var(--warn); color: var(--warn); }
.cell.pick { background: var(--held); color: #fff; }
.cell.empty { background: var(--bg); border: 1px solid var(--line); color: #4a5160; }
.cell.match { outline: 2px solid var(--accent); outline-offset: 1px; }
.bar { height: 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar i.full { background: var(--warn); }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
.mini-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.mini-row { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--panel2); font-size: 13px; cursor: pointer; width: 100%; }
.mini-row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mini-row .s { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* consolidate */
.move-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; }
.move-card .name { font-size: 16px; font-weight: 800; }
.move-card .from { font-size: 15px; line-height: 1.4; }
.move-card .from small { color: var(--muted); font-size: 13px; }
.move-card .from b { color: var(--ok-soft); }
.dashed-note { padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line); font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- sheet ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: #14161b;
  border-radius: 22px 22px 0 0; border-top: 1px solid var(--line); padding: 0 18px calc(22px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; transition: transform .2s;
}
.grab { align-self: center; padding: 10px 40px 4px; cursor: grab; touch-action: none; position: sticky; top: 0; background: #14161b; }
.grab i { display: block; width: 44px; height: 5px; border-radius: 5px; background: #3a3f4b; }
.photo { height: 200px; flex: 0 0 200px; border-radius: 14px; background: var(--panel2); border: 1px dashed #3a3f4b; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; overflow: hidden; }
.photo.has { border: 0; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.pill { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-soft); }
.pill.held { background: var(--held-bg); color: var(--held-text); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.sheet h1 { font-size: 18px; line-height: 1.3; font-weight: 700; }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); row-gap: 8px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.chip-out { font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-block; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #2a2f3a; color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 60; max-width: 90vw; }
.toast.err { background: #5a2427; color: var(--bad); }
.empty-state { text-align: center; padding: 26px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ---------- landing ---------- */
.hero { display: flex; flex-direction: column; gap: 16px; align-items: stretch; text-align: center; }
.hero h1 { font-size: 40px; font-weight: 800; }
.hero .pitch { font-size: 17px; color: var(--muted); line-height: 1.5; }
.hero .logo { font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; }
.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs button { border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.tabs button.on { background: var(--accent); color: #fff; }
