/* ============================================================================
   Universal Till — base stylesheet.
   Design tokens live in :root so themes (built-in or plugin) can re-skin the
   POS by overriding variables and/or the pos-container grid areas.
   ========================================================================== */

:root {
  --brand: #1e293b;        /* nav / headings accent */
  --accent: #2563eb;       /* primary action */
  --accent-contrast: #ffffff;
  --bg: #f1f5f9;           /* page background */
  --surface: #ffffff;      /* cards, tables */
  --surface-2: #f8fafc;    /* subtle wells inside cards */
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.02rem; font-weight: 600; margin: 0 0 .6rem 0; color: var(--brand);
     text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 1rem; font-weight: 600; margin: .2rem 0; }
a { color: var(--accent); }
/* Column layout so the sale screen fills the viewport exactly below the
   nav, whatever height the nav ends up (one row or two). */
body { display: flex; flex-direction: column; min-height: 100dvh; margin: 0; }
.container { max-width: 1500px; margin: 0 auto; padding: 1rem 1.25rem 2rem; width: 100%; }
/* Main grows to fill the viewport so the status bar never floats mid-screen
   on short pages (menu, settings, …). */
body > main.container { flex: 1 0 auto; }
/* Sale screen gets a DEFINITE height (not just min-height) so the grid's
   1fr rows resolve and the basket scrolls internally instead of growing
   and pushing the tender panel off-screen. */
body.sale-screen { height: 100dvh; overflow: hidden; }
body.sale-screen > main.container { flex: 1 1 auto; min-height: 0; display: flex;
  flex-direction: column; padding-top: .6rem; padding-bottom: 0; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: .75rem 0; }
.tag {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--border);
}

/* ---------- Top navigation ---------- */
.nav {
  background: var(--brand); color: #fff;
  padding: .55rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.logo { display: flex; align-items: center; }
.logo img { height: 28px; display: block; }
.nav-right { display: flex; align-items: center; gap: .5rem; margin-inline-start: .5rem; }
/* The shared touch header: EVERY page shows the same ☰ Menu button (a proper
   touch target) that opens the /menu launcher of big tiles — no page has its
   own small-text link row. */
.nav { flex-wrap: nowrap; }
.nav-toggle { display: inline-flex; align-items: center; background: rgba(255,255,255,.12);
  color: #fff; border: 0; text-decoration: none;
  border-radius: 10px; padding: .6rem 1.1rem; min-height: 46px; font-size: 1rem;
  font-weight: 600; cursor: pointer; }
.nav-toggle:hover, .nav-toggle:active { background: rgba(255,255,255,.22); }

/* Menu page: the tiles ARE the navigation — drop the redundant admin link
   from the session chip; keep logo, ☰, operator and Lock. */
body.menu-screen .session-admin-link { display: none; }

/* Menu launcher page: a grid of large touch tiles. */
.menu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem; margin-top: 1rem;
}
.menu-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem; min-height: 130px; padding: 1.2rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; text-align: center;
  transition: transform .06s ease, border-color .15s ease;
}
.menu-tile:hover, .menu-tile:active { border-color: var(--brand); transform: translateY(-2px); }
.menu-ico { font-size: 2.4rem; line-height: 1; }
.menu-label { font-size: 1.05rem; font-weight: 600; }
.btn-touch { min-height: 46px; display: inline-flex; align-items: center; }

/* Language switcher on the touch menu page — big, obvious buttons so a
   Turkish/Persian operator can find their language at a glance. */
.menu-lang { margin-top: 1.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.menu-lang-label { font-weight: 600; color: var(--muted); }
.menu-lang-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.menu-lang-btn { min-width: 64px; justify-content: center; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }

/* Sale screen top bar is touch-first: the manager links live in the ☰
   menu now, so hide them here; keep the operator + a big Lock button. */
body.sale-screen .session-admin-link { display: none; }
body.sale-screen .btn-lock { min-height: 46px; padding: .5rem 1.2rem; font-size: 1rem; }
body.sale-screen .session-user { font-size: 1rem; padding: .3rem .5rem; }

/* ---------- Reports ---------- */
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.kpi { text-align: center; padding: 1rem; }
.kpi-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--brand); margin-top: .15rem; }

