:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #1c1f2e;
  --muted: #6b7280;
  --line: #e6e8f0;
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(20,22,40,.06), 0 6px 24px rgba(20,22,40,.05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Sukhumvit Set", "Noto Sans Thai", sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.5;
}
.hidden { display: none !important; }
/* visually hidden but still triggerable by its <label> (Safari won't open a
   file dialog for a display:none input, so we move it off-screen instead) */
.vis-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #6366f1 0%, #4f46e5 35%, #312e81 100%);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border-radius: 20px; padding: 28px 24px 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.brand { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.brand span { color: var(--primary); }
.login-sub { margin: -6px 0 8px; color: var(--muted); font-size: 14px; }
.login-card label, #add-form label, .search-row label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.login-card input, #add-form input, #add-form select {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfe; color: var(--ink);
}
.login-card input:focus, #add-form input:focus, #add-form select:focus { outline: none; border-color: var(--primary); background: #fff; }

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--primary); color: #fff; border: 0; padding: 13px 16px; border-radius: 12px;
  font-weight: 700; font-size: 15px; transition: background .15s;
}
.btn-primary:active { background: var(--primary-d); }
.btn-primary:disabled { opacity: .6; }
.btn-primary.small { padding: 10px 14px; white-space: nowrap; }
.btn-primary.wide, .btn-ghost.wide { width: 100%; }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 13px;
}
.err { color: var(--red); font-size: 13px; margin: 4px 0 0; }
.msg { font-size: 14px; margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; }
.msg.ok { background: #ecfdf5; color: var(--green); }
.msg.bad { background: #fef2f2; color: var(--red); }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top));
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .shop { font-weight: 800; font-size: 16px; }
.topbar .user { font-size: 12px; color: var(--muted); }
#main { padding: 16px 16px 96px; max-width: 720px; margin: 0 auto; }
.view-title { font-size: 20px; font-weight: 800; margin: 4px 0 16px; }
.section-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 22px 0 10px; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-card.full { grid-column: 1 / -1; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.5px; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); }

.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow);
}
.cat-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.1); }
.cat-name { font-weight: 700; flex: 1; }
.cat-meta { text-align: right; font-size: 13px; }
.cat-count { font-weight: 800; }
.cat-cost { color: var(--muted); font-size: 12px; }

