/* Society Inventory — same palette and components as the Society Staff app. */
:root {
  --bg: #0A0A0A;
  --surface: #151515;
  --surface-2: #1E1E1E;
  --line: #2A2A2A;
  --text: #F4F1EA;       /* site cream */
  --muted: #9A968E;
  --accent: #39FF6A;     /* site neon green */
  --accent-ink: #062B10;
  --warn: #FF8A65;
  --navy: #12305C;
  --radius: 14px;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --font-logo: 'Permanent Marker', cursive;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
p, h1, h2, h3 { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 720px; margin: 0 auto; min-height: 100dvh; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; background: rgba(10,10,10,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 6px; }
.logo { font-family: var(--font-logo); font-size: 24px; line-height: 1; }
.logo.big { font-size: 52px; }
.brand-sub { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.sync { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.sync.busy { color: var(--text); }
.sync.ok { color: var(--accent); }
.sync.bad { background: rgba(255,138,101,.15); color: var(--warn); }

.offline-bar { background: var(--navy); color: var(--text); font-size: 12.5px; line-height: 1.4; padding: 8px 16px; text-align: center; }

/* ---------- layout ---------- */
.view { padding: 16px 16px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.pad { padding: 4px 2px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.title { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-top: 10px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title-row .title { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.warn { color: var(--warn); }
.good { color: var(--accent); }
.empty { color: var(--muted); font-size: 14px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }

/* ---------- cards / kpis ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.card-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi-num { font-size: 24px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi-num.dim { color: var(--muted); font-size: 20px; }
.next { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.next .eyebrow, .next .muted { color: var(--accent-ink); opacity: .8; }
.notice { background: var(--navy); border-color: var(--navy); }
.notice .muted { color: var(--text); opacity: .75; }
@media (min-width: 700px) { .kpis.four { grid-template-columns: repeat(4, 1fr); } }

/* ---------- segmented control / chips ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; align-self: flex-start; max-width: 100%; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg.full { display: flex; align-self: stretch; }
.seg.full button { flex: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips b { font-weight: 700; opacity: .7; margin-left: 4px; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row[role="button"] { cursor: pointer; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.grow p { overflow-wrap: anywhere; }
.name { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: 1px; }
.tag.low { background: rgba(255,138,101,.15); color: var(--warn); }

/* ---------- count list ---------- */
.count-chip { flex: none; min-width: 56px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); text-align: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.count-chip.blank { color: var(--muted); }
.row.dirty .count-chip { border-color: var(--muted); }
.row.saved .count-chip { border-color: var(--accent); }

/* ---------- count pad ---------- */
.pad-card { display: flex; flex-direction: column; gap: 4px; touch-action: pan-y; }
.pad-card.in-right { animation: in-right .18s ease-out; }
.pad-card.in-left { animation: in-left .18s ease-out; }
@keyframes in-right { from { opacity: 0; transform: translateX(28px); } }
@keyframes in-left { from { opacity: 0; transform: translateX(-28px); } }
.pad-name { font-size: 22px; font-weight: 700; line-height: 1.15; }
.pad-entry { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; margin-top: 8px; }
.pad-entry button { border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 26px; }
#padInput { text-align: center; font-size: 34px; font-weight: 700; padding: 10px; font-variant-numeric: tabular-nums; caret-color: var(--accent); border-color: var(--accent); }
#padInput.bad { border-color: var(--warn); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; touch-action: manipulation; }
.keypad button { height: 54px; border-radius: 12px; border: 0; background: var(--surface-2); font-size: 24px; font-weight: 600; -webkit-user-select: none; user-select: none; }
.keypad button:active, .pad-entry button:active { background: var(--line); }
.pad-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.pad-nav .btn { padding: 13px 10px; }

/* ---------- item picker ---------- */
.picker-results { display: flex; flex-direction: column; }
.picker-results:empty { display: none; }
.picker-results button { text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 11px 2px; display: flex; justify-content: space-between; gap: 10px; }
.picker-results button:first-child { border-top: 0; }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.figs > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.figs b { font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- invoice scan ---------- */
.scan-cta { cursor: pointer; }
.scan-cta .btn.ghost { flex: none; }
.scan-cta:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.scan-wait { align-items: center; text-align: center; padding: 32px 14px; }
.scan-line { gap: 10px; }
.scan-line.unsure { border-color: var(--warn); }
.scan-line.unmatched { border-color: var(--warn); border-style: dashed; }
.scan-line.skipped { opacity: .5; }
.scan-line .title-row { align-items: flex-start; }
.scan-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.scan-qty { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: end; }
.scan-qty input { padding: 10px; font-weight: 700; }
.scan-qty p { padding-bottom: 12px; }
.scan-foot { position: sticky; bottom: calc(70px + var(--safe-b)); padding-top: 6px; }
label.inline.small { font-size: 13px; }

/* ---------- buttons ---------- */
.btn { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 10px 16px; border-radius: 999px; font-size: 14px; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--warn); color: #1a0a05; }
.btn.wide { width: 100%; padding: 13px 16px; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.link:hover { color: var(--text); }
.icon-btn { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--muted); font-size: 20px; line-height: 1; }
.actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- bottom tabs ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; background: rgba(10,10,10,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabs button { position: relative; flex: 1; max-width: 112px; border: 0; background: none; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--text); }
.tabs button[aria-current="page"] svg { stroke: var(--accent); }

/* ---------- forms / dialog ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
label.inline input { width: 20px; height: 20px; accent-color: var(--accent); }
input, select, textarea { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 16px; /* 16px stops iOS zoom-on-focus */ }
input[type="search"] { -webkit-appearance: none; }

dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 560px; width: 100%; margin: auto auto 0; max-height: 92dvh; }
dialog::backdrop { background: rgba(0,0,0,.65); }
.sheet { background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; gap: 12px; }
.sheet-head h2 { font-size: 18px; }
.sheet-body { padding: 8px 16px calc(24px + var(--safe-b)); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 700px) {
  dialog { margin: auto; }
  .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); }
}

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 32px 20px calc(32px + var(--safe-b)); max-width: 420px; margin: 0 auto; }
.login-brand { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.login h1 { font-size: 22px; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; transition: .2s; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--warn); color: #1a0a05; }
