:root {
  --bg: #f4f4f5; --panel: #ffffff; --panel-2: #fafafa; --text: #18181b; --muted: #71717a; --border: #e4e4e7;
  --primary: #4f46e5; --primary-contrast: #fff; --primary-soft: #eef2ff;
  --ok: #16a34a; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --danger: #dc2626; --danger-soft: #fee2e2;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --nav-h: 64px;
  /* The top bar grows by the notch / Dynamic Island inset (iPhone app, installed PWA). */
  --head-h: calc(56px + env(safe-area-inset-top));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b; --panel: #18181b; --panel-2: #1f1f23; --text: #fafafa; --muted: #a1a1aa; --border: #2e2e33;
    --primary: #818cf8; --primary-contrast: #0b0b1a; --primary-soft: #1e1b4b;
    --ok: #4ade80; --ok-soft: #052e16; --warn: #fbbf24; --warn-soft: #3a2a05; --danger: #f87171; --danger-soft: #3b0a0a;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: .75rem; }
.grow { flex: 1; }
.mt { margin-top: 1rem; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: 0 1rem;
  border-radius: 10px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; font-weight: 600;
  text-decoration: none; color: var(--text); touch-action: manipulation; user-select: none; }
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); color: var(--primary-contrast); border-color: transparent; }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 34px; padding: 0 .7rem; font-size: .85rem; border-radius: 8px; }
.btn.lg { min-height: 56px; font-size: 1.1rem; }
.btn.block { width: 100%; }
label.field { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); font-size: 1rem; color: var(--text); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 3rem; }
.pw-toggle { position: absolute; top: 0; right: 0; height: 100%; min-height: 44px; width: 44px; display: grid; place-items: center;
  border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 0 10px 10px 0; touch-action: manipulation; }
.pw-toggle:hover, .pw-toggle[aria-pressed=true] { color: var(--text); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.pw-toggle svg { width: 20px; height: 20px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; color: var(--text); font-size: .95rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--primary); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: .5rem .9rem; min-height: 40px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--primary); color: var(--primary-contrast); }