/* ---------- Back-office pages (catalog / inventory) ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between;
             gap: 1rem; margin: .25rem 0 1rem; }
.page-head input[type="search"] { min-width: 260px; }
.catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px;
                  gap: 1rem; align-items: start; }
@media (max-width: 900px) { .catalog-layout { grid-template-columns: 1fr; } }
.catalog-row { cursor: pointer; }
.catalog-row:hover td { background: var(--surface-2); }
.catalog-name { font-weight: 600; }
.draggable-tile { cursor: grab; }
.draggable-tile.dragging { opacity: .4; }
.journal-row { cursor: pointer; }
.journal-row:hover td { background: var(--surface-2); }
.catalog-form-head { display: flex; justify-content: space-between; align-items: center;
                     margin-bottom: .5rem; }
.catalog-form label { display: flex; flex-direction: column; gap: .2rem;
                      font-size: .82rem; margin-bottom: .55rem; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.field-checks { display: flex; gap: 1rem; margin: .3rem 0 .7rem; }
.field-checks label { flex-direction: row; align-items: center; gap: .4rem; margin: 0; }
.catalog-extra { margin-top: .9rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.catalog-extra summary { font-weight: 600; cursor: pointer; color: var(--muted);
                         font-size: .85rem; }
.catalog-extra form { margin-top: .6rem; }
.stock-low { color: var(--danger); font-weight: 700; }

/* ---------- Kiosk header row ---------- */
.kiosk-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin: .25rem 0 1rem;
}
.kiosk-actions { display: flex; align-items: center; gap: .6rem; }
.status-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600;
  background: rgba(22, 163, 74, .12); color: var(--success);
  border: 1px solid rgba(22, 163, 74, .35);
}
.status-pill::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%;
                       background: var(--success); }
.status-pill.offline { background: rgba(217, 119, 6, .12); color: var(--warning);
                       border-color: rgba(217, 119, 6, .35); }
.status-pill.offline::before { background: var(--warning); }

/* ---------- POS sale screen ----------
   One-screen till layout like real POS systems: the transaction column
   (basket with a pinned total + the tender actions) NEVER moves; the product
   grid fills the rest; each panel scrolls internally — the page itself does
   not scroll. The journal lives on its own page (/journal), not on the sale
   screen. Panels carry named grid areas so a theme can still reposition them
   by overriding grid-template-areas/-columns. */
.pos-container {
  display: grid;
  grid-template-columns: minmax(330px, 420px) 1fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-areas:
    "basket products"
    "tender products";
  gap: .8rem;
  align-items: stretch;
  /* Fill whatever space is left below the nav + kiosk header — robust to
     the nav wrapping to two rows (a fixed calc() assumed one row and
     pushed the tender panel off-screen). */
  flex: 1 1 auto;
  min-height: 0;
}
.pos-container > .basket { grid-area: basket; }
.pos-container > .products { grid-area: products; }
.pos-container > .journal { grid-area: journal; display: none; } /* own page */
.pos-container > .tender { grid-area: tender; }

/* Panels are cards; each scrolls internally so nothing gets pushed around. */
.pos-container > .basket,
.pos-container > .products,
.pos-container > .journal,
.pos-container > .tender {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .7rem .8rem;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow-y: auto;
}

/* Basket: lines scroll, totals pinned at the bottom of the panel. */
.pos-container > .basket { display: flex; flex-direction: column; overflow: hidden; }
/* Tender: the panel itself never scrolls — only the active tab body does. */
.pos-container > .tender { overflow: hidden; }
/* After a sale the receipt swaps into the basket slot; it keeps the grid area
   and scrolls internally instead of bleeding over other panels. */
.pos-container > .basket.receipt-view { display: block; overflow-y: auto; }
.basket-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.basket .totals { flex-shrink: 0; }

@media (max-width: 900px) {
  .pos-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "basket" "tender" "products";
    height: auto;
  }
  .pos-container > .basket { max-height: 45dvh; }
}

/* ---------- Cards & forms ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow);
}
.form-row { display: grid; grid-template-columns: 1fr .6fr .6fr 1fr auto; gap: .5rem;
            align-items: center; margin-bottom: .75rem; }
input, select, textarea {
  font: inherit; color: var(--text);
  padding: .5rem .65rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(37, 99, 235, .35); outline-offset: 1px; border-color: var(--accent);
}
.form-row input { padding: .55rem; }
label { font-size: .85rem; color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--accent); color: var(--accent-contrast);
  border: 1px solid transparent; padding: .55rem .95rem; border-radius: 9px;
  cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600;
  text-decoration: none; line-height: 1.2;
  transition: background .12s ease, transform .05s ease;
}
.btn:hover { background: #1d4ed8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: var(--accent); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); border-color: #cbd5e1; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
a.btn, a.btn:hover { text-decoration: none; }
.btn-actions { display: flex; gap: .25rem; justify-content: center; }
.btn-actions .btn { padding: .4rem .6rem; font-size: .85rem; }

/* ---------- Product tiles ----------
   The whole tile is one touch target: image, name, price. */
.grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.btn-tile {
  display: flex; flex-direction: column; align-items: stretch; gap: .25rem;
  padding: .35rem .35rem .45rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  font: inherit; color: var(--text); cursor: pointer; text-align: center;
  transition: border-color .12s ease, box-shadow .12s ease, transform .05s ease;
}
.btn-tile:hover { border-color: #cbd5e1; box-shadow: 0 3px 8px rgba(15, 23, 42, .12); }
.btn-tile:active { transform: scale(.97); }
.tile-name { font-weight: 600; font-size: .8rem; line-height: 1.15; white-space: normal; }
.tile-price { font-size: .82rem; color: var(--accent); font-weight: 700;
              font-variant-numeric: tabular-nums; }
.thumb { width: 100%; height: 54px; object-fit: contain;
         border-radius: 7px; background: var(--surface-2); }
.thumb.small { width: 40px; height: 40px; aspect-ratio: auto; margin-inline-end: .5rem;
               vertical-align: middle; }

/* ---------- Basket ---------- */
.line-item { max-width: 158px; display: flex; align-items: center; gap: .4rem; }
.line-thumb {
  flex: 0 0 auto; width: 2rem; height: 2rem; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border);
}
.line-thumb-empty { background: var(--surface); display: inline-block; }
.line-text { min-width: 0; }
.line-name { display: block; font-weight: 600; font-size: .88rem; line-height: 1.2; }
.line-item small { font-size: .68rem; }
.qty-input { width: 3.6rem; padding: .3rem .35rem; font-size: .85rem; }
.disc-input { width: 3.6rem; padding: .3rem .35rem; font-size: .8rem; margin-top: .2rem; }
.btn-x { padding: .3rem .55rem; font-size: .8rem; min-height: 0; }

.basket table { width: 100%; border-collapse: collapse; background: var(--surface);
                border-radius: var(--radius); overflow: hidden; }
.basket th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
             color: var(--muted); padding: .5rem .6rem; border-bottom: 2px solid var(--border);
             text-align: start; }
.basket td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); text-align: start; }
.basket th:nth-child(n+2), .basket td:nth-child(n+2) { text-align: end; }
.basket tr:last-child td { border-bottom: none; }
.basket .totals {
  margin-top: .5rem; display: grid; gap: .2rem; justify-items: end;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .5rem .7rem; font-variant-numeric: tabular-nums;
  font-size: .9rem;
}
.basket .total { font-weight: 700; font-size: 1.3rem; color: var(--brand); }

/* "Customers also buy" strip — compact chips pinned under the totals;
   scrolls sideways instead of growing so the fixed sale-screen grid holds. */
.suggest-strip { flex-shrink: 0; display: flex; gap: .35rem; align-items: center;
                 overflow-x: auto; margin-top: .45rem; padding-block: .1rem; }