/* ---------- Products ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.chip {
  white-space: nowrap; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.search-row input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.prod-list { display: flex; flex-direction: column; gap: 8px; }
.prod-card { background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.prod-top { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.prod-top:active { opacity: .7; }
.prod-actions { display: flex; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.pa-btn { flex: 1; border: 1px solid var(--line); background: #fbfbfe; color: var(--ink); border-radius: 9px; padding: 9px 0; font-weight: 700; font-size: 13px; }
.pa-btn:active { background: #eef0f8; }
.pa-btn.sell { background: var(--primary); color: #fff; border-color: var(--primary); }
.pa-btn.del { color: var(--red); border-color: #fecaca; flex: 0 0 auto; padding: 9px 16px; }
.pa-btn.save { background: var(--green); color: #fff; border-color: var(--green); flex: 0 0 auto; padding: 9px 16px; }
.pa-price { flex: 1; border: 1px solid var(--primary); border-radius: 9px; padding: 9px 12px; font-size: 16px; background: #fff; }
.pa-price:focus { outline: none; }
.prod-main { flex: 1; min-width: 0; }
.prod-tags { font-size: 11px; color: var(--primary-d); margin-top: 3px; font-weight: 600; }

/* attribute filter */
.prod-filter { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 12px; padding: 4px 0; }
.prod-filter > summary { cursor: pointer; padding: 11px 14px; font-weight: 700; font-size: 13px; color: var(--primary-d); list-style: none; }
.prod-filter > summary::-webkit-details-marker { display: none; }
.prod-filter[open] > summary { border-bottom: 1px solid var(--line); }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px 6px; }
.filter-grid select { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; min-width: 0; }
.filter-foot { display: flex; align-items: center; justify-content: space-between; padding: 4px 14px 12px; }
.filter-count { font-size: 12px; color: var(--muted); font-weight: 700; }
.prod-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.prod-right { text-align: right; }
.prod-cost { font-weight: 800; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; margin-top: 4px; }
.badge.in { background: #ecfdf5; color: var(--green); }
.badge.sold { background: #f3f4f6; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- Add stock ---------- */
#add-form { display: flex; flex-direction: column; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-zone { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-previews:empty { display: none; }
.photo-thumb { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .rm {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; border: 0; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.photo-native { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.photo-native input[type=file] { font-size: 13px; max-width: 100%; }
.photo-hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: center; }
.scan-status {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.scan-status.work { background: #eef2ff; color: var(--primary-d); }
.scan-status.ok { background: #ecfdf5; color: var(--green); }
.scan-status.bad { background: #fef2f2; color: var(--red); }
#rescan-btn { margin-top: 10px; }
.bc-row { display: flex; gap: 8px; }
.bc-row input { flex: 1; }
.bc-row .btn-ghost { flex: 0 0 auto; }
.photo-add {
  display: flex; align-items: center; justify-content: center; margin-top: 10px;
  border: 1.5px dashed #c7cbe0; border-radius: 12px; padding: 18px; color: var(--primary); font-weight: 700;
  width: 100%; background: transparent; font-family: inherit; font-size: 15px; cursor: pointer;
}
.photo-add:active { background: #f5f5ff; }
.photo-previews:empty + .photo-add { margin-top: 0; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600;
  padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.nav-btn .nav-ic { font-size: 19px; line-height: 1; }
.nav-btn.active { color: var(--primary); }
.nav-btn.add { color: var(--primary); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%);
  background: #1c1f2e; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 50; max-width: 90%; text-align: center;
}

/* ---------- scan queue ---------- */
.queue-list { display: flex; flex-direction: column; gap: 12px; }
.qcard { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); overflow: hidden; }
.qcard * { min-width: 0; max-width: 100%; }
.qsaved, .q-msg { overflow-wrap: anywhere; }
.qcard.ready { border: 1.5px solid #c7d2fe; }
.qcard-top { display: flex; align-items: center; gap: 10px; }
.qthumbs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.qthumbs img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.badge.work { background: #eef2ff; color: var(--primary-d); }
.badge.wait { background: #fef9c3; color: #854d0e; }
.badge.ready { background: #ecfdf5; color: var(--green); }
.qdetected { font-size: 12px; color: var(--muted); margin: 10px 0 4px; overflow-wrap: anywhere; word-break: break-word; }
.qdup { background: #fef2f2; color: var(--red); font-size: 12px; font-weight: 700; padding: 8px 10px; border-radius: 8px; margin: 6px 0 2px; }
.qcard.ready:has(.qdup) { border-color: #fecaca; }
.qform { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.qform label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.qform input, .qform select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbfe; font-size: 16px; }
.qform input:focus, .qform select:focus { outline: none; border-color: var(--primary); background: #fff; }
.qactions { display: flex; gap: 8px; margin-top: 12px; }
.qactions .btn-primary { flex: 1; }
.q-msg { font-size: 13px; margin: 8px 0 0; }
.q-msg.bad { color: var(--red); }
.qsaved { color: var(--green); font-weight: 700; font-size: 14px; }
.navbadge {
  position: absolute; top: 4px; right: 50%; transform: translateX(20px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.nav-btn { position: relative; }

/* spinner */
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { text-align: center; color: var(--muted); padding: 30px 0; }

/* ---------- products: scan button ---------- */
.btn-ghost.small { padding: 10px 12px; white-space: nowrap; }
.btn-ghost.small.icon { color: var(--primary); border-color: #c7d2fe; }

/* ---------- monthly chart ---------- */
.month-chart { background: var(--card); border-radius: var(--radius); padding: 16px 14px 12px; box-shadow: var(--shadow); }
.mc-grid { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; height: 84px; }
.mc-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.mc-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.mc-bar { width: 6px; min-height: 2px; border-radius: 3px 3px 0 0; }
.mc-label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.mc-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.mc-leg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; }
.mc-leg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ---------- activity feed ---------- */
.activity-list { display: flex; flex-direction: column; gap: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.act-row { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.act-row:last-child { border-bottom: 0; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; margin-top: 6px; background: var(--muted); }
.act-dot.success { background: var(--green); }
.act-dot.danger { background: var(--red); }
.act-dot.warning { background: #f59e0b; }
.act-dot.info, .act-dot.primary { background: var(--primary); }
.act-body { min-width: 0; flex: 1; }
.act-text { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.act-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------- bottom sheet (product detail) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15,17,30,.5); backdrop-filter: blur(2px); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--card);
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto; box-shadow: 0 -8px 40px rgba(0,0,0,.25);
  animation: sheetup .22s ease; max-width: 720px; margin: 0 auto;
}
@keyframes sheetup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: #d4d7e3; margin: 6px auto 14px; }
.d-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.d-title { font-size: 19px; font-weight: 800; line-height: 1.3; }
.d-head .badge { margin-top: 4px; flex: 0 0 auto; }
.d-cat { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--ink); margin-top: 10px; }
.d-grid { display: flex; flex-direction: column; margin-top: 16px; }
.d-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.d-label { color: var(--muted); font-size: 13px; font-weight: 600; flex: 0 0 auto; }
.d-val { text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.d-actions { display: flex; gap: 10px; margin-top: 18px; }
.d-actions .btn-primary, .d-actions .btn-ghost { flex: 1; }

/* ---------- access-token gate ---------- */
.gate-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfe;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; resize: vertical; word-break: break-all;
}
.gate-input:focus { outline: none; border-color: var(--primary); background: #fff; }

/* ---------- POS (cart sell) ---------- */
.pos-results { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.pos-find-row, .cart-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.pos-find-main, .cart-main { flex: 1; min-width: 0; }
.pos-cart { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; }
.cart-price { width: 96px; flex: 0 0 auto; padding: 9px 10px; border: 1px solid var(--primary); border-radius: 9px; font-size: 16px; text-align: right; background: #fff; }
.cart-price:focus { outline: none; }
.cart-rm { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid #fecaca; background: #fff; color: var(--red); font-size: 15px; }
.pos-bar {
  position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 10px; max-width: 720px; margin: 0 auto;
  background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding: 10px 14px; box-shadow: 0 -6px 24px rgba(20,22,40,.1);
}
.pos-bar-info { display: flex; flex-direction: column; line-height: 1.2; }
.pos-bar-info span { font-size: 11px; color: var(--muted); }
.pos-bar-info strong { font-size: 20px; font-weight: 800; }
.pos-pay { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; }
.pos-bar .btn-primary { flex: 1; }

/* ---------- staff picker / PIN (login + lock) ---------- */
.staff-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.staff-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: #fbfbfe; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 15px; font-weight: 700; color: var(--ink);
}
.staff-btn:active { background: #f0f0fb; }
.staff-av { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 auto; text-transform: uppercase; }
.staff-btn.admin .staff-av { background: #312e81; }
.staff-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-tag { font-size: 11px; font-weight: 700; color: var(--primary); background: #eef2ff; padding: 3px 8px; border-radius: 999px; }
.pin-area { display: flex; flex-direction: column; gap: 12px; }
.pin-who { font-size: 16px; font-weight: 800; text-align: center; }
#login-pin { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfe; text-align: center; font-size: 22px; letter-spacing: 8px; }
#login-pin:focus { outline: none; border-color: var(--primary); background: #fff; }

/* ---------- admin ---------- */
.seg { display: flex; gap: 6px; background: #eceefb; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg-btn { flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg-btn.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.admin-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.admin-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.admin-row.off { opacity: .55; }
.admin-row-main { flex: 1; min-width: 0; }
.admin-row-name { font-weight: 700; }
.admin-row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.role-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.role-name { font-weight: 800; margin-bottom: 8px; }
.role-cap { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.role-cap input { width: 20px; height: 20px; accent-color: var(--primary); }
.audit-filters { display: flex; gap: 8px; margin-bottom: 12px; }
.audit-filters select { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14px; }
.audit-list { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.audit-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border-bottom: 0; }
.audit-main { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.audit-act { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-right: 6px; background: #eef2ff; color: var(--primary-d); }
.audit-act.a-sell { background: #ecfdf5; color: var(--green); }
.audit-act.a-delete { background: #fef2f2; color: var(--red); }
.audit-act.a-edit { background: #fef9c3; color: #854d0e; }
.audit-det { font-size: 12px; color: var(--ink); margin-top: 3px; }
.audit-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.btn-ghost.danger { color: var(--red); border-color: #fecaca; }
.nav-btn .nav-ic { font-size: 19px; }

/* ---------- live scanner ---------- */
.scan-wrap { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; align-items: center; justify-content: center; }
#scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(78vw, 320px); height: 180px; border: 3px solid rgba(255,255,255,.9);
  border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
}
.scan-hint { position: absolute; bottom: 18%; left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.scan-x {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px;
  background: rgba(255,255,255,.92); color: var(--ink); border: 0; border-radius: 999px;
  padding: 9px 18px; font-weight: 700; font-size: 14px;
}
.scan-tools { position: absolute; bottom: calc(8% + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; gap: 10px; justify-content: center; }
.scan-tool { background: rgba(255,255,255,.92); color: var(--ink); border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 700; font-size: 14px; }
.scan-tool.on { background: #fde047; }
