/* app.css — Delta T Warehouse Order. Black / orange #F97316 / white, Inter. */

:root {
  --bg: #000000;
  --surface: #121212;
  --surface-2: #1b1b1b;
  --line: #262626;
  --text: #ffffff;
  --muted: #9c9c9c;
  --orange: #F97316;
  --orange-press: #d95f0a;
  --orange-soft: rgba(249, 115, 22, 0.14);
  --err: #ff5d45;
  --radius: 10px;
  --tap: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
input { font: inherit; color: var(--text); }
input:focus-visible, button:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---- brand mark ---- */
.mark { font-weight: 800; letter-spacing: -0.02em; }
.mark .delta { color: var(--orange); }

/* ---- offline banner ---- */
.offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: var(--err); color: #000; font-weight: 600;
  text-align: center; padding: 8px 12px; font-size: 14px;
  padding-top: calc(8px + env(safe-area-inset-top));
}

/* ---- gate ---- */
.gate {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-card { width: 100%; max-width: 340px; text-align: center; }
.gate-card .mark { font-size: 56px; }
.gate-card h1 { font-size: 22px; font-weight: 700; margin: 8px 0 4px; }
.gate-card .muted { margin-bottom: 20px; }
.gate-card input {
  width: 100%; height: 52px; text-align: center; font-size: 22px; letter-spacing: 0.2em;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 12px;
}
.gate-card input:focus { border-color: var(--orange); outline: none; }
.err { color: var(--err); font-size: 14px; min-height: 20px; margin-top: 10px; }
.muted { color: var(--muted); }

/* ---- buttons ---- */
.btn-primary {
  display: block; width: 100%; min-height: 52px;
  background: var(--orange); color: #000; font-weight: 700; font-size: 17px;
  border-radius: var(--radius);
}
.btn-primary:active { background: var(--orange-press); }

/* ---- top bar ---- */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.bar .mark { font-size: 24px; }
.bar h1 { font-size: 17px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn {
  min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.bar-btn:active { background: var(--surface-2); }
.bar-btn.who { color: var(--orange); border-color: rgba(249, 115, 22, 0.45); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }

/* ---- name pick ---- */
.name-list { padding: 18px 16px; display: grid; gap: 12px; max-width: 480px; margin: 0 auto; }
.name-btn {
  min-height: 60px; font-size: 19px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.name-btn:active { border-color: var(--orange); background: var(--surface-2); }

/* ---- search (sticky) + chips ---- */
.search-wrap {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
}
.search-wrap input[type="search"] {
  width: 100%; height: 48px; padding: 0 14px; font-size: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  -webkit-appearance: none; appearance: none;
}
.search-wrap input[type="search"]:focus { border-color: var(--orange); outline: none; }
.chips {
  display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; padding-bottom: 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line); border-radius: 22px;
  background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip.on { background: var(--orange); border-color: var(--orange); color: #000; }

/* ---- item list ---- */
.list { padding-bottom: calc(110px + env(safe-area-inset-bottom)); min-height: 60dvh; }
.row {
  display: flex; align-items: center; gap: 10px;
  min-height: 68px; padding: 8px 10px 8px 16px;
  border-bottom: 1px solid var(--line);
}
.row.in-cart { background: var(--orange-soft); }
.row-txt { flex: 1; min-width: 0; }
.row-d { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.row-sub {
  color: var(--muted); font-size: 12.5px; margin-top: 2px; min-height: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.step { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.st-btn {
  width: var(--tap); height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-size: 22px; font-weight: 600; line-height: 1;
}
.st-btn:active { background: var(--surface-2); border-color: var(--orange); }
.st-q {
  width: 58px; height: var(--tap); text-align: center; font-size: 17px; font-weight: 700;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
}
.row.in-cart .st-q { border-color: var(--orange); color: var(--orange); }
.st-q:focus { border-color: var(--orange); outline: none; }
.list-note { padding: 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- cart bar ---- */
.cart-bar {
  position: fixed; left: 12px; right: 12px; z-index: 30;
  bottom: calc(12px + env(safe-area-inset-bottom));
  min-height: 56px; border-radius: 14px;
  background: var(--orange); color: #000;
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}
.cart-bar:active { background: var(--orange-press); }

/* ---- cart sheet ---- */
.sheet { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.65); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 82dvh; display: flex; flex-direction: column;
  background: var(--surface); border-top: 2px solid var(--orange);
  border-radius: 16px 16px 0 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.sheet-head h2 { font-size: 18px; font-weight: 700; }
.sheet-lines { overflow-y: auto; flex: 1; }
.sheet-lines .row { padding-left: 8px; background: none; }
.rm-btn {
  width: var(--tap); height: var(--tap); flex: 0 0 auto;
  color: var(--muted); font-size: 18px; border-radius: var(--radius);
}
.rm-btn:active { color: var(--err); }
.sheet-foot { padding: 12px 16px 0; }
.sheet-empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---- pending ---- */
.pend-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.pend-qty {
  flex: 0 0 auto; min-width: 52px; text-align: center;
  font-weight: 800; font-size: 17px; color: var(--orange);
  background: var(--orange-soft); border-radius: var(--radius); padding: 8px 6px;
}
.pend-txt { flex: 1; min-width: 0; }
.pend-d { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.pend-at { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pend-empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---- toasts ---- */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 70;
  bottom: calc(84px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: min(92vw, 420px); padding: 12px 18px;
  background: #fff; color: #000; font-weight: 600; font-size: 14.5px;
  border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  transition: opacity 0.3s, transform 0.3s;
}
.toast-err { background: var(--err); color: #000; }
.toast-gone { opacity: 0; transform: translateY(8px); }

/* ---- desktop niceties (app is phone-first) ---- */
@media (min-width: 760px) {
  .bar, .search-wrap { padding-left: max(14px, calc(50vw - 360px)); padding-right: max(14px, calc(50vw - 360px)); }
  .list, .name-list { max-width: 720px; margin: 0 auto; }
  .cart-bar { left: 50%; right: auto; transform: translateX(-50%); width: 420px; }
  .cart-bar:active { transform: translateX(-50%); }
  .sheet-body { left: 50%; transform: translateX(-50%); width: 560px; border: 1px solid var(--line); border-top: 2px solid var(--orange); }
}