/* Cards, badges, tables */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--panel-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .5rem; border-bottom: 1px solid var(--border); }
table.t td { padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel-2); }
table.t tfoot td { font-weight: 700; border-top: 2px solid var(--text); border-bottom: none; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.banner { padding: .75rem 1rem; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.info { background: var(--primary-soft); color: var(--primary); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }

/* App shell */
.shell { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: var(--head-h) 1fr; height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: .75rem; padding: 0 1rem; background: var(--panel); border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top); min-height: var(--head-h); }
.brand { font-weight: 800; display: flex; gap: .5rem; align-items: center; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.event-picker { max-width: 280px; min-height: 38px; padding: .3rem .6rem; font-size: .9rem; }
.sync { display: inline-flex; gap: .4rem; align-items: center; font-size: .8rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; background: var(--ok-soft); color: var(--ok); border: 0; cursor: pointer; white-space: nowrap; }
.sync.offline { background: var(--warn-soft); color: var(--warn); }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.nav { background: var(--panel); border-right: 1px solid var(--border); padding: .75rem; display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.nav a svg { width: 22px; height: 22px; flex: none; }
.nav a.on { background: var(--primary-soft); color: var(--primary); }
.main { overflow-y: auto; padding: 1rem; -webkit-overflow-scrolling: touch; }
.page { max-width: 1200px; margin: 0 auto; display: grid; gap: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: var(--head-h) 1fr calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .nav { grid-row: 3; flex-direction: row; border-right: 0; border-top: 1px solid var(--border); padding: 0 .25rem env(safe-area-inset-bottom); overflow-x: auto; gap: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .nav a { flex: 1 0 64px; flex-direction: column; gap: .15rem; font-size: .68rem; padding: .45rem .2rem; justify-content: center; border-radius: 0; }
  .nav a.on { background: transparent; }
  .main { padding: .75rem; }
  .brand span { display: none; }
  .event-picker { max-width: 46vw; }
  .topbar { gap: .5rem; padding: env(safe-area-inset-top) .6rem 0; }
}

/* POS */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 1rem; height: 100%; min-height: 0; }
.main:has(.pos) { padding: 0; overflow: hidden; }
.pos-left { display: flex; flex-direction: column; min-height: 0; padding: 1rem 0 1rem 1rem; gap: .75rem; }
.pos-tools { display: grid; gap: .5rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: 2px; }
.chip { border: 1px solid var(--border); background: var(--panel); padding: .4rem .9rem; border-radius: 999px; font-weight: 600; white-space: nowrap; cursor: pointer; min-height: 38px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; overflow-y: auto; align-content: start; padding-bottom: 1rem; }
.tile { --tile: #4f46e5; position: relative; border: 0; border-radius: 14px; padding: 2rem .8rem .8rem; min-height: 104px; text-align: left; cursor: pointer;
  background: var(--tile); color: #fff; display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); touch-action: manipulation; user-select: none; }
.tile:active { transform: scale(.97); }
.tile .name { font-weight: 700; font-size: 1rem; line-height: 1.2; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.tile .price { font-weight: 800; font-size: 1.05rem; }
.tile .stock { position: absolute; top: .5rem; right: .5rem; font-size: .7rem; font-weight: 700; background: rgba(0,0,0,.28); padding: .1rem .45rem; border-radius: 999px; }
.tile .stock.low { background: #fbbf24; color: #422006; }
.tile.out { filter: grayscale(1); opacity: .5; cursor: not-allowed; }
.tile .in-cart { position: absolute; bottom: .5rem; right: .5rem; background: #fff; color: #111; font-weight: 800; border-radius: 999px; min-width: 26px; height: 26px; display: grid; place-items: center; font-size: .85rem; }
.cart { background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.cart-head { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cart-lines { flex: 1; overflow-y: auto; padding: .25rem 1rem; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: .25rem .5rem; padding: .6rem 0; border-bottom: 1px dashed var(--border); }
.cart-line .qty { display: flex; align-items: center; gap: .25rem; }
.cart-line .qty button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.cart-line .qty span { min-width: 28px; text-align: center; font-weight: 700; }
.cart-foot { border-top: 1px solid var(--border); padding: .75rem 1rem 1rem; display: grid; gap: .5rem; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; font-size: .95rem; }
.totals .grand { font-size: 1.4rem; font-weight: 800; padding-top: .3rem; }
.pay-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cart-toggle { display: none; }
.cart-close-m { display: none; }
@media (max-width: 800px) {
  .pos { grid-template-columns: 1fr; }
  .pos-left { padding: .75rem .75rem 4.5rem; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .tile { min-height: 100px; padding: 1.8rem .6rem .6rem; }
  .tile .name { font-size: .92rem; }
  .cart { position: fixed; inset: var(--head-h) 0 calc(var(--nav-h) + env(safe-area-inset-bottom)) 0; z-index: 20; border-left: 0; transform: translateY(110vh); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; }
  .cart.open { transform: none; visibility: visible; transition: transform .2s ease; }
  .cart-close-m { display: inline-flex; }
  .cart-toggle { display: flex; position: fixed; left: .75rem; right: .75rem; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + .6rem); z-index: 15; }
}

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 1rem; animation: fade .12s ease; }
.modal { background: var(--panel); border-radius: 16px; width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.modal-body { padding: 1.1rem; overflow-y: auto; display: grid; gap: .9rem; }
.modal-foot { padding: .9rem 1.1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) { .modal-back { padding: 0; place-items: end stretch; } .modal { border-radius: 16px 16px 0 0; max-height: 94vh; } }
@keyframes fade { from { opacity: 0; } }
.big-amount { font-size: 2.2rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.quick-cash { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.success-mark { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto; font-size: 2.4rem; font-weight: 800; }
.reader { border: 2px dashed var(--border); border-radius: 14px; padding: 1.2rem; text-align: center; display: grid; gap: .75rem; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.swatches { display: flex; gap: .4rem; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); }

/* Toasts */
#toasts { pointer-events: none; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 1rem); z-index: 60; display: grid; gap: .5rem; width: min(420px, 92vw); }
@media (min-width: 801px) { #toasts { bottom: auto; top: calc(var(--head-h) + .75rem); } }
.toast { background: var(--text); color: var(--bg); padding: .75rem 1rem; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: fade .15s ease; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; }
.kpi .label { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 1.45rem; font-weight: 800; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.bars { display: grid; gap: .35rem; }
.bar { display: grid; grid-template-columns: 64px 1fr 90px; gap: .5rem; align-items: center; font-size: .85rem; }
.bar .track { background: var(--panel-2); border-radius: 6px; height: 18px; overflow: hidden; border: 1px solid var(--border); }
.bar .fill { background: var(--primary); height: 100%; border-radius: 6px; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .7rem 1rem; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.cash-sheet td:first-child { width: 70%; }
.cash-sheet .total td { font-size: 1.2rem; font-weight: 800; border-top: 2px solid var(--text); }
.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.denom { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: .4rem; font-weight: 700; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .card { width: min(420px, 100%); padding: 1.5rem; }
.login .logo { width: 56px; height: 56px; margin-bottom: .5rem; }
.journal-entry { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; }
.journal-entry table { width: 100%; font-size: .85rem; }

@media print {
  .nav, .topbar, .no-print, #toasts { display: none !important; }
  .shell { display: block; height: auto; }
  .main { overflow: visible; padding: 0; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---------------------------------------------------------------- SaaS: onboarding, plans, platform */
.onboarding-wrap { margin-bottom: 1rem; }
.onboarding-wrap:has(> .hidden:only-child) { display: none; }
.progress { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.checklist li { display: flex; align-items: center; gap: .6rem; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: inline-grid; place-items: center; font-size: .8rem; flex: none; }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.sub-banner { margin-bottom: 1rem; }
.sub-banner a { font-weight: 600; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.plan-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.plan-card.current { border: 2px solid var(--primary); }
.plan-card h3 { margin: 0; }
.plan-card .price { font-size: 1.6rem; font-weight: 700; }
.plan-card ul { margin: 0 0 .5rem; padding-left: 1.1rem; font-size: .9rem; flex: 1; }
.platform { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.platform .topbar { position: sticky; top: 0; z-index: 5; }

/* ---------------------------------------------------------------- batch 1: options, combos, favourites, payments, PIN, outdoor */
.center-row { justify-content: center; }
.spinner.sm { width: 20px; height: 20px; border-width: 3px; margin: 0; }

/* Top bar buttons */
.topbar-btn { min-height: 38px; gap: .35rem; }
.topbar-btn .ico { display: inline-flex; }
.topbar-btn .ico svg { width: 20px; height: 20px; }
.topbar-btn.on { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
@media (max-width: 1000px) { .wide-only { display: none; } .topbar-btn { padding: 0 .55rem; } }

/* POS: tiles, favourites, repeat */
.cart-line .line-name { font-weight: 700; }
.cart-line .line-total { font-weight: 700; }
.tile .tag { position: absolute; top: .5rem; left: .5rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: rgba(255,255,255,.9); color: #111; padding: .05rem .4rem; border-radius: 999px; }
.tile .opts-hint { font-size: .75rem; font-weight: 600; opacity: .9; }
.quick-row { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; }
.repeat-btn { min-height: 56px; font-size: 1rem; border: 2px dashed var(--primary); color: var(--primary); }
.favs { display: flex; gap: .5rem; overflow-x: auto; align-items: center; flex: 1; min-width: 0; padding-bottom: 2px; }
.favs-label { font-weight: 800; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.fav-btn { --tile: #4f46e5; flex: none; min-height: 56px; min-width: 120px; padding: .4rem .9rem; border: 0; border-radius: 12px; background: var(--tile); color: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; box-shadow: var(--shadow); touch-action: manipulation; user-select: none; }
.fav-btn .name { font-weight: 800; font-size: 1rem; line-height: 1.15; }
.fav-btn .price { font-weight: 700; font-size: .85rem; opacity: .95; }
.fav-btn:active { transform: scale(.97); }
.fav-btn.out { filter: grayscale(1); opacity: .5; cursor: not-allowed; }
.fav-star { color: #eab308; font-size: 1.05rem; }
.pay-btns .btn.lg { min-height: 52px; font-size: 1rem; padding: 0 .5rem; }

/* Option picker */
.opt-group { border: 1px solid var(--border); border-radius: 12px; padding: .5rem .75rem .75rem; margin: 0; display: grid; gap: .4rem; }
.opt-group legend { font-weight: 800; padding: 0 .3rem; }
.opt-warn { color: var(--danger); font-weight: 700; font-size: .85rem; }
.opt-choice { display: flex; align-items: center; gap: .75rem; min-height: 52px; padding: .3rem .75rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 1.05rem; }
.opt-choice input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--primary); }
.opt-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

/* QR payment */
.qr-img { width: min(300px, 72vw); height: auto; margin: 0 auto; image-rendering: pixelated; background: #fff; border-radius: 8px; }
.qr-help { margin: 0; font-weight: 600; }
.qr-status { justify-content: center; color: var(--muted); }

/* Split payment */
.split-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: .75rem; }
.split-summary strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.split-rest strong { font-size: 1.6rem; color: var(--primary); }
.split-part { display: flex; gap: .6rem; align-items: center; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 10px; }
.split-add { border-top: 1px solid var(--border); padding-top: .75rem; }

/* PIN pad */
.pin-modal { width: min(380px, 100%); }
.pin-wrap { justify-items: center; }
.pin-wrap p { margin: 0; }
.pin-dots { display: flex; gap: .6rem; justify-content: center; min-height: 22px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text); }
.pin-dot.on { background: var(--text); }
.pin-error { color: var(--danger); font-weight: 700; text-align: center; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; width: 100%; max-width: 320px; }
.pin-key { min-height: 64px; font-size: 1.5rem; font-weight: 800; border-radius: 14px; }
.pin-ok { font-size: 1.1rem; }

/* Inventory: options editor, combo builder */
.opt-edit { border: 1px solid var(--border); border-radius: 12px; padding: .75rem; display: grid; gap: .5rem; background: var(--panel-2); }
.opt-edit-head { display: flex; gap: .5rem; align-items: center; }
.opt-edit-head input { flex: 1; font-weight: 700; }
.opt-edit-choice { display: grid; grid-template-columns: 1fr 110px auto; gap: .4rem; align-items: center; }
.combo-row { display: grid; grid-template-columns: 80px auto 1fr auto; gap: .4rem; align-items: center; }
.combo-row .qty-input { text-align: center; }

/* Sales: partial refunds */
.refund-row { display: flex; gap: .75rem; align-items: center; padding: .5rem 0; border-bottom: 1px dashed var(--border); }
.refund-row .line-name { font-weight: 700; }
.stepper { display: flex; align-items: center; gap: .3rem; }
.stepper .step { width: 48px; min-height: 48px; padding: 0; font-size: 1.3rem; }
.step-qty { min-width: 2.2rem; text-align: center; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.refund-entry { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; display: grid; gap: .2rem; }
.refund-history h3 { margin: 0; }
.pin-row { border-top: 1px solid var(--border); padding-top: .75rem; }

/* Bright outdoor mode: strong contrast + bigger targets for direct sunlight (overrides dark mode too). */
html.outdoor {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f4f4f5; --text: #000000; --muted: #27272a; --border: #3f3f46;
  --primary-contrast: #fff; --primary-soft: #e0e7ff;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #92400e; --warn-soft: #fde68a; --danger: #b91c1c; --danger-soft: #fee2e2;
  --shadow: 0 0 0 1px #000;
  color-scheme: light;
  font-size: 18px;
}
html.outdoor body { font-weight: 500; }
html.outdoor .btn { border-width: 2px; min-height: 52px; font-weight: 800; }
html.outdoor .btn.sm { min-height: 42px; }
html.outdoor .btn.lg { min-height: 66px; font-size: 1.25rem; }
html.outdoor .card, html.outdoor .modal, html.outdoor .cart, html.outdoor .topbar, html.outdoor .nav { border-width: 2px; }
html.outdoor input, html.outdoor select, html.outdoor textarea { border-width: 2px !important; min-height: 52px; }
html.outdoor label.field { color: #000; }
html.outdoor .tiles { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .75rem; }
html.outdoor .tile { min-height: 124px; outline: 2px solid #000; outline-offset: -2px; }
html.outdoor .tile .name { font-size: 1.2rem; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
html.outdoor .tile .price { font-size: 1.25rem; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
html.outdoor .tile .stock { background: #000; color: #fff; font-size: .8rem; }
html.outdoor .fav-btn { min-height: 66px; outline: 2px solid #000; outline-offset: -2px; }
html.outdoor .fav-btn .name { text-shadow: 0 1px 2px rgba(0,0,0,.6); }
html.outdoor .chip { border-width: 2px; min-height: 46px; font-weight: 800; }
html.outdoor .cart-line .qty button { width: 46px; height: 46px; border-width: 2px; }
html.outdoor .totals .grand { font-size: 1.7rem; }
html.outdoor .badge { border: 1px solid currentColor; }
html.outdoor .muted, html.outdoor .small.muted { color: #27272a; }
html.outdoor .nav a { color: #000; }
html.outdoor .opt-choice { border-width: 2px; min-height: 60px; }
@media (max-width: 800px) {
  html.outdoor .tiles { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  html.outdoor .tile { min-height: 116px; }
}
@media (max-width: 480px) {
  .event-picker { max-width: 36vw; }
  .sync { font-size: .72rem; padding: .25rem .45rem; }
  .split-rest strong { font-size: 1.3rem; }
  .opt-edit-choice { grid-template-columns: 1fr 90px auto; }
  .combo-row { grid-template-columns: 64px auto 1fr auto; }
}

/* Long product names never cover the price: at most two lines, then "…" (full name is in the tile's label). */
.tile .name { flex: none; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.tile .price { flex: none; margin-top: .35rem; }

/* Two-step sign-in, privacy & data */
.code-input { font-size: 1.6rem !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.mfa-qr { width: 200px; height: 200px; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: 8px; }
.setup-key { display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.setup-key code { font-size: .95rem; letter-spacing: .05em; padding: .35rem .6rem; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; word-break: break-all; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.recovery-codes code { font-size: 1rem; text-align: center; padding: .4rem; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; letter-spacing: .05em; }
ol.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .25rem; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.btn.danger-outline { color: var(--danger); border-color: var(--danger); background: transparent; }
.legal-links a { color: inherit; }
.code-input::placeholder { font-size: 1rem; letter-spacing: normal; }

/* Selling speed: quick discounts, quantity picker, undo, customer screen, orders */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.btn.preset { flex-direction: column; align-items: flex-start; gap: .1rem; min-height: 64px; text-align: left; }
.btn.preset.on { outline: 2px solid var(--primary); }
.preset-row { display: grid; grid-template-columns: 1fr 110px 90px auto; gap: .4rem; align-items: center; }
@media (max-width: 520px) { .preset-row { grid-template-columns: 1fr 1fr; } .preset-row input:first-child { grid-column: 1 / -1; } }
.qty-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.qty-input { font-size: 1.4rem !important; text-align: center; }
.qty-num { min-width: 2ch; text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border-radius: 6px; padding: 0 .2rem; }
.qty-num:focus-visible { outline: 2px solid var(--primary); }
.tile { -webkit-touch-callout: none; }
.screen-btn .ico svg { width: 18px; height: 18px; display: block; }
.screen-btn.on { color: var(--ok); }
.screen-btn.warn { color: var(--warn); }
.order-big { font-size: 3.5rem; font-weight: 800; line-height: 1; }

/* Customer screen (second device, or this device turned round) */
.cust-wrap, .cust-overlay { position: fixed; inset: 0; background: var(--bg); color: var(--text); display: flex; flex-direction: column; z-index: 50; }
.cust-overlay { z-index: 200; }
.cust { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.cust-pair { flex: 1; display: flex; }
.cust-idle, .cust-done, .cust-qr, .cust-tip { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; text-align: center; }
.cust-logo { width: 72px; height: 72px; }
.cust-brand { font-size: clamp(1.6rem, 6vw, 3rem); font-weight: 800; }
.cust-brand.sm { font-size: 1.1rem; color: var(--muted); }
.cust-sub { font-size: clamp(1.1rem, 3.5vw, 1.6rem); color: var(--muted); }
.cust-code { font-size: clamp(4rem, 20vw, 9rem); font-weight: 800; letter-spacing: .15em; font-variant-numeric: tabular-nums; }
.cust-help { font-size: 1.1rem; color: var(--muted); max-width: 32rem; }
.cust-cart { flex: 1; display: flex; flex-direction: column; gap: .6rem; min-height: 0; }
.cust-lines { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: .3rem; }
.cust-line { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; font-size: clamp(1.1rem, 3.5vw, 1.6rem); padding: .4rem 0; border-bottom: 1px dashed var(--border); }
.cust-line .q { color: var(--muted); font-variant-numeric: tabular-nums; }
.cust-line .p, .cust-row span:last-child { font-variant-numeric: tabular-nums; }
.cust-more { color: var(--muted); }
.cust-totals { border-top: 2px solid var(--text); padding-top: .6rem; display: grid; gap: .2rem; }
.cust-row { display: flex; justify-content: space-between; font-size: clamp(1rem, 3vw, 1.3rem); color: var(--muted); }
.cust-row.grand { font-size: clamp(2rem, 8vw, 4rem); font-weight: 800; color: var(--text); }
.cust-amount { font-size: clamp(2.4rem, 9vw, 4.5rem); font-weight: 800; }
.cust-tip h1, .cust-qr h1, .cust-done h1 { font-size: clamp(2rem, 7vw, 3.5rem); margin: 0; }
.cust-tip-grid { display: grid; grid-template-columns: repeat(2, minmax(130px, 220px)); gap: .8rem; }
@media (min-width: 720px) { .cust-tip-grid { grid-template-columns: repeat(4, minmax(130px, 200px)); } }
.cust-tip-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; min-height: 110px; border-radius: 16px; border: 0;
  background: var(--primary); color: var(--primary-contrast); font-size: 1.1rem; cursor: pointer; touch-action: manipulation; }
.cust-tip-btn strong { font-size: 2rem; }
.cust-tip-btn.ghost { background: var(--panel); color: var(--text); border: 2px solid var(--border); }
.cust-custom { display: flex; gap: .5rem; width: min(420px, 100%); }
.cust-order { font-size: clamp(5rem, 22vw, 10rem); font-weight: 800; line-height: 1; }
.cust-status { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); color: var(--muted); font-size: .9rem; }
.cust-exit { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel); color: var(--muted); opacity: .35; cursor: pointer; z-index: 60; }
.cust-exit:hover, .cust-exit:focus-visible { opacity: 1; }
.cust-handback { position: fixed; top: max(8px, env(safe-area-inset-top)); right: 8px; z-index: 210; }
body.cust-mode { overflow: hidden; }

/* Orders (kitchen) and the "Order ready" board */
.orders { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 820px) { .orders { grid-template-columns: 1fr 1fr; } }
.orders h2 { font-size: 1rem; margin: 0 0 .5rem; }
.order-col { display: grid; gap: .6rem; }
.order-card { background: var(--panel); border: 1px solid var(--border); border-left: 6px solid var(--warn); border-radius: 12px; padding: .7rem; display: grid; gap: .4rem; box-shadow: var(--shadow); }
.order-card.ready { border-left-color: var(--ok); }
.order-card.collected { border-left-color: var(--border); opacity: .7; }
.order-no { font-size: 1.6rem; font-weight: 800; }
.order-items { margin: 0; padding-left: 1rem; }
.board { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr 1.3fr; background: var(--bg); color: var(--text); z-index: 50; }
.board section { padding: max(24px, env(safe-area-inset-top)) 24px 24px; overflow: hidden; }
.board section.ready { background: var(--ok-soft); }
.board h2 { font-size: clamp(1.4rem, 3.5vw, 2.6rem); margin: 0 0 1rem; }
.board-nums { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; font-size: clamp(2.2rem, 6vw, 4.5rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.board-nums.ready { color: var(--ok); font-size: clamp(3rem, 9vw, 7rem); }
.board-nums .new { animation: pop 1.2s ease-out 3; }
@keyframes pop { 50% { transform: scale(1.25); } }
@media (max-width: 600px) { .board { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } }
.cust-custom .btn { white-space: nowrap; }
.cust-overlay .cust { padding-top: max(64px, env(safe-area-inset-top)); }
