/* HMC Store App — styles
   Palette pulled from the sign-in photo: dusk teal + warm shop-light amber on receipt paper. */
:root {
  --ink: #0d2224;
  --ink-2: #153337;
  --ink-3: #1f4a4c;
  --paper: #f4efe5;
  --paper-2: #ebe3d4;
  --card: #fffcf6;
  --line: #e2d8c6;
  --line-2: #d3c7b1;
  --text: #182728;
  --muted: #6c7974;
  --amber: #e9a83f;
  --amber-2: #f4c46f;
  --amber-d: #b9791f;
  --green: #2d7a58;
  --green-bg: #e3f1e8;
  --red: #c0473a;
  --red-bg: #f9e4df;
  --warn: #9a6410;
  --warn-bg: #fbeccd;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(13, 34, 36, .04), 0 8px 24px -12px rgba(13, 34, 36, .18);
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
  line-height: 1.4;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 1.2em; height: 1.2em; flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.mono { font-family: var(--mono); }
body:not(.is-admin) .admin-only { display: none !important; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid transparent; border-radius: 12px;
  padding: .72em 1.1em; min-height: 46px;
  font-weight: 700; font-size: 15px; letter-spacing: .01em;
  transition: transform .12s ease, background-color .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-amber { background: var(--amber); color: var(--ink); box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.btn-amber:hover:not(:disabled) { background: var(--amber-2); }
.btn-ink { background: var(--ink); color: #f8f1e2; }
.btn-ink:hover { background: var(--ink-3); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-ghost-light { background: rgba(255,255,255,.08); color: #f8f1e2; border-color: rgba(255,255,255,.2); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #f4d2cb; }
.btn-block { width: 100%; }
.btn-xl { min-height: 58px; font-size: 18px; border-radius: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line-2); background: transparent; color: inherit;
}
.icon-btn:hover { background: var(--paper-2); }
.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--amber-d); font-weight: 700; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }

input, select {
  width: 100%; min-height: 48px; padding: 10px 14px;
  background: #fff; border: 1.5px solid var(--line-2); border-radius: 12px;
  font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--ink-3); box-shadow: 0 0 0 4px rgba(233,168,63,.25); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline: none; }

/* =========================================================
   SIGN IN
   ========================================================= */
.signin {
  position: fixed; inset: 0; overflow: auto;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 420px);
  align-items: center; gap: clamp(24px, 5vw, 80px);
  padding: calc(32px + var(--safe-t)) clamp(20px, 6vw, 96px) calc(32px + var(--safe-b));
  color: #f6efe1; background: var(--ink);
}
.signin-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    linear-gradient(100deg, rgba(9,25,27,.96) 0%, rgba(9,25,27,.82) 34%, rgba(9,25,27,.35) 62%, rgba(9,25,27,.55) 100%),
    url("/.netlify/images?url=/img/store-bg.png&w=1600&fm=webp&q=70") center right / cover no-repeat;
  transform: scale(1.06);
  animation: bgIn 2.4s cubic-bezier(.2,.7,.1,1) forwards;
}
@keyframes bgIn { to { transform: scale(1); } }
.signin-grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .14; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.signin-brand, .pin-card { position: relative; z-index: 1; }
.eyebrow {
  margin: 0 0 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--amber-2); opacity: 0; animation: rise .7s .15s forwards;
}
.wordmark {
  margin: 0; font-weight: 800; line-height: .82; letter-spacing: -.045em;
  font-size: clamp(76px, 15vw, 210px);
  font-variation-settings: "opsz" 96;
}
.wm-line { display: block; opacity: 0; transform: translateY(30px); animation: rise .9s cubic-bezier(.2,.7,.1,1) forwards; }
.wm-1 { color: var(--amber); animation-delay: .25s; }
.wm-2 { color: #f6efe1; animation-delay: .38s; padding-left: .32em; }
.wm-3 { color: transparent; -webkit-text-stroke: 2px rgba(246,239,225,.75); animation-delay: .51s; padding-left: .64em; }
.signin-tag { max-width: 30ch; margin: 28px 0 0; font-size: clamp(16px, 1.5vw, 19px); color: rgba(246,239,225,.78); opacity: 0; animation: rise .8s .7s forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

.pin-card {
  background: rgba(13, 34, 36, .62);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(246, 239, 225, .14);
  border-radius: 26px; padding: 26px 24px 20px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(24px); animation: rise .9s .45s cubic-bezier(.2,.7,.1,1) forwards;
}
.pin-head { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.pin-head h2 { margin: 0; font-size: 22px; }
.pin-head p { margin: 2px 0 0; color: rgba(246,239,225,.65); font-size: 14px; }
.pin-badge { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--amber); color: var(--ink); }
.pin-badge svg { width: 24px; height: 24px; }
.pin-hidden { position: absolute; opacity: 0; pointer-events: none; height: 1px; width: 1px; min-height: 0; padding: 0; border: 0; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 4px 0 8px; }
.pin-dots i {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(246,239,225,.45);
  transition: background-color .15s, transform .15s, border-color .15s;
}
.pin-dots i.on { background: var(--amber); border-color: var(--amber); transform: scale(1.12); }
.pin-dots.shake { animation: shake .42s; }
@keyframes shake { 20%,60% { transform: translateX(-9px); } 40%,80% { transform: translateX(9px); } }
.pin-err { min-height: 22px; margin: 6px 0 10px; text-align: center; color: #ffb4a5; font-size: 14px; font-weight: 600; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.pin-pad button {
  height: 60px; border-radius: 16px; border: 1px solid rgba(246,239,225,.12);
  background: rgba(246,239,225,.07); color: #f6efe1;
  font-family: var(--mono); font-size: 24px; font-weight: 700;
  display: grid; place-items: center; transition: background-color .12s, transform .08s;
}
.pin-pad button:hover { background: rgba(246,239,225,.14); }
.pin-pad button:active { transform: scale(.96); background: rgba(233,168,63,.3); }
.pin-pad .pad-soft { font-family: var(--font); font-size: 15px; color: rgba(246,239,225,.7); }
.pin-pad .pad-soft svg { width: 26px; height: 26px; }
.pin-foot { margin: 14px 0 0; text-align: center; font-size: 13px; color: rgba(246,239,225,.55); }

@media (max-width: 860px) {
  .signin { grid-template-columns: 1fr; align-content: start; gap: 28px; }
  .signin-bg { background:
    linear-gradient(180deg, rgba(9,25,27,.55) 0%, rgba(9,25,27,.78) 40%, rgba(9,25,27,.97) 75%),
    url("/.netlify/images?url=/img/store-bg.png&w=1000&fm=webp&q=65") 70% center / cover no-repeat; }
  .wordmark { font-size: clamp(64px, 22vw, 130px); }
  .signin-tag { margin-top: 18px; }
  .pin-card { max-width: 440px; width: 100%; justify-self: center; }
}

/* =========================================================
   APP SHELL
   ========================================================= */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: calc(10px + var(--safe-t)) clamp(14px, 3vw, 32px) 10px;
  background: var(--ink); color: #f6efe1;
  box-shadow: 0 10px 30px -18px rgba(0,0,0,.6);
}
.brand-mini { display: flex; align-items: center; gap: 10px; }
.brand-chip {
  display: grid; place-items: center; height: 38px; padding: 0 10px; border-radius: 10px;
  background: var(--amber); color: var(--ink); font-weight: 800; letter-spacing: -.02em; font-size: 18px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 17px; }
.brand-text span { font-family: var(--mono); font-size: 11px; color: rgba(246,239,225,.6); letter-spacing: .04em; }

.tabs { display: flex; gap: 4px; margin: 0 auto; padding: 4px; background: rgba(246,239,225,.06); border-radius: 14px; }
.tabs button {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 0; border-radius: 10px; background: transparent; color: rgba(246,239,225,.7);
  font-weight: 600; font-size: 15px; transition: background-color .15s, color .15s;
}
.tabs button:hover { color: #fff; }
.tabs button[aria-selected="true"] { background: var(--amber); color: var(--ink); }
.tab-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #ff8a6e; box-shadow: 0 0 0 2px var(--ink); }
.tabs button[aria-selected="true"] .tab-dot { box-shadow: 0 0 0 2px var(--amber); }
.tab-count {
  font-style: normal; font-family: var(--mono); font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: inline-grid; place-items: center;
  background: #f6efe1; color: var(--ink);
}
.who { display: flex; align-items: center; gap: 10px; }
.who-chip {
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(246,239,225,.25);
}
.who-chip.admin { border-color: var(--amber); color: var(--amber-2); }
.who .icon-btn { border-color: rgba(246,239,225,.2); color: #f6efe1; }
.who .icon-btn:hover { background: rgba(246,239,225,.1); }

.panels { max-width: 1240px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) clamp(14px, 3vw, 32px) 120px; }
.panel { animation: panelIn .35s cubic-bezier(.2,.7,.1,1); }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-title { margin: 0; font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.panel-title span { display: block; margin-top: 8px; font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); }

@media (max-width: 760px) {
  .topbar { gap: 10px; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; margin: 0; border-radius: 0;
    padding: 6px 6px calc(6px + var(--safe-b)); background: var(--ink); justify-content: space-around;
    box-shadow: 0 -10px 30px -15px rgba(0,0,0,.5);
  }
  .tabs button { flex: 1; flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 12px; }
  .tabs button svg { width: 22px; height: 22px; }
  .tab-count { position: absolute; top: 3px; right: calc(50% - 26px); }
  .tab-dot { right: calc(50% - 18px); }
  .who { margin-left: auto; }
  .brand-text span { display: none; }
}

/* ---------------- cards / kpis ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.kpi span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kpi b { display: block; margin-top: 6px; font-family: var(--mono); font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; letter-spacing: -.02em; }
.kpi small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.kpi.hero { background: var(--ink); color: #f6efe1; border-color: var(--ink); }
.kpi.hero span, .kpi.hero small { color: rgba(246,239,225,.65); }
.kpi.hero b { color: var(--amber-2); }
.kpi.good b { color: var(--green); }
.kpi.warn b { color: var(--red); }
.kpi.click { cursor: pointer; }
.kpi.click:hover { border-color: var(--line-2); }

/* ---------------- search bar ---------------- */
.searchbar {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 2px solid var(--ink); border-radius: 18px; padding: 6px 6px 6px 50px;
  box-shadow: 6px 6px 0 var(--ink);
}
.searchbar input { border: 0; min-height: 52px; padding: 0; font-size: 19px; font-weight: 500; box-shadow: none; background: transparent; }
.searchbar input:focus { box-shadow: none; }
.searchbar .sb-icon { position: absolute; left: 18px; width: 22px; height: 22px; color: var(--muted); }
.searchbar.small { border-width: 1.5px; border-color: var(--line-2); box-shadow: none; border-radius: 14px; padding: 3px 4px 3px 44px; }
.searchbar.small input { min-height: 42px; font-size: 16px; }
.searchbar.small .sb-icon { left: 14px; width: 19px; height: 19px; }
.searchbar.small:focus-within { border-color: var(--ink-3); }

/* ---------------- FIND ---------------- */
.find-hero { display: grid; gap: 18px; margin-bottom: 22px; max-width: 760px; }
.find-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.price-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px;
  box-shadow: var(--shadow); animation: panelIn .3s both;
}
.price-card::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 8px;
  background: radial-gradient(circle at 6px -2px, var(--paper) 5px, transparent 5.5px) 0 0 / 14px 8px repeat-x;
}
.price-card.top { grid-column: 1 / -1; border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--amber); }
.pc-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.price-card.top .pc-name { font-size: clamp(22px, 3vw, 30px); }
.pc-price { font-family: var(--mono); font-weight: 800; font-size: 34px; letter-spacing: -.03em; color: var(--ink); line-height: 1; }
.price-card.top .pc-price { font-size: clamp(48px, 8vw, 84px); }
.pc-price small { font-size: .45em; color: var(--muted); font-weight: 700; margin-right: 2px; vertical-align: .55em; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; color: var(--muted); }
.pc-meta .mono { color: var(--text); }
.pc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.pc-actions .btn { min-height: 40px; padding: .5em .9em; font-size: 14px; }
.kw { display: flex; flex-wrap: wrap; gap: 5px; }
.kw span { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--paper-2); color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--green-bg); color: var(--green);
}
.badge.low { background: var(--warn-bg); color: var(--warn); }
.badge.out { background: var(--red-bg); color: var(--red); }

