/* Munshi AI Pharmacy — Soft Daylight. Calm, one accent, mobile-first.
   Operable at a counter on a cheap Android in Roman-Urdu. */
:root {
  /* Brand tokens aligned to munshiai.pk */
  --bg: #fbfaf7;
  --surface: #ffffff;
  --line: #ece8e0;
  --ink: #0d1a14;
  --ink-soft: #566159;
  --ink-faint: #8a938c;
  --accent: #0f7a4d;         /* Munshi brand green */
  --accent-soft: #e7f2ec;
  --accent-ink: #0f5c3a;     /* logo green (darker) */
  --danger: #c0392b;
  --danger-soft: #fbeae8;
  --warn: #b8860b;
  --warn-soft: #fbf3df;
  --ok: #0f7a4d;
  --shadow: 0 1px 2px rgba(13,26,20,.05), 0 4px 16px rgba(13,26,20,.06);
  --radius: 12px;
  --radius-sm: 8px;
  --tap: 44px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* guard: no page-level horizontal scroll on phones (tables scroll inside their own cards) */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Fraunces is a variable (opsz) display face — let it size its optical weight to
   the render size. All display titles use one consistent treatment. */
.page-head h1, .lp-hero h1, .lp-section > h2, .auth-brand h1 {
  font-family: var(--font-display); font-optical-sizing: auto;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Connectivity banner (offline / back-online) ---- */
.netbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  text-align: center; font-size: .82rem; font-weight: 600; line-height: 1.3;
  padding: .4rem .8rem; color: #fff;
}
.netbar.off { background: var(--danger); }
.netbar.on { background: var(--accent); }
body.net-off .topbar { top: 30px; }
body.net-off #app { padding-top: 30px; }

/* ---- Support-login bar (Munshi Control impersonation) ---- */
.supportbar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: var(--warn); color: #3a2c00; font-size: .82rem; font-weight: 700;
  padding: .4rem .8rem;
}
.supportbar-exit {
  background: rgba(0,0,0,.18); border: none; color: inherit; font-weight: 700;
  padding: .2rem .7rem; border-radius: 7px; cursor: pointer; flex: none;
}

/* ---- Layout shell ---- */
.topbar {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .9rem; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; }
.topbar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .shopname { color: var(--ink-soft); font-size: .9rem; }
.badge-demo { background: var(--warn-soft); color: var(--warn); font-size: .72rem;
  padding: .15rem .45rem; border-radius: 999px; font-weight: 600; }
/* Account chip in the topbar — a clearly tappable control that opens the account menu. */
.topbar .acct-btn { display: flex; align-items: center; gap: .4rem; flex: 0 1 auto; min-width: 0; max-width: 52vw;
  padding: .35rem .5rem; min-height: var(--tap); }
.topbar .acct-btn .acct-ic svg { width: 20px; height: 20px; display: block; }
.topbar .acct-btn .shopname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .acct-btn .acct-caret { opacity: .55; font-size: .7rem; flex: none; }
/* Account menu identity card */
.acct-card { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; margin-top: .4rem; }
.acct-card .acct-av svg { width: 36px; height: 36px; display: block; color: var(--accent); }
/* Leading icons inside buttons (account menu, settings logout) need an explicit
   size — a bare <svg> with only a viewBox stretches to the button width. */
.btn > svg { width: 18px; height: 18px; flex: none; vertical-align: -.2em; }

.layout { display: flex; flex: 1; min-height: 0; }
.nav {
  width: 210px; background: var(--surface); border-right: 1px solid var(--line);
  padding: .6rem; display: flex; flex-direction: column; gap: .15rem;
}
.nav a {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem;
  border-radius: var(--radius-sm); color: var(--ink-soft); text-decoration: none;
  font-weight: 500; min-height: var(--tap);
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.main { flex: 1; min-width: 0; padding: 1rem; max-width: 1100px; }

/* Bottom nav on phones */
.botnav { display: none; }

@media (max-width: 760px) {
  .nav { display: none; }
  .main { padding: .8rem .8rem 5rem; }
  .botnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: .25rem; gap: .1rem; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .botnav::-webkit-scrollbar { display: none; }
  /* 5 primary destinations + a "More" sheet = one row, no horizontal scroll. */
  .botnav a, .botnav .botnav-more {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--ink-faint); text-decoration: none; font-size: .66rem;
    padding: .35rem .4rem; flex: 1 1 0; min-width: 0; min-height: var(--tap);
    border-radius: var(--radius-sm);
    background: none; border: 0; cursor: pointer; font-weight: 500;
  }
  .botnav a svg, .botnav .botnav-more svg { width: 22px; height: 22px; }
  .botnav a.active, .botnav .botnav-more.active { color: var(--accent-ink); }
}

