/* =========================================================
   PathwayPro Cafe
   Same palette as the other PathwayPro modules. The counter screen is
   the loud one (big photo, big balance, green for paid, red for a
   problem) because a cashier reads it at arm's length, mid-queue.
   ========================================================= */

:root {
  --ink: #253238;
  --ink-2: #3a4a52;
  --ink-3: #56666e;
  --muted: #7a878d;
  --paper: #f6f4ef;
  --card: #ffffff;
  --card-2: #f0ede6;
  --line: #e2ddd3;
  --line-2: #ece8e0;

  --gold: #cca300;
  --gold-deep: #8f7300;
  --gold-soft: rgba(204,163,0,.12);
  --terra: #c76639;
  --terra-deep: #a64f27;
  --terra-soft: rgba(199,102,57,.12);
  --sage-deep: #3f7d4e;
  --sage-soft: rgba(63,125,78,.12);
  --blue: #1f6f9c;
  --blue-soft: rgba(31,111,156,.1);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Montserrat", var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.neg { color: var(--terra-deep); }
.pos { color: var(--sage-deep); }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; flex: none; }
.ic-sm { width: 16px; height: 16px; stroke-width: 2; }
.ic-lg { width: 30px; height: 30px; stroke-width: 1.6; }
.ic-xl { width: 64px; height: 64px; stroke-width: 1.3; }