.empty {
  grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 48px 20px; border: 2px dashed var(--line-2); border-radius: var(--radius); color: var(--muted);
}
.empty svg { width: 40px; height: 40px; color: var(--line-2); }
.empty b { color: var(--text); font-size: 18px; }
.empty p { margin: 0; max-width: 40ch; }

.skeleton { height: 140px; border-radius: var(--radius); background: linear-gradient(90deg, var(--paper-2), #f7f2e9, var(--paper-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------------- INVENTORY ---------------- */
.inv-tools { display: grid; grid-template-columns: 1fr auto 180px; gap: 10px; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.inv-list { display: grid; gap: 8px; }
.inv-row {
  display: grid; grid-template-columns: minmax(0, 2.4fr) 110px 110px 110px 92px auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  transition: border-color .15s, transform .15s;
}
.inv-row:hover { border-color: var(--line-2); }
.inv-row.is-low { border-left: 4px solid var(--amber); }
.inv-row.is-out { border-left: 4px solid var(--red); }
.inv-head { background: transparent; border: 0; padding: 0 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.inv-head:hover { border: 0; }
.inv-name b { display: block; font-size: 16px; line-height: 1.25; }
.inv-name small { display: block; margin-top: 2px; font-family: var(--mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-num { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.inv-num small { display: block; font-family: var(--font); font-weight: 500; font-size: 11px; color: var(--muted); }
.inv-qty { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.inv-qty b { font-family: var(--mono); font-size: 20px; }
.inv-acts { display: flex; gap: 6px; justify-content: flex-end; }
.inv-acts .icon-btn { width: 38px; height: 38px; }
.inv-acts .icon-btn.danger { color: var(--red); border-color: #efc6bf; }
.inv-acts .icon-btn.danger:hover { background: var(--red-bg); }
.lbl-m { display: none; }

@media (max-width: 860px) {
  .inv-tools { grid-template-columns: 1fr auto; }
  .inv-tools select { grid-column: 1 / -1; }
  .inv-head { display: none; }
  .inv-row { grid-template-columns: 1fr auto; grid-template-areas: "name qty" "nums nums" "acts acts"; gap: 10px; }
  .inv-name { grid-area: name; }
  .inv-qty { grid-area: qty; align-items: flex-end; }
  .inv-nums { grid-area: nums; display: flex; gap: 18px; }
  .inv-acts { grid-area: acts; justify-content: flex-start; }
  .lbl-m { display: block; }
}
@media (min-width: 861px) { .inv-nums { display: contents; } }

/* ---------------- SALES ---------------- */
.sales-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.legend { display: flex; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -8px; }
.lg-sales { background: var(--ink-3); }
.lg-profit { background: var(--amber); }
.chart { height: 240px; display: flex; align-items: stretch; gap: 4px; padding-top: 10px; position: relative; }
.chart .bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; position: relative; }
.chart .bar { width: 100%; max-width: 46px; position: relative; border-radius: 6px 6px 2px 2px; background: var(--ink-3); transform-origin: bottom; animation: grow .6s cubic-bezier(.2,.7,.1,1) both; }
.chart .bar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--amber); border-radius: 0 0 2px 2px; }
.chart .bar-col:hover .bar { background: var(--ink); }
.chart .bar-lbl { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
.chart .tip {
  position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%); z-index: 2;
  background: var(--ink); color: #f6efe1; border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.chart .bar-col:hover .tip { opacity: 1; }
@keyframes grow { from { transform: scaleY(0); } }
.chart-empty { display: grid; place-items: center; height: 100%; width: 100%; color: var(--muted); }

.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: t; }
.top-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; counter-increment: t; }
.top-list li::before { content: counter(t); font-family: var(--mono); font-weight: 800; color: var(--amber-d); }
.top-list .tl-name { font-weight: 600; line-height: 1.2; }
.top-list .tl-bar { height: 5px; border-radius: 3px; background: var(--paper-2); margin-top: 5px; overflow: hidden; }
.top-list .tl-bar i { display: block; height: 100%; background: var(--amber); border-radius: 3px; }
.top-list .tl-num { font-family: var(--mono); font-size: 13px; text-align: right; }
.top-list .tl-num small { display: block; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; font-family: var(--mono); }
tbody tr { cursor: pointer; transition: background-color .12s; }
tbody tr:hover, tbody tr.sel { background: var(--paper); }
td.profit { color: var(--green); font-weight: 700; }

.receipts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rcpt {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 13px;
  font-family: var(--mono); position: relative;
}
.rcpt.void { opacity: .55; }
.rcpt.void::after { content: "VOID"; position: absolute; top: 14px; right: 14px; color: var(--red); font-weight: 800; letter-spacing: .1em; border: 2px solid var(--red); padding: 1px 6px; border-radius: 4px; transform: rotate(-6deg); }
.rcpt-head { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--line-2); }
.rcpt-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 3px 0; }
.rcpt-line span:first-child { font-family: var(--font); }
.rcpt-tot { display: flex; justify-content: space-between; font-weight: 800; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.rcpt-sub { display: flex; justify-content: space-between; color: var(--muted); }
.rcpt .btn { margin-top: 10px; min-height: 36px; font-size: 13px; padding: .4em .8em; font-family: var(--font); }

@media (max-width: 860px) { .sales-grid { grid-template-columns: 1fr; } .chart { height: 200px; } }

/* ---------------- KIOSK ---------------- */
.kiosk { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 22px; align-items: start; }
.kiosk-left { display: grid; gap: 14px; min-width: 0; }
.kiosk-left .panel-title { margin-bottom: 4px; }
.scanline {
  position: relative; display: flex; gap: 8px; align-items: center;
  background: #fff; border: 2px solid var(--ink); border-radius: 18px; padding: 6px 6px 6px 50px; box-shadow: 6px 6px 0 var(--amber);
}
.scanline input { border: 0; min-height: 56px; padding: 0; font-size: 20px; font-family: var(--mono); font-weight: 700; box-shadow: none; background: transparent; }
.scanline input:focus { box-shadow: none; }
.scanline input::placeholder { font-family: var(--font); font-weight: 500; }
.scanline .sb-icon { position: absolute; left: 16px; width: 24px; height: 24px; color: var(--ink-3); }
.scanline.ready .sb-icon { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }

.kiosk-cam { position: relative; border-radius: 18px; overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; max-height: 340px; }
.kiosk-cam video, .scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-reticle { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cam-reticle span {
  width: min(78%, 420px); height: 44%; border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(9,25,27,.45); border: 2px solid rgba(246,239,225,.85);
  position: relative; overflow: hidden;
}
.cam-reticle span::after { content: ""; position: absolute; left: 6%; right: 6%; height: 2px; top: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: sweep 2s ease-in-out infinite; }
@keyframes sweep { 0%,100% { transform: translateY(-40px); } 50% { transform: translateY(40px); } }
.cam-status { position: absolute; left: 12px; bottom: 12px; right: 12px; color: #f6efe1; font-size: 14px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.cam-flash { position: absolute; inset: 0; background: var(--amber); opacity: 0; pointer-events: none; }
.cam-flash.go { animation: flash .35s; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }

.kiosk-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.k-item {
  text-align: left; display: grid; gap: 6px; padding: 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); transition: border-color .12s, transform .1s, box-shadow .12s;
}
.k-item:hover { border-color: var(--ink-3); box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
.k-item:active { transform: none; box-shadow: none; }
.k-item b { font-size: 15px; line-height: 1.25; }
.k-item .k-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.k-item .k-price { font-family: var(--mono); font-weight: 800; font-size: 18px; }
.k-item:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.k-section { grid-column: 1 / -1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 4px; }

.cart {
  position: sticky; top: 84px;
  display: flex; flex-direction: column; max-height: calc(100vh - 110px);
  background: #fffdf9; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.cart::before { content: ""; height: 8px; background: radial-gradient(circle at 7px 9px, var(--paper) 5px, transparent 5.5px) 0 0 / 14px 8px repeat-x; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 12px; border-bottom: 1px dashed var(--line-2); }
.cart-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; }
.cart-head h3 .muted { font-weight: 500; font-size: 14px; }
.cart-list { list-style: none; margin: 0; padding: 6px 10px; overflow-y: auto; flex: 1; min-height: 140px; }
.cart-line {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center;
  padding: 10px 8px; border-bottom: 1px solid var(--paper-2); animation: lineIn .3s cubic-bezier(.2,.7,.1,1);
}
.cart-line.bump { animation: bump .35s; }
@keyframes lineIn { from { opacity: 0; transform: translateX(14px); } }
@keyframes bump { 40% { background: #fbefd6; } }
.cl-name { font-weight: 600; line-height: 1.25; font-size: 15px; }
.cl-name small { display: block; font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--muted); margin-top: 2px; }
.cl-total { font-family: var(--mono); font-weight: 800; text-align: right; }
.cl-ctrl { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.qty-step { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.qty-step button { width: 36px; height: 34px; border: 0; background: transparent; display: grid; place-items: center; }
.qty-step button:hover { background: var(--paper-2); }
.qty-step input { width: 48px; min-height: 34px; padding: 0; border: 0; border-radius: 0; text-align: center; font-family: var(--mono); font-weight: 800; -moz-appearance: textfield; }
.qty-step input::-webkit-inner-spin-button { -webkit-appearance: none; }
.cl-remove { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.cl-remove:hover { color: var(--red); background: var(--red-bg); }
.cart-empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.cart-empty svg { width: 46px; height: 46px; color: var(--line-2); display: block; margin: 0 auto 10px; }
.cart-foot { padding: 14px 18px 18px; border-top: 2px solid var(--ink); background: var(--card); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.cart-total span { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; color: var(--muted); }
.cart-total b { font-family: var(--mono); font-size: 34px; letter-spacing: -.03em; }

@media (max-width: 960px) {
  .kiosk { grid-template-columns: 1fr; }
  .cart { position: static; max-height: none; overflow: visible; }
  .cart-foot { border-radius: 0 0 20px 20px; }
  .cart-foot {
    position: sticky; bottom: calc(66px + var(--safe-b));
    box-shadow: 0 -10px 24px -16px rgba(0,0,0,.35);
  }
}
@media (min-width: 761px) and (max-width: 960px) { .cart-foot { bottom: 0; } }

/* =========================================================
   DIALOGS
   ========================================================= */
.dlg {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 22px; background: var(--card); color: var(--text);
  box-shadow: 0 40px 100px -30px rgba(9,25,27,.65); overflow: hidden;
}
.dlg[open] { animation: dlgIn .28s cubic-bezier(.2,.7,.1,1); display: flex; flex-direction: column; }
.dlg > form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.dlg::backdrop { background: rgba(9,25,27,.6); backdrop-filter: blur(3px); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.dlg-sm { width: min(440px, calc(100vw - 24px)); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.dlg-head h3 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.dlg-head.dark { background: var(--ink); color: #f6efe1; padding-bottom: 18px; }
.dlg-head.dark .icon-btn { color: #f6efe1; border-color: rgba(246,239,225,.25); }
.dlg-body { padding: 6px 20px 14px; overflow-y: auto; }
.dlg-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); background: #fbf7ef; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
.field small { color: var(--muted); font-size: 12px; }
.full { grid-column: 1 / -1; }
.input-row { display: flex; gap: 8px; }
.input-row input { font-family: var(--mono); }
.form-err { color: var(--red); font-weight: 600; font-size: 14px; margin: 0; min-height: 1em; }
.margin-strip {
  display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center;
  padding: 10px 14px; border-radius: 12px; background: var(--paper); font-size: 14px;
}
.margin-strip b { font-family: var(--mono); }
.margin-strip .pos { color: var(--green); }
.margin-strip .neg { color: var(--red); }

.stepper { display: flex; align-items: stretch; border: 1.5px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 48px; border: 0; background: var(--paper); display: grid; place-items: center; }
.stepper button:hover { background: var(--paper-2); }
.stepper input { border: 0; border-radius: 0; text-align: center; font-family: var(--mono); font-weight: 800; font-size: 18px; -moz-appearance: textfield; }
.stepper input:focus { box-shadow: none; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper.big input { font-size: 28px; min-height: 64px; }
.stepper.big button { width: 64px; }
.stock-name { font-size: 18px; font-weight: 700; margin: 0 0 2px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 6px; }
.chips button { border: 1.5px solid var(--line-2); background: #fff; border-radius: 999px; padding: 6px 14px; font-family: var(--mono); font-weight: 700; }
.chips button:hover { border-color: var(--ink-3); }
.confirm-title { margin: 14px 0 6px; font-size: 20px; }

.dlg-scan { background: var(--ink); color: #f6efe1; width: min(560px, calc(100vw - 24px)); }
.scan-stage { position: relative; aspect-ratio: 4 / 3; background: #071415; }
.scan-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px calc(18px + var(--safe-b)); flex-wrap: wrap; }
.scan-foot p { margin: 0; font-weight: 600; }

/* checkout */
.dlg-pay { width: min(980px, calc(100vw - 16px)); overflow-y: auto; }
.dlg-pay[open] { display: block; }
.dlg-pay .dlg-foot { position: sticky; bottom: 0; }
.pay-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 20px; padding: 4px 20px 10px; overflow-y: auto; }
.pay-total { background: var(--ink); color: #f6efe1; border-radius: 18px; padding: 16px 18px; }
.pay-total span { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: rgba(246,239,225,.6); font-weight: 700; }
.pay-total b { display: block; font-family: var(--mono); font-size: clamp(38px, 6vw, 54px); color: var(--amber-2); letter-spacing: -.03em; line-height: 1.1; }
.pay-total small { color: rgba(246,239,225,.6); }
.tender { margin-top: 14px; }
.tender-row { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.tender-amt {
  display: block; margin-top: 6px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--ink);
  background: #fff; font-family: var(--mono); font-size: 36px; font-weight: 800; text-align: right; letter-spacing: -.02em;
}
.change { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; padding: 12px 16px; border-radius: 14px; background: var(--paper); }
.change span { font-weight: 700; text-transform: uppercase; font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.change b { font-family: var(--mono); font-size: 34px; letter-spacing: -.02em; }
.change.ok { background: var(--green-bg); }
.change.ok b { color: var(--green); }
.change.short { background: var(--red-bg); }
.change.short b { color: var(--red); }
.breakdown { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 30px; }
.breakdown.center { justify-content: center; }
.breakdown span {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px; font-family: var(--mono); font-size: 13px; font-weight: 700;
  background: #fff; border: 1px solid var(--line-2);
}
.breakdown span.coin { border-radius: 999px; background: #f6ecd7; }
.breakdown span em { font-style: normal; color: var(--muted); font-weight: 500; }
.pay-sub { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.denoms { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.denom {
  position: relative; min-height: 54px; border-radius: 10px; border: 0; font-family: var(--mono); font-weight: 800; font-size: 16px;
  color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); transition: transform .08s;
}
.denom:active { transform: scale(.95); }
.denom.coin { border-radius: 999px; aspect-ratio: auto; background: radial-gradient(circle at 35% 30%, #f5e2b3, #c9a45a); color: #4a3510; }
.denom.coin.silver { background: radial-gradient(circle at 35% 30%, #f1f1ee, #a8aca7); color: #2f3433; }
.denom .cnt {
  position: absolute; top: -7px; right: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: var(--ink); color: var(--amber-2); font-size: 12px; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--card);
}
.calc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.calc button {
  min-height: 52px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff;
  font-family: var(--mono); font-size: 20px; font-weight: 700; display: grid; place-items: center;
}
.calc button:hover { background: var(--paper); }
.calc button:active { transform: scale(.97); background: var(--paper-2); }
.calc .calc-soft { font-family: var(--font); font-size: 15px; background: var(--paper); }
.calc .span-2 { grid-column: span 2; }

.paid { padding: 34px 26px calc(26px + var(--safe-b)); text-align: center; display: grid; gap: 10px; justify-items: center; }
.paid h3 { margin: 6px 0 0; font-size: 28px; letter-spacing: -.02em; }
.paid p { margin: 0; }
.paid-seal { width: 82px; height: 82px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.paid-seal svg { width: 42px; height: 42px; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.paid-change { margin-top: 10px; padding: 14px 30px; border-radius: 18px; background: var(--ink); color: #f6efe1; }
.paid-change span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; opacity: .65; font-weight: 700; }
.paid-change b { font-family: var(--mono); font-size: 48px; color: var(--amber-2); letter-spacing: -.03em; }
.paid-sum { display: flex; gap: 30px; margin: 6px 0 12px; }
.paid-sum dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.paid-sum dd { margin: 0; font-family: var(--mono); font-weight: 800; font-size: 18px; }
.paid .btn { max-width: 360px; }

@media (max-width: 760px) {
  .dlg { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 22px 22px 0 0; margin: auto auto 0; }
  .dlg-pay { height: 100dvh; border-radius: 0; }
  .pay-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .denoms { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .denom { min-height: 46px; font-size: 14px; }
  .calc button { min-height: 46px; }
  .tender-amt { font-size: 30px; }
}
@media (max-width: 420px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------------- toasts ---------------- */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: #f6efe1; font-weight: 600; box-shadow: 0 16px 40px -16px rgba(0,0,0,.5);
  animation: toastIn .3s cubic-bezier(.2,.7,.1,1); pointer-events: auto;
}
.toast svg { color: var(--amber-2); }
.toast.err { background: #6b1f17; }
.toast.err svg { color: #ffb4a5; }
.toast.out { animation: toastOut .25s forwards; }
.toast .btn { min-height: 32px; padding: 4px 10px; font-size: 13px; margin-left: auto; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
