/* Aurora Inventory: brand tokens match site/styles.css and the quote app */
:root {
  --bg: #0C0D10;
  --surface: #16181C;
  --surface-2: #1E2126;
  --text: #F5F6F7;
  --muted: #A2A8B1;
  --green: #2EE89C;
  --green-ink: #00170D;
  --violet: #9D72D9;
  --amber: #FFC478;
  --danger: #FF7A7A;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.26);
  --font: "Archivo", system-ui, -apple-system, sans-serif;
  --font-display: "Montserrat", "Archivo", system-ui, sans-serif;
  --r: 16px;
  --gut: clamp(14px, 3vw, 28px);
  --tabs-h: 64px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: clamp(26px, 5vw, 36px); }
h2 { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.pre { white-space: pre-wrap; }
.warn { color: var(--amber); }
.lowtxt { color: var(--amber); }
[hidden] { display: none !important; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) var(--gut) 8px;
  background: rgba(12, 13, 16, 0.88);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { height: 26px; width: auto; }
.topbar-title { color: var(--muted); font-size: 15px; padding-left: 10px; border-left: 1px solid var(--line-strong); }
.sync-pill { margin-left: auto; min-height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: none; color: var(--muted); font: 600 13px var(--font); cursor: pointer; }
.sync-pill.ok { color: var(--green); border-color: rgba(46, 232, 156, 0.4); }
.sync-pill.off { color: var(--amber); border-color: rgba(255, 196, 120, 0.45); }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px max(var(--gut), env(safe-area-inset-left)) calc(env(safe-area-inset-bottom) + 6px);
  background: rgba(22, 24, 28, 0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabs a.on { color: var(--green); }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--amber); color: #1a1000; font-size: 11px; line-height: 18px; text-align: center; }

/* pages */
main { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px); }
.page { max-width: 980px; margin: 0 auto; padding: 18px var(--gut) 24px; display: grid; gap: 14px; }
.narrow { max-width: 680px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back { color: var(--muted); font-weight: 600; justify-self: start; padding: 6px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 { display: flex; gap: 10px; flex-wrap: wrap; }
.row2 > * { flex: 1; }

/* controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface-2); color: var(--text); font: 600 16px/1 var(--font); cursor: pointer; text-align: center; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn.big { min-height: 54px; font-size: 17px; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn.icon { width: 50px; padding: 0; flex: none; }
.btn.danger { color: var(--danger); border-color: rgba(255, 122, 122, 0.4); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

input, textarea, select {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--bg); color: var(--text); font: 17px/1.3 var(--font); outline: none;
}
select { -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(46, 232, 156, 0.2); }
input::placeholder, textarea::placeholder { color: #6B717A; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); }
.searchrow { display: flex; gap: 8px; }
.searchrow input { flex: 1; min-width: 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: none; color: var(--text); font: 600 14px var(--font); cursor: pointer; }
.chips button.on { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.chips button[data-low].on { background: var(--amber); border-color: var(--amber); color: #1a1000; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 12px; padding: 3px; }
.seg button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: 600 15px var(--font); cursor: pointer; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.card > .seg { display: flex; margin-bottom: 14px; }
.card > .seg button { flex: 1; }

/* lists */
.list { display: grid; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.row:active { background: var(--surface-2); }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-main b, .row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: grid; justify-items: end; gap: 4px; text-align: right; flex: none; }
.qty { font-family: var(--font-display); font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.qty small { font-family: var(--font); font-size: 13px; color: var(--muted); font-weight: 400; }
.qty.low { color: var(--amber); }
.qty.out { color: var(--danger); }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.tag.low { background: rgba(255, 196, 120, 0.15); color: var(--amber); }
.tag.out { background: rgba(255, 122, 122, 0.15); color: var(--danger); }
.lowbar { display: block; padding: 12px 16px; border-radius: 12px; background: rgba(255, 196, 120, 0.1); border: 1px solid rgba(255, 196, 120, 0.35); color: var(--amber); font-weight: 600; }
.empty { padding: 40px 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r); }

/* item */
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.item-head p { margin-top: 4px; }
.big-qty { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.big-qty > div:first-child { display: grid; }
.big-qty .qty { font-size: 44px; }
.facts { display: grid; gap: 4px; color: var(--muted); text-align: right; }
.facts b { color: var(--text); font-weight: 600; }

.move { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.hist .move:first-child { border-top: 0; }
.move-main { display: grid; gap: 1px; min-width: 0; }
.move-side { display: grid; justify-items: end; gap: 4px; flex: none; }
.move .neg { color: var(--text); }
.move .pos { color: var(--green); }
.move.voided .move-main b, .move.voided .move-side b { text-decoration: line-through; opacity: 0.5; }
#act-list > .move { padding: 12px 14px; margin-top: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.day { font-size: 14px; color: var(--muted); font-family: var(--font); font-weight: 600; margin: 16px 2px 4px; }

.job summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.job summary::-webkit-details-marker { display: none; }
.job summary div { display: grid; }
.job + .job { margin-top: 8px; }
.job ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.job li { display: flex; justify-content: space-between; gap: 10px; }

/* use / receive lines */
.picklist { display: grid; gap: 6px; }
.picklist button { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: 16px var(--font); text-align: left; cursor: pointer; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 40px; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
#lines .line:first-child { border-top: 0; }
.line-name { display: grid; min-width: 0; }
.line-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-qty { display: flex; align-items: center; gap: 6px; }
.line-qty input { width: 86px; text-align: right; }
.icon-x { width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }

/* sheet */
.sheet { width: min(560px, 100vw); max-width: 100vw; margin: auto auto 0; padding: 0; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.7); }
.sheet-body { display: grid; gap: 14px; padding: 20px var(--gut) calc(env(safe-area-inset-bottom) + 16px); }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 20px; border-bottom: 1px solid var(--line-strong); } }
.scanner { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #000; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 22% 14%; border: 2px solid var(--green); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }

/* sign in */
.login { padding-top: 40px; }

/* labels */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(2in, 1fr)); gap: 10px; }
.label { display: flex; gap: 10px; align-items: center; height: 1.25in; padding: 8px; background: #fff; color: #111; border-radius: 6px; break-inside: avoid; }
.label svg { width: 1in; height: 1in; flex: none; }
.label div { display: grid; gap: 4px; min-width: 0; font-size: 12px; line-height: 1.2; }
.label span { font-family: ui-monospace, monospace; font-size: 10px; color: #555; word-break: break-all; }
@media print {
  body { background: #fff; }
  .topbar, .tabs, .no-print, .toast, .intro { display: none !important; }
  main { padding: 0; }
  .page { padding: 0; max-width: none; }
  .labels { grid-template-columns: repeat(3, 2.4in); gap: 0.12in; }
  .label { border: 1px dashed #bbb; border-radius: 0; }
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + var(--tabs-h) + 18px); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 12px;
  background: #F5F6F7; color: #0C0D10; font-weight: 600; text-align: center;
  transition: opacity 0.2s, transform 0.2s; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .line { grid-template-columns: minmax(0, 1fr) 40px; }
  .line .line-qty { grid-column: 1; }
  .line .icon-x { grid-column: 2; grid-row: 1; }
  .facts { text-align: left; }
}