/* ---------- wordmark ---------- */
.wordmark { display: inline-flex; align-items: center; font-family: var(--display); font-weight: 900; letter-spacing: -.035em; font-size: 19px; line-height: 1; white-space: nowrap; }
.wm-pathway { color: transparent; -webkit-text-stroke: 1.2px var(--ink-3); paint-order: stroke fill; }
.wm-pro { color: var(--ink); }
.wm-tm { display: inline-grid; place-items: center; width: .58em; height: .58em; margin: 0 .04em; border: .055em solid var(--ink); border-radius: 99px; color: var(--ink); font-size: .62em; font-weight: 800; align-self: flex-start; transform: translateY(-.14em); }
.wm-tm span { font-size: .52em; }
.wm-app { color: var(--gold-deep); margin-left: .18em; }
.wordmark-lg { font-size: 28px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 14.5px; background: var(--card-2); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.btn:hover { border-color: #cfc8ba; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1d1a0e; }
.btn-gold:hover { background: #bd9700; border-color: #bd9700; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-danger { background: var(--card); color: var(--terra-deep); border-color: #e7c3b1; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 54px; font-size: 16px; padding: 0 22px; border-radius: var(--r-md); }
.btn-block { width: 100%; }

.in, select.in, textarea.in { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); outline: none; font-size: 15px; }
textarea.in { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.in:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.f { display: flex; flex-direction: column; gap: 6px; }
.f > span { font-size: 12.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.f small { color: var(--muted); font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.lede { color: var(--ink-3); font-size: 14px; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--ink-2); white-space: nowrap; }
.chip-staff { background: var(--blue-soft); color: var(--blue); }
.chip-warn { background: var(--terra-soft); color: var(--terra-deep); }
.chip-ok { background: var(--sage-soft); color: var(--sage-deep); }
.chip-gold { background: var(--gold-soft); color: var(--gold-deep); }

.avatar { width: 40px; height: 40px; border-radius: 99px; object-fit: cover; flex: none; background: var(--card-2); }
.avatar-i { display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--ink-3); border: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 100; max-width: calc(100vw - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--terra-deep); }

/* =========================================================
   Back office
   ========================================================= */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .wordmark { margin: 0 8px 22px; }
.nav { display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 12px; border-radius: var(--r-sm); font-weight: 600; color: var(--ink-3); font-size: 14.5px; text-align: left; }
.nav:hover { background: var(--card-2); color: var(--ink); }
.nav.on { background: var(--gold-soft); color: var(--gold-deep); }
.nav .count { margin-left: auto; background: var(--terra); color: #fff; font-size: 11.5px; min-width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; padding: 0 6px; }
.side .who { margin-top: auto; padding: 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-2); }
.side .who b { color: var(--ink-2); display: block; font-size: 14px; }

.main { padding: 28px 32px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--ink-3); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .s { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.stat.alert { border-color: #e7c3b1; background: #fdf6f2; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fbfaf7; position: sticky; top: 0; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fbfaf6; }
td.r, th.r { text-align: right; }
.person { display: flex; align-items: center; gap: 11px; }
.person b { display: block; font-weight: 600; }
.person small { color: var(--muted); font-size: 12.5px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search .ic { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.search .in { padding-left: 38px; }
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; }
.seg button { height: 34px; padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-3); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(37,50,56,.35); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--paper); z-index: 50; transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; box-shadow: -10px 0 30px rgba(0,0,0,.08); }
.drawer.on { transform: none; }
.drawer-head { position: sticky; top: 0; background: var(--card); border-bottom: 1px solid var(--line); padding: 16px 20px; display: flex; align-items: center; gap: 12px; z-index: 2; }
.drawer-head h2 { font-size: 18px; flex: 1; }
.drawer-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-3); }
.icon-btn:hover { background: var(--card-2); }

.balance-hero { display: flex; align-items: center; gap: 16px; }
.balance-hero .avatar { width: 64px; height: 64px; font-size: 20px; }
.balance-hero .amt { font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.ledger { display: flex; flex-direction: column; }
.ledger .e { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.ledger .e:last-child { border-bottom: none; }
.ledger .e .what { flex: 1; min-width: 0; }
.ledger .e .what b { font-weight: 600; font-size: 14px; }
.ledger .e .what small { display: block; color: var(--muted); font-size: 12.5px; }
.ledger .e .amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger .e .amt small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }

.modal { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; padding: 16px; background: rgba(37,50,56,.45); }
.modal.on { display: grid; }
.modal .card { width: min(460px, 100%); max-height: 90vh; overflow: auto; }
.modal h3 { font-size: 18px; margin-bottom: 6px; }

.tap-zone { border: 2px dashed var(--gold); border-radius: var(--r-lg); padding: 26px; text-align: center; background: var(--gold-soft); color: var(--gold-deep); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tap-zone b { font-size: 16px; color: var(--ink); }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.94); } }

.code-big { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 38px; font-weight: 800; letter-spacing: .18em; text-align: center; padding: 16px; background: var(--card-2); border-radius: var(--r-md); }
.notice { padding: 12px 14px; border-radius: var(--r-md); background: var(--card-2); font-size: 14px; color: var(--ink-2); display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: var(--terra-soft); color: var(--terra-deep); }
.notice.ok { background: var(--sage-soft); color: var(--sage-deep); }
.notice.gold { background: var(--gold-soft); color: var(--gold-deep); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
pre.code { background: var(--card-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .card { max-width: 420px; text-align: center; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; overflow-x: auto; padding: 10px 12px; gap: 4px; z-index: 30; border-right: none; border-bottom: 1px solid var(--line); }
  .side .wordmark, .side .who, .side .nav-group { display: none; }
  .nav { flex: none; height: 38px; }
  .nav span.lbl { display: none; }
  .main { padding: 18px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

@media print {
  .side, .toolbar, .no-print, .page-head .btn { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
}

/* =========================================================
   Counter phone
   ========================================================= */
body.counter { background: var(--ink); color: #fff; min-height: 100vh; overflow: hidden; }
.cn { position: fixed; inset: 0; display: flex; flex-direction: column; }
.cn-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; color: rgba(255,255,255,.7); }
.cn-top .dot { width: 9px; height: 9px; border-radius: 99px; background: #6fbf85; box-shadow: 0 0 0 3px rgba(111,191,133,.25); }
.cn-top .dot.off { background: var(--terra); box-shadow: none; }
.cn-top b { color: #fff; font-weight: 600; }
.cn-top > * { white-space: nowrap; flex: none; }
.cn-top #dev-name { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
@media (max-width: 440px) { .cn-top #dev-machine { display: none; } }
.cn-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 20px 24px; text-align: center; gap: 14px; overflow-y: auto; }
.cn-idle .ring { width: 170px; height: 170px; border-radius: 99px; border: 3px solid rgba(204,163,0,.55); display: grid; place-items: center; color: var(--gold); }
.cn-idle h1 { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.cn-idle p { color: rgba(255,255,255,.65); font-size: 16px; max-width: 320px; }

.cn-waiting { width: 100%; max-width: 440px; background: var(--gold); color: #1d1a0e; border-radius: var(--r-lg); padding: 14px 16px; text-align: left; display: flex; gap: 12px; align-items: center; }
.cn-waiting b { font-size: 22px; font-variant-numeric: tabular-nums; }

.cn-person { width: 100%; max-width: 440px; background: #fff; color: var(--ink); border-radius: 24px; padding: 22px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cn-person .avatar { width: 128px; height: 128px; font-size: 40px; border: 4px solid var(--card-2); }
.cn-person h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.cn-person .meta { color: var(--muted); font-size: 15px; }
.cn-person .bal { font-size: 44px; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 6px; }
.cn-person .bal-l { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.cn-person .warn { background: var(--terra); color: #fff; border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 16px; width: 100%; display: flex; gap: 8px; align-items: center; justify-content: center; }
.cn-person .hint { font-size: 15px; color: var(--ink-3); margin-top: 4px; }
.cn-person .timer { height: 5px; width: 100%; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.cn-person .timer i { display: block; height: 100%; background: var(--gold); transition: width 1s linear; }

.cn-result { width: 100%; max-width: 440px; border-radius: 24px; padding: 26px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cn-result.ok { background: #2f7a47; }
.cn-result.bad { background: var(--terra-deep); }
.cn-result h2 { font-size: 28px; font-weight: 800; }
.cn-result .big { font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.cn-result p { font-size: 17px; opacity: .92; }
.cn-actions { display: flex; gap: 10px; width: 100%; max-width: 440px; }
.cn-actions .btn { flex: 1; height: 52px; font-size: 16px; }
.btn-ghost { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.cn-start { background: var(--gold); color: #1d1a0e; border-radius: var(--r-lg); padding: 18px; font-size: 18px; font-weight: 800; width: 100%; max-width: 440px; display: flex; gap: 10px; align-items: center; justify-content: center; }
.cn-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 440px; }
.cn-pad button { height: 56px; border-radius: 14px; background: rgba(255,255,255,.1); color: #fff; font-size: 20px; font-weight: 700; }
.cn-amt { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* =========================================================
   Parent top-up
   ========================================================= */
.topup { max-width: 480px; margin: 0 auto; padding: 28px 16px 60px; }
.topup header { text-align: center; margin-bottom: 22px; }
.topup header p { color: var(--ink-3); margin-top: 8px; }
.amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.amounts button { height: 48px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 15px; }
.amounts button.on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-deep); }
@media (max-width: 380px) { .amounts { grid-template-columns: repeat(2, 1fr); } }
.cn-result .avatar { width: 104px; height: 104px; font-size: 34px; border: 4px solid rgba(255,255,255,.35); }

/* =========================================================
   Stock and purchasing
   ========================================================= */
.nav-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { height: 40px; padding: 0 14px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--gold-deep); border-bottom-color: var(--gold); }
.modal .card.wide { width: min(1100px, 100%); }
table.edit td { padding: 6px 8px; }
table.edit .in { height: 36px; font-size: 14px; padding: 0 8px; }
table.edit select.in { padding-right: 4px; }
tr.excluded td { opacity: .5; }
tr.excluded td.keep { opacity: 1; }
.in-narrow { width: 90px !important; }
.pill-state { font-size: 12px; font-weight: 700; }
.scan-drop { border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-3); }
.progress { height: 6px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 30%; background: var(--gold); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
@media print {
  .modal, .scrim, .drawer, .toast { display: none !important; }
  .print-only { display: block !important; }
  table { font-size: 12px; }
  .stock-sheet td.count { border-bottom: 1px solid #999; min-width: 80px; }
}
.print-only { display: none; }