.suggest-strip[hidden] { display: none; }
.suggest-title { font-size: .78rem; font-weight: 700; text-transform: uppercase;
                 letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.suggest-chip { display: inline-flex; align-items: center; gap: .35rem;
                padding: .3rem .55rem; font: inherit; font-size: .8rem; cursor: pointer;
                border: 1px dashed var(--brand); border-radius: var(--radius);
                color: var(--brand); background: var(--surface); white-space: nowrap; }
.suggest-chip:hover { background: var(--brand); color: #fff; }
.suggest-thumb { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; }
.suggest-price { font-variant-numeric: tabular-nums; opacity: .8; }
.basket td { padding: .4rem .45rem; }
.basket th { padding: .4rem .45rem; }

/* ---------- Toasts ---------- */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  padding: .9rem 1.2rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 2000; background: #0f172a; color: #e2e8f0; min-width: 240px; text-align: center;
  opacity: 1; transition: opacity .25s ease; }
.toast.error { background: #7f1d1d; color: #fecaca; border: 1px solid #fecdd3; }
.toast.success { background: #14532d; color: #dcfce7; border: 1px solid #bbf7d0; }
.toast.info { background: #0f172a; color: #e2e8f0; border: 1px solid #1f2937; }
.toast.hide { opacity: 0; }

/* ---------- Journal ---------- */
.journal table { width: 100%; border-collapse: collapse; background: var(--surface);
                 border-radius: var(--radius); overflow: hidden; }
.journal th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
              color: var(--muted); padding: .45rem .5rem; border-bottom: 2px solid var(--border);
              text-align: start; }
.journal td { padding: .45rem .5rem; border-bottom: 1px solid var(--border);
              text-align: start; font-size: .88rem; }
.journal td:nth-child(2), .journal td:nth-child(3), .journal td:nth-child(4) { white-space: nowrap; }
.journal .empty { text-align: center; color: var(--muted); }

/* ---------- Tender ----------
   Fixed panel that never scrolls: scan row + held strip + Pay/Split tabs +
   footer actions. */
[x-cloak] { display: none !important; }
.tender { display: flex; flex-direction: column; gap: .55rem; }

.scan-row { display: flex; gap: .4rem; }
.scan-row input[name="code"] { flex: 1; min-width: 0; }
.scan-row input[name="qty"] { width: 3.8rem; }

.held-strip { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.held-strip:empty { display: none; }
.held-title { font-size: .78rem; font-weight: 700; text-transform: uppercase;
              letter-spacing: .04em; color: var(--muted); }
.held-chip { padding: .35rem .6rem; font-size: .8rem; min-height: 0;
             border: 1px dashed var(--accent); color: var(--accent); background: var(--surface); }
.held-chip:hover { background: var(--accent); color: #fff; }

.tab-bar { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); }
.tab-bar .tab {
  flex: 1; padding: .5rem .6rem; font: inherit; font-weight: 600; text-align: center;
  background: none; border: none; border-bottom: 3px solid transparent;
  color: var(--muted); cursor: pointer; margin-bottom: -2px;
}
.tab-bar .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { flex: 1; min-height: 0; overflow-y: auto; display: flex;
             flex-direction: column; gap: .5rem; }

.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.pay-btn { min-height: 4.2rem; font-size: 1.15rem; font-weight: 700; }
.pay-btn.pay-plugin { background: var(--surface); color: var(--accent);
                      border: 2px dashed var(--accent); }
.pay-btn.pay-plugin:hover { background: var(--accent); color: #fff; }

.tender-footer { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: auto; }

.offline-toggle { display: flex; align-items: center; gap: .5rem; font-weight: 600;
                  font-size: .85rem; color: var(--muted); padding: .2rem .1rem; }
.offline-toggle input { accent-color: var(--brand); }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .5rem; }
.split-tender-form label { display: flex; flex-direction: column; font-size: .8rem;
                           gap: .2rem; margin-bottom: 0; }
.split-tender-form input, .split-tender-form select { padding: .45rem; border-radius: 6px;
                                                      border: 1px solid var(--border); }
.split-controls { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.split-tender-payments { margin: .25rem 0; display: flex; flex-direction: column; gap: .4rem; }
.split-tender-payments.empty { color: var(--muted); font-size: .9rem; }
.payment-pill { display: flex; justify-content: space-between; align-items: center;
                border: 1px solid var(--border); border-radius: 8px; padding: .45rem .6rem;
                background: var(--surface); }
.payment-pill strong { font-size: .9rem; }
.payment-pill span { font-weight: 600; }
.payment-pill button { background: none; border: none; color: var(--danger); cursor: pointer; }
.split-tender-status { min-height: 1.2rem; font-size: .85rem; margin-bottom: .5rem; }
.split-tender-status.error { color: var(--danger); }
.split-tender-status.success { color: #15803d; }
.split-tender-status.info { color: #1d4ed8; }
.tender-actions { grid-template-columns: repeat(2, minmax(140px, 1fr)); }

/* ---------- Plugin buttons group (products panel) ---------- */
.plugin-buttons { margin-top: .8rem; padding-top: .7rem; border-top: 1px dashed var(--border); }
.plugin-buttons h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
                     color: var(--muted); margin: 0 0 .45rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0; margin-bottom: 1rem; }
.tab, .tab-active { transition: all .2s ease; }
.tab:hover { color: var(--accent); border-bottom-color: #93c5fd !important; }
.tab-active:hover { border-bottom-color: #2563eb !important; }

/* ---------- HTMX loading indicators ---------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
#refresh-indicator { margin-inline-start: .5rem; font-size: 1rem; animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; display: inline-block; }
svg.animate-spin { flex-shrink: 0; width: 1.25rem; height: 1.25rem; }

/* ---------- Generic tables (settings, inventory, catalog, shifts…) ---------- */
table.table, .card table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--radius); overflow: hidden;
}
table.table th, .card table th {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: .5rem .6rem; border-bottom: 2px solid var(--border);
  text-align: start;
}
table.table td, .card table td {
  padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: start;
}
table.table tr:last-child td, .card table tr:last-child td { border-bottom: none; }

/* ---------- Kiosk mode (dedicated till: UT_KIOSK=1) ----------
   Touch-first: bigger targets, no text selection or tap highlights, no
   accidental pinch zoom. Pair with a fullscreen browser (chromium --kiosk);
   see deploy/raspberry-pi/. */
body.kiosk { font-size: .9375rem; touch-action: manipulation; }
body.kiosk.sale-screen { overflow: hidden; }
body.kiosk .container { padding: .6rem .8rem 0; }
body.kiosk .kiosk-header { margin: 0 0 .6rem; }
body.kiosk .kiosk-header h1 { font-size: 1.15rem; }
body.kiosk .pos-container { height: calc(100dvh - 6.6rem); }
body.kiosk * { -webkit-tap-highlight-color: transparent; }
body.kiosk .btn, body.kiosk .nav-toggle, body.kiosk .btn-tile,
body.kiosk h1, body.kiosk h2, body.kiosk .status-pill, body.kiosk label,
body.kiosk .basket th, body.kiosk .journal th {
  -webkit-user-select: none; user-select: none;
}
body.kiosk .btn { min-height: 2.75rem; }
body.kiosk .btn-tile { min-height: 5.4rem; }
body.kiosk input, body.kiosk select { min-height: 2.4rem; }
body.kiosk .qty-input, body.kiosk .disc-input { min-height: 2.1rem; }
body.kiosk .basket .total { font-size: 1.45rem; }

/* ── Operator PIN login (docs: architecture/pos-auth.md) ─────────────────
   Full-screen keypad; touch-first like the sale screen. */
body.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; margin: 0; background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 2rem 2.4rem; width: min(24rem, 92vw);
  text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.login-logo { height: 2.6rem; margin-bottom: .5rem; }
.login-tagline { margin: 0 0 1.4rem; color: var(--muted, #64748b); font-size: .85rem; }
.login-card h1 { font-size: 1.2rem; margin: 0 0 1rem; }
.login-footer {
  margin-top: 1.6rem; padding-top: 1rem; border-top: 1px solid var(--border);
  color: var(--muted, #94a3b8); font-size: .72rem; letter-spacing: .02em;
}
.login-error { color: var(--danger, #c0392b); font-weight: 600; min-height: 1.3rem; }
.pin-dots { display: flex; gap: .45rem; justify-content: center; margin-bottom: 1.1rem; }
.pin-dot {
  width: .8rem; height: .8rem; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
}
.pin-dot.filled { background: var(--brand); border-color: var(--brand); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.pin-key { min-height: 3.4rem; font-size: 1.25rem; }
.pin-clear { font-size: .95rem; }
.login-setup { display: flex; flex-direction: column; gap: .8rem; text-align: start; }
.login-setup input { width: 100%; }

/* Multi-till sync chip in the nav (ADR-0011 D4) */
.sync-chip { display: inline-flex; align-items: center; margin-inline-start: .6rem;
  padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.sync-chip.ok { background: #dcfce7; color: #166534; }
.sync-chip.warn { background: #fef3c7; color: #92400e; }
.sync-chip a { color: inherit; }
.sync-banner { background: #fef3c7; color: #92400e; border-radius: .5rem;
  padding: .6rem .9rem; margin-block-end: .8rem; }
.sync-banner a { color: inherit; font-weight: 700; text-decoration: underline; }

/* Operator chip + lock button in the nav */
.session-chip { display: inline-flex; align-items: center; gap: .5rem; margin-inline-start: .8rem; }
.session-user { font-weight: 600; }
.session-lock { display: inline; margin: 0; }
.btn-lock { padding: .25rem .7rem; }

/* Users admin page */
.users-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: start; }
.users-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.users-inline { display: inline-flex; gap: .35rem; margin: 0; }
.users-inline input { width: 7.5rem; }
.users-form form { display: flex; flex-direction: column; gap: .7rem; }
@media (max-width: 900px) { .users-layout { grid-template-columns: 1fr; } }

/* Camera identify overlay (opened on demand from the scan row) */
.ai-identify-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.ai-identify-overlay[hidden] { display: none; }
.ai-identify-panel {
  background: var(--surface, #fff);
  border-radius: 12px;
  padding: 1rem;
  inline-size: min(30rem, 92vw);
  max-block-size: 90dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ai-identify-panel h3 { margin: 0; }
#ai-identify-video {
  inline-size: 100%;
  border-radius: 8px;
  background: #000;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.ai-identify-results { display: flex; flex-direction: column; gap: 0.5rem; }
.ai-identify-results .ai-match {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-start;
  text-align: start;
}
.ai-identify-results .ai-match img {
  inline-size: 2.5rem;
  block-size: 2.5rem;
  object-fit: cover;
  border-radius: 6px;
}
.ai-identify-status { min-block-size: 1.2rem; color: var(--muted, #667); }
.ai-identify-controls { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* Beginner guide (/help) — large readable steps, two-column on wide screens */
.help-intro { color: var(--muted); font-size: 1.05rem; max-inline-size: 44rem; }
.help-guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: .8rem; }
.help-steps { margin: 0; padding-inline-start: 1.4rem; font-size: 1.05rem; }
.help-steps li { margin-block-end: .5rem; line-height: 1.55; }

/* Translation editor (/translations) */
.translations-controls { display: flex; gap: 1rem; align-items: end; margin-block-end: .8rem; flex-wrap: wrap; }
.translations-controls label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.translations-grid { width: 100%; border-collapse: collapse; }
.translations-grid th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: start; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.translations-grid td { padding: .4rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.translations-key code { font-size: .8rem; }
.translations-ref { color: var(--muted); max-inline-size: 18rem; }
.translations-edit { display: flex; gap: .4rem; }
.translations-edit input[type="text"] { min-inline-size: 16rem; }

/* First-boot setup wizard */
.setup-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.6rem; inline-size: min(26rem, 92vw); margin: 8dvh auto 0;
  display: flex; flex-direction: column; gap: .9rem; text-align: center;
}
.setup-card h1 { font-size: 1.3rem; margin: 0; }
.setup-card input[type="text"], .setup-card input[type="password"], .setup-card select {
  inline-size: 100%; padding: .6rem .7rem; font-size: 1.05rem;
}
.setup-card label { display: block; text-align: start; margin-block-end: .6rem; }
.setup-dots { display: flex; gap: .4rem; justify-content: center; }
.setup-dot { inline-size: .6rem; block-size: .6rem; border-radius: 50%; background: var(--border); }
.setup-dot.active { background: var(--accent); }
.setup-langs { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.setup-nav { display: flex; gap: .6rem; justify-content: center; margin-block-start: .4rem; }
[x-cloak] { display: none !important; }

/* Bottom status bar: always-visible version + live connectivity. Bookends the
   dark top nav; part of the body flex column so it sits at the bottom. */
.statusbar {
  flex: 0 0 auto;
  /* Pinned to the bottom of the screen: flex-grow on main handles short
     pages, sticky keeps it visible when a page scrolls. */
  position: sticky; bottom: 0; z-index: 90;
  display: flex; align-items: center; gap: 1rem;
  padding: .28rem 1rem; font-size: .78rem;
  background: #0f172a; color: #94a3b8;
  border-top: 1px solid rgba(255,255,255,.08);
}
.statusbar .sb-item { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.statusbar .sb-ver { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.sb-dot { width: .6rem; height: .6rem; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.sb-conn.is-offline { color: #fca5a5; }
.sb-conn.is-offline .sb-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.15); }

/* "Update available" chip in the status bar (shown only when a newer release
   is detected — best-effort, offline-tolerant). */
.statusbar .sb-update {
  color: #052e16; background: #4ade80; text-decoration: none;
  padding: .05rem .5rem; border-radius: 999px; font-weight: 700;
  margin-inline-start: .5rem;
}
.statusbar .sb-update:hover { background: #22c55e; }
/* Encouragement chip shown until the till is registered with the marketplace. */
.statusbar .sb-enrol {
  color: #451a03; background: #fbbf24; text-decoration: none;
  padding: .05rem .5rem; border-radius: 999px; font-weight: 700;
  margin-inline-start: .5rem;
}
.statusbar .sb-enrol:hover { background: #f59e0b; }