/* "More" nav sheet (phone overflow menu) — big tappable rows to every screen. */
.morenav { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-top: .3rem; }
.morenav-item {
  display: flex; align-items: center; gap: .6rem; min-height: var(--tap);
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-soft); text-decoration: none; font-weight: 500;
}
.morenav-item svg { width: 20px; height: 20px; flex: none; }
.morenav-item.active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-soft); }

/* ---- Cards & sections ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(13,26,20,.04), 0 10px 26px -14px rgba(13,26,20,.12);
  padding: 1.1rem; overflow-x: auto; }  /* wide tables scroll inside the card */
.card::-webkit-scrollbar { height: 8px; }
.card::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.section-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 .25rem; }
.section-sub { color: var(--ink-soft); font-size: .85rem; margin: 0 0 .9rem; }

/* ---- Page header (editorial) — eyebrow + Fraunces title + sub + actions ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head .titles { min-width: 0; }
.page-head .eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); display: inline-flex; align-items: center; gap: .45rem; }
.page-head .eyebrow::before { content: ''; width: 16px; height: 2px; border-radius: 2px; background: var(--accent); }
.page-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.4rem, 1.1rem + 1vw, 1.7rem);
  letter-spacing: -.015em; line-height: 1.04; margin: .28rem 0 .14rem; }
.page-head .sub { color: var(--ink-soft); font-size: .9rem; margin: 0; max-width: 62ch; }
.page-head .actions { display: flex; gap: .45rem; flex-wrap: wrap; }
.row { display: flex; gap: .6rem; align-items: center; }
.grid { display: grid; gap: .8rem; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ---- Inputs & buttons ---- */
input, select, button, textarea { font: inherit; }
.input, input[type=text], input[type=tel], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  min-height: var(--tap); outline: none;
}
.input:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: block; }
label.field > span { display: block; font-size: .8rem; color: var(--ink-soft); margin-bottom: .2rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer;
  min-height: var(--tap);
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn { transition: background .14s ease, box-shadow .14s ease, transform .06s ease; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { box-shadow: 0 2px 8px -2px rgba(15,92,58,.5); }
.btn.primary:hover { box-shadow: 0 4px 14px -3px rgba(15,92,58,.55); }
/* Icon-only buttons: keep a full 44px tap target on the narrow axis too. */
.btn.ico { min-width: var(--tap); padding-left: .5rem; padding-right: .5rem; }

/* ---- Pills / tags ---- */
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600;
  padding: .18rem .5rem; border-radius: 999px; background: var(--bg); color: var(--ink-soft); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }
.pill.green { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- Tables ---- */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { text-align: left; padding: .6rem .55rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-faint); font-weight: 700;
  position: sticky; top: 0; background: var(--surface); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tbody tr:not(.items) { transition: background .12s ease; }
table.tbl tbody tr:not(.items):hover { background: #f5f7f4; }
table.tbl tbody tr:last-child td { border-bottom: none; }
/* Clickable rows: make "tap for detail" obvious — hover tint, left accent, chevron. */
table.tbl tbody tr[style*="pointer"] { transition: background .12s ease; }
table.tbl tbody tr[style*="pointer"]:hover { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
table.tbl tbody tr[style*="pointer"] td:last-child { position: relative; padding-right: 1.4rem; }
table.tbl tbody tr[style*="pointer"] td:last-child::after { content: '›'; position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); font-size: 1.05rem; font-weight: 700; }
table.tbl tbody tr[style*="pointer"]:hover td:last-child::after { color: var(--accent-ink); }

/* Phones: tighter cells so more of a wide table is visible before sideways scroll. */
@media (max-width: 640px) {
  table.tbl th, table.tbl td { padding: .5rem .4rem; }
  .card > table.tbl, .card > .tbl-scroll > table.tbl { font-size: .92rem; }
  .page-head { flex-direction: column; align-items: stretch; gap: .6rem; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .hstack .stat { flex: 1 1 calc(50% - .3rem) !important; min-width: 0 !important; }
  .hero-card { padding: 1rem 1.05rem; }
  .hero-card .h-main { gap: .9rem; }
  .hero-card .h-metric .val { font-size: 1.7rem; }
  .hero-card .h-divider { display: none; }
  .hero-card .h-main > div:last-child { flex-basis: 100%; margin-left: 0 !important; }
  .cart { position: static; }
  .modal { padding: .9rem; }
  /* topbar: keep brand on one line, truncate shop name, drop the user name */
  .topbar { gap: .45rem; padding: .5rem .7rem; }
  .topbar .brand { white-space: nowrap; flex: none; }
  .topbar .shopname { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 42vw; }
  .topbar .faint { display: none; }
}

/* ---- Counter (POS) ---- */
.counter { display: grid; grid-template-columns: 1fr 380px; gap: .9rem; align-items: start; }
@media (max-width: 900px) { .counter { grid-template-columns: 1fr; } }
.search-wrap { position: relative; }
.results { margin-top: .5rem; display: grid; gap: .4rem; max-height: 60vh; overflow: auto; }
.result-item { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.result-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.result-item .meta { flex: 1; min-width: 0; }
.result-item .name { font-weight: 600; }
.result-item .sub { font-size: .78rem; color: var(--ink-soft); }
.result-item .stock { font-size: .78rem; text-align: right; }

.cart { position: sticky; top: 64px; }
.result-item .quick-add { flex: none; padding: .4rem .6rem; font-size: .8rem; min-height: 36px; white-space: nowrap; }
.result-item .quick-add:disabled { opacity: .35; }
/* Phones: the POS add button is the most-tapped control — give it a full 44px target. */
@media (max-width: 760px) { .result-item .quick-add { min-height: var(--tap); padding-top: .5rem; padding-bottom: .5rem; } }
.qty-ctl { display: inline-flex; align-items: center; gap: .35rem; margin-top: .3rem; }
.qty-ctl .btn { padding: 0; width: 30px; height: 30px; min-height: 30px; font-size: 1.05rem; line-height: 1; }
.qty-ctl .q { min-width: 1.6rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
/* day-close denomination tally */
.tally { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .8rem; margin-top: .5rem; }
.tally-row { display: grid; grid-template-columns: 5.2rem 1rem 1fr; align-items: center; gap: .3rem; }
.tally-row .note { font-weight: 600; font-size: .86rem; font-variant-numeric: tabular-nums; }
.tally-row .x { color: var(--ink-faint); text-align: center; }
.tally-row input { min-height: 36px; padding: .35rem .5rem; }
@media (max-width: 420px) { .tally { grid-template-columns: 1fr; } }

/* sticky running-bill bar — phones only, sits above the bottom nav */
.billbar { display: none; }
@media (max-width: 900px) {
  .billbar { display: flex; align-items: center; gap: .5rem; position: fixed; left: .6rem; right: .6rem; bottom: 66px; z-index: 29;
    background: var(--ink); color: #fff; border-radius: 14px; padding: .55rem .7rem; box-shadow: 0 10px 30px -10px rgba(13,26,20,.55); }
  .billbar > div { flex: 1; min-width: 0; }
  .billbar .bb-k { font-size: .7rem; opacity: .75; }
  .billbar .bb-v { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
  .billbar .btn { padding: .45rem .7rem; min-height: 38px; font-size: .85rem; }
  .billbar .btn:not(.primary) { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
  .main { padding-bottom: 8.5rem; }   /* room for billbar + botnav */
  /* stack the result row: name on top, then stock · pill · quick-add */
  .result-item { padding: .7rem .7rem; flex-wrap: wrap; row-gap: .4rem; }
  .result-item .meta { flex: 1 1 100%; }
  .result-item .name { font-size: 1.02rem; }
  .result-item .stock { flex: 1; display: flex; align-items: center; gap: .45rem; text-align: left; }
  .result-item .quick-add { margin-left: auto; }
}
.cart .line { display: grid; grid-template-columns: 1fr auto; gap: .3rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.cart .line .nm { font-weight: 600; }
.cart .line .sub { font-size: .75rem; color: var(--ink-soft); }
.cart .totals { margin-top: .6rem; display: grid; gap: .25rem; }
.cart .totals .t { display: flex; justify-content: space-between; }
.cart .totals .grand { font-size: 1.2rem; font-weight: 800; }

/* ---- Modal ---- */
.modal-back { position: fixed; inset: 0; background: rgba(13,26,20,.38); display: flex;
  align-items: flex-end; justify-content: center; z-index: 50; backdrop-filter: blur(2px);
  animation: fadeIn .16s ease; }
@media (min-width: 620px) { .modal-back { align-items: center; } }
.modal { background: var(--surface); border-radius: 18px 18px 0 0; width: 100%; max-width: 520px;
  padding: 1.1rem; box-shadow: 0 -8px 40px -8px rgba(13,26,20,.28); max-height: 92vh; overflow: auto;
  animation: slideUp .22s cubic-bezier(.16,1,.3,1); }
@media (min-width: 620px) { .modal { border-radius: 18px; box-shadow: 0 24px 60px -12px rgba(13,26,20,.35); animation: popIn .18s cubic-bezier(.16,1,.3,1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@keyframes popIn { from { transform: scale(.97); opacity: .4; } to { transform: scale(1); opacity: 1; } }

/* ---- Empty / toast ---- */
.empty { text-align: center; color: var(--ink-faint); padding: 2.2rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.empty .ic { width: 46px; height: 46px; border-radius: 13px; background: var(--bg); color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center; }
.empty .ic svg { width: 24px; height: 24px; }
.empty .msg { max-width: 34ch; line-height: 1.4; }
.stat { transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(13,26,20,.22); border-color: #ddd8cd; }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 999px; z-index: 60;
  font-size: .9rem; box-shadow: var(--shadow); }

/* ---- In-demo upsell: non-blocking bottom banner (FUNNEL v2, fleet-consistent) ---- */
/* z-index 40 sits above content + bottom-nav (30) but BELOW modals (50), so it never traps. */
.upsell-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 40;
  width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; justify-content: center;
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 14px; padding: .55rem .75rem;
  box-shadow: 0 10px 30px -10px rgba(13,26,20,.45); animation: fadeIn .18s ease;
}
.upsell-bar .msg { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: .86rem; }
.upsell-bar .btn { padding: .34rem .72rem; font-size: .83rem; min-height: 34px; }
@media (max-width: 760px) { .upsell-bar { bottom: 74px; } }  /* clear the 66px phone bottom-nav */

/* ---- Auth (login) — light-luxury, brand-consistent ---- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.2rem;
  background:
    radial-gradient(90% 60% at 50% -10%, var(--accent-soft) 0%, transparent 55%),
    radial-gradient(60% 50% at 100% 110%, #f0efe8 0%, transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 2rem 1.8rem 1.6rem;
  box-shadow: 0 1px 2px rgba(13,26,20,.05), 0 18px 50px -12px rgba(13,26,20,.18);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem; margin-bottom: 1.4rem; }
.auth-brand .tile { width: 56px; height: 56px; border-radius: 16px; box-shadow: 0 6px 18px -6px rgba(15,92,58,.5); }
.auth-brand .tile svg { width: 56px; height: 56px; border-radius: 16px; }
.auth-brand h1 { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; letter-spacing: -.01em; margin: .2rem 0 0; }
.auth-brand p { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.auth-card .field { display: block; margin-bottom: .8rem; }
.auth-card .field > span { font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .3rem; display: block; }
.auth-card .field input { padding: .75rem .85rem; border-radius: 11px; }
.auth-card .btn.primary { margin-top: .3rem; padding: .8rem; border-radius: 11px; font-size: 1.02rem; }
.auth-err { min-height: 1.2em; color: var(--danger); font-size: .85rem; margin: .1rem 0 .3rem; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: 1.1rem; padding-top: 1rem;
  border-top: 1px solid var(--line); font-size: .85rem; }
.auth-foot a { color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }
.auth-foot .sep { color: var(--ink-faint); }
.auth-hint { text-align: center; color: var(--ink-faint); font-size: .8rem; margin-top: .9rem; }

.login { max-width: 380px; margin: 8vh auto; }
.hstack { display: flex; gap: .55rem; flex-wrap: wrap; }
.stat { position: relative; overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #fdfcf9 100%);
  border: 1px solid var(--line); border-radius: 14px; padding: .8rem .9rem; }
.stat::before { content: ''; position: absolute; left: 0; top: .85rem; bottom: .85rem; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); opacity: 0; transition: opacity .16s ease; }
.stat:hover::before { opacity: .55; }
/* semantic stat washes (optional modifier on the .stat container) */
.stat.is-danger { background: linear-gradient(180deg, #fff 0%, var(--danger-soft) 160%); }
.stat.is-danger::before { background: var(--danger); opacity: .5; }
.stat.is-ok::before { background: var(--accent); opacity: .5; }
.stat.is-warn { background: linear-gradient(180deg, #fff 0%, var(--warn-soft) 170%); }
.stat.is-warn::before { background: var(--warn); opacity: .5; }
.stat .st-ic { position: absolute; top: .7rem; right: .7rem; width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink); }
.stat .st-ic svg { width: 15px; height: 15px; }

/* ---- Landing page (/demo) ---- */
.lp { width: 100%; min-width: 0; max-width: 1080px; margin: 0 auto; padding: 0 1rem 4rem; }
.lp-nav { display: flex; align-items: center; gap: .6rem; padding: 1rem .2rem; flex-wrap: wrap; }
.lp-nav .brand { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.lp-nav .brand .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); }
.lp-nav .spacer { flex: 1; }
/* Phones: condense the landing header so it never overflows the viewport. */
@media (max-width: 520px) {
  .lp-nav { gap: .35rem; padding: .7rem .1rem; }
  .lp-nav .brand { font-size: 1rem; }
  .lp-nav .brand .faint { display: none; }      /* drop "· Pharmacy" tag */
  .lp-nav .btn { padding: .4rem .6rem; font-size: .84rem; }
}
.lp-hero { position: relative; text-align: center; padding: 3rem 1rem 2.5rem;
  background: radial-gradient(120% 90% at 50% -10%, var(--accent-soft) 0%, transparent 60%); border-radius: 24px; }
.lp-eyebrow { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 700;
  color: var(--accent-ink); background: var(--accent-soft); padding: .3rem .7rem; border-radius: 999px; }
.lp-hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 1rem + 5vw, 3.5rem); line-height: 1.03; letter-spacing: -.02em; margin: 1rem auto .6rem; max-width: 15ch; }
.lp-hero p.sub { font-size: clamp(1rem, .9rem + .6vw, 1.2rem); color: var(--ink-soft); max-width: 46ch; margin: 0 auto 1.6rem; }
.lp-cta { display: inline-flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.btn.xl { padding: .85rem 1.5rem; font-size: 1.05rem; border-radius: 12px; }
.lp-note { margin-top: .8rem; color: var(--ink-faint); font-size: .82rem; }

.lp-section { margin-top: 3.2rem; }
.lp-section > h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; letter-spacing: -.01em; margin: 0 0 .3rem; }
.logo-mark { width: 26px; height: 26px; border-radius: 6px; display: block; flex: none; }
.logo-mark.sm { width: 22px; height: 22px; }
.logo-mark.lg { width: 34px; height: 34px; border-radius: 8px; }
.lp-section > .lead { color: var(--ink-soft); margin: 0 0 1.2rem; max-width: 55ch; }
.lp-bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
@media (max-width: 820px) { .lp-bento { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .lp-bento { grid-template-columns: 1fr; } }
.lp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem;
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.lp-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(20,30,45,.10); }
.lp-card .ic { width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; margin-bottom: .7rem; }
.lp-card .ic svg { width: 22px; height: 22px; }
.lp-card h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.lp-card p { margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.4; }
.lp-card.span2 { grid-column: span 2; }
@media (max-width: 520px) { .lp-card.span2 { grid-column: span 1; } }

.lp-why { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem 1.4rem; }
@media (max-width: 640px) { .lp-why { grid-template-columns: 1fr; } }
.lp-why .row { align-items: flex-start; gap: .6rem; padding: .5rem 0; }
.lp-why .row svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 2px; }
.lp-why .row b { display: block; }
.lp-why .row span { color: var(--ink-soft); font-size: .9rem; }

.lp-pricing { display: flex; justify-content: center; }
.lp-price-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.6rem;
  max-width: 420px; text-align: center; box-shadow: var(--shadow); }
.lp-price-card .amt { font-size: 2.4rem; font-weight: 800; }
.lp-price-card .amt small { font-size: 1rem; font-weight: 500; color: var(--ink-soft); }
.lp-foot { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: .85rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem; }
.stat .k { font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: .12rem; }
.stat .v { font-size: 1.5rem; font-weight: 800; letter-spacing: -.015em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .st-sub { font-size: .72rem; color: var(--ink-faint); margin-top: .12rem; }

/* ---- Hero metric card (dashboard) ---- */
.hero-card { position: relative; overflow: hidden; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, #0d5233 0%, #0f7a4d 60%, #14875a 100%);
  padding: 1.25rem 1.35rem; box-shadow: 0 14px 34px -14px rgba(15,92,58,.55); }
.hero-card::after { content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); pointer-events: none; }
.hero-card .h-eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.hero-card .h-main { display: flex; align-items: flex-end; gap: 1.4rem; flex-wrap: wrap; margin-top: .3rem; }
.hero-card .h-metric .lbl { font-size: .78rem; opacity: .82; }
.hero-card .h-metric .val { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hero-card .h-metric.sec .val { font-size: 1.5rem; opacity: .95; }
.hero-card .h-divider { width: 1px; align-self: stretch; background: rgba(255,255,255,.22); }

/* ---- Mini bar trend ---- */
.trend { display: flex; align-items: flex-end; gap: 5px; height: 46px; }
.trend .bar { flex: 1; min-width: 4px; border-radius: 3px 3px 0 0; background: rgba(255,255,255,.35); transition: height .3s ease; }
.trend .bar.today { background: #fff; }
.trend-x { display: flex; gap: 5px; margin-top: .25rem; }
.trend-x span { flex: 1; text-align: center; font-size: .6rem; opacity: .7; }

/* ---- Alert / attention rows ---- */
.alert-row { display: flex; align-items: center; gap: .7rem; padding: .7rem .3rem; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: none; }
.alert-row .a-ic { width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; }
.alert-row .a-ic.red { background: var(--danger-soft); color: var(--danger); }
.alert-row .a-ic.amber { background: var(--warn-soft); color: var(--warn); }
.alert-row .a-ic.green { background: var(--accent-soft); color: var(--accent-ink); }
.alert-row .a-body { flex: 1; min-width: 0; }
.alert-row .a-body .t { font-weight: 600; font-size: .92rem; }
.alert-row .a-link { color: var(--accent-ink); font-weight: 600; font-size: .84rem; white-space: nowrap; }

/* ---- Camera scan sheet (ported with scan.js from the mobile-shop gold module) ---- */
/* Button modifiers the gold sheet HTML uses (elements already carry base .btn). */
.btn-block { width: 100%; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-sm { padding: .25rem .55rem; font-size: .85rem; min-height: auto; }
.hint-text { color: var(--ink-soft); font-size: .88rem; line-height: 1.45; }

.scan-wrap { position: relative; width: 100%; max-width: 420px; margin: 0 auto; aspect-ratio: 4 / 3;
  background: #0d1a14; border-radius: 12px; overflow: hidden; }
.scan-wrap[hidden] { display: none; }
.scan-wrap #scanVid { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 8%; right: 8%; top: 34%; bottom: 34%;
  border: 2px solid rgba(255, 255, 255, .85); border-radius: 8px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .28);
  pointer-events: none; }
.scan-torch { position: absolute; right: 10px; bottom: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .5); color: #fff; font-size: 18px; cursor: pointer; }
.scan-torch.on { background: var(--accent); }

.zoom-bar, .focus-bar { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; font-size: .82rem; }
.zoom-bar[hidden], .focus-bar[hidden] { display: none; }
.zoom-bar input[type=range] { flex: 1; min-height: 32px; }
.focus-label { color: var(--ink-soft); min-width: 44px; }
.focus-track { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.focus-track i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .15s; }
.focus-track i.bad { background: var(--danger); }
.focus-track i.mid { background: var(--warn); }
.focus-track i.good { background: var(--accent); }
.focus-word { min-width: 90px; text-align: right; color: var(--ink-soft); }

.scan-log { margin-top: .6rem; min-height: 1.3em; font-size: .9rem; text-align: center; }
.scan-ok { color: var(--accent-ink); font-weight: 700; }
.scan-bad { color: var(--danger); font-weight: 600; }
