:root {
  --bg: #f4f6f9;
  --card: #fff;
  --ink: #1b2430;
  --muted: #6b7686;
  --line: #e3e7ee;
  /* Browser-default blue, white, yellow for alerts, red for danger. */
  --brand: #0075ff;
  --primary: #0075ff;
  --accent: #0075ff;
  --tint: #e8f1ff;
  --warn: #ffc107;
  --warn-bg: #fff8db;
  --danger: #dc3545;
  --radius: 12px;
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, 'Noto Sans Arabic', 'Geeza Pro', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
/* A grid or flex child never grows wider than its place because of a long word or a no-wrap line
   (the default min-width: auto lets it push past its parent — "100% items sticking out"). */
:where(.sb-foot, .form-grid, .field, .set-body, .set-card, .meter, .kpi, .card-box, .split-grid, .two-col, .modal-body, .page-body, .toolbar, .pagebar) > * { min-width: 0; }
:where(.sb-foot, .form-grid) { grid-template-columns: minmax(0, 1fr); }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { -webkit-tap-highlight-color: transparent; }
#app { height: 100%; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #0075ff33; }
.muted { color: var(--muted); }
/* numbers keep their sign/order inside RTL text */
.sum-row > span:last-child, .r-val, .kpi strong, .line-total, .tile-price, .pay-total { direction: ltr; unicode-bidi: isolate; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: plaintext; }
.empty { text-align: center; padding: 40px 10px; }
.notice { background: var(--warn-bg); border: 1px solid #ffe08a; padding: 14px; border-radius: var(--radius); }
.notice p { margin: 4px 0 0; }

/* buttons */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.btn:hover { background: #f0f3f7; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: #fff; border-color: #f0c4c4; color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 16px; font-size: 18px; width: 100%; }
.btn.primary:hover { filter: brightness(1.05); }
.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.danger-text { color: var(--danger); }
.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
}
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  color: inherit;
}
.tab.on { background: var(--tint); color: var(--primary); }

/* auth */
.auth { flex: 1; display: grid; place-items: center; padding: 20px; background: var(--bg); overflow-y: auto; }
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 18px;
  padding: 26px;
  display: grid;
  gap: 12px;
  box-shadow: 0 20px 50px #0004;
}
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; }
.brand img { width: 44px; height: 44px; }
.brand h1 { margin: 0; font-size: 24px; }
.auth-note { display: flex; gap: 8px; align-items: flex-start; background: var(--tint); border-radius: 10px; padding: 10px 12px; margin: 0; }
.auth-note.warn { background: var(--warn-bg); display: block; }
.link-btn { justify-self: start; background: none; border: none; padding: 2px 0; color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.otp-input { letter-spacing: .5em; text-align: center; font-size: 20px; font-weight: 700; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; }
.auth-tabs .tab { flex: 1; color: var(--muted); }
.auth-tabs .tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #0001; }
.lang { justify-self: center; }
.field { display: grid; gap: 5px; font-size: 14px; }
.field > span { font-weight: 600; }
.field small { color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; }

/* top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #fff;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tb-start { display: flex; align-items: center; gap: 10px; }
.tb-start .logo { width: 28px; height: 28px; }
.tb-mid { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tb-end { display: flex; align-items: center; gap: 8px; }
.tb-end .btn.ghost { color: var(--ink); border-color: var(--line); }
.tb-end .btn.ghost:hover { background: var(--bg); }
.user { opacity: 0.85; font-size: 14px; }
.branch-select { width: auto; padding: 5px 10px; border-radius: 8px; }
.branch-select option { color: var(--ink); }
.branch-name { font-size: 14px; background: var(--bg); padding: 4px 10px; border-radius: 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; background: var(--bg); padding: 4px 10px; border-radius: 999px; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.status.off i { background: #ffb020; }
.status b { font-weight: 600; color: #8a6100; }
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* POS */
.pos { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 380px; }
.catalog { display: flex; flex-direction: column; gap: 10px; padding: 12px; min-height: 0; }
.search { font-size: 17px; padding: 12px 14px; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; flex-shrink: 0; }
.grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  grid-auto-rows: 96px;
  gap: 10px;
  align-content: start;
}
.tile {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  text-align: start;
  transition: transform 0.05s;
}
.tile:active { transform: scale(0.97); background: var(--tint); }
.tile-name { font-weight: 600; font-size: 15px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-price { color: var(--primary); font-weight: 700; }
.tile-price small { color: var(--muted); font-weight: 400; }
.tile-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.tile-stock { font-size: 12px; color: var(--muted); background: #f0f3f7; border-radius: 6px; padding: 1px 6px; direction: ltr; }
.tile-stock.out { color: var(--danger); background: #fdecec; }
.qty-val { min-width: 34px; border: none; background: none; font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline dotted; }
.cart {
  background: var(--card);
  border-inline-start: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.lines { flex: 1; overflow-y: auto; padding: 8px 12px; }
.line {
  display: grid;
  grid-template-columns: 1fr auto 70px 34px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.line-name { font-weight: 600; display: grid; }
.line-name small { color: var(--muted); font-weight: 400; }
.line-total { text-align: end; font-weight: 700; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; }
.table tr.low td { background: #fff7e6; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-lines td input { padding: 6px 8px; }
.doc-lines .num input { width: 110px; text-align: end; }
.picker { position: relative; }
.picker-list { position: absolute; inset-inline: 0; top: 100%; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px #0002; }
.picker-list button { display: flex; justify-content: space-between; width: 100%; padding: 9px 12px; border: none; background: none; cursor: pointer; text-align: start; }
.picker-list button:hover, .picker-list button.on { background: #eef3fb; }
.modal-xl { width: min(980px, 100%); }
.sums { padding: 10px 14px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.sum-row { display: flex; justify-content: space-between; }
.sum-row.grand { font-size: 24px; font-weight: 800; padding-top: 6px; border-top: 1px solid var(--line); }
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 14px 10px; }
.cart-tools { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px; padding: 0 8px 8px; }
.cart-tools .btn { padding: 8px 10px; font-size: 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.np-key { padding: 14px 0; font-size: 22px; font-weight: 700; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fb; cursor: pointer; }
.np-key:active { background: #e6edf5; }
.np-clear { grid-column: 1 / -1; padding: 8px 0; font-size: 16px; color: var(--danger); }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split-grid .field.on input { border-color: var(--accent); box-shadow: 0 0 0 3px #0075ff33; }
.remaining { text-align: center; font-weight: 700; margin-top: 8px; }
.remaining.bad { color: var(--danger); }
.shift-bar { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 12px; background: var(--tint); border-bottom: 1px solid var(--line); font-size: 13px; }
.shift-bar.closed { background: var(--warn-bg); }
.pay.three { grid-template-columns: 1fr 1fr auto; }
.diff-pos { color: var(--primary); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.open { background: var(--tint); color: var(--primary); }
.pill.closed { background: #eef1f5; color: var(--muted); }
.check small { font-weight: 400; }
.diff-neg { color: var(--danger); }
.receipt-editor { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.receipt-editor .receipt-preview { position: sticky; top: 0; }
.logo-row { display: flex; align-items: center; gap: 10px; }
.logo-row img { max-height: 48px; max-width: 140px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: #fff; }
@media (max-width: 860px) { .receipt-editor { grid-template-columns: 1fr; } }
.big-input { font-size: 26px; text-align: center; font-weight: 700; }
.change { font-size: 22px; font-weight: 800; text-align: center; margin-top: 12px; color: var(--primary); }
.change.bad { color: var(--danger); }
.pay-total { font-size: 40px; font-weight: 800; text-align: center; padding: 20px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: #0008; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(440px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px #0005; }
.modal-wide { width: min(560px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body p { margin: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-grid { display: grid; gap: 12px; }

/* toasts */
#toasts { position: fixed; top: 62px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; max-width: 90vw; }
.toast { background: #1b2430; color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 24px #0003; transition: opacity 0.3s; font-weight: 600; }
.toast-success { background: var(--primary); }
.toast-error { background: var(--danger); }
.toast.hide { opacity: 0; }

/* admin */
.admin { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 6px; padding: 10px 14px 0; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs .tab { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin-bottom: 8px; color: var(--ink); background: #fff; white-space: nowrap; }
.tabs .tab.on { color: #fff; background: var(--primary); border-color: var(--primary); }
.admin-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.admin-body > * { flex-shrink: 0; }
.toolbar { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.toolbar > input[type='search'] { max-width: 320px; }
.toolbar .field { min-width: 150px; }
.spacer { flex: 1; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; background: #fafbfc; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table .actions { text-align: end; white-space: nowrap; }
.table .actions .btn + .btn { margin-inline-start: 6px; }
.table tr.voided td { color: var(--muted); text-decoration: line-through; }
.table tr.voided td.actions { text-decoration: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 4px; }
.kpi small { color: var(--muted); }
.kpi strong { font-size: 20px; }
.kpi.main { background: var(--brand); color: #fff; }
.kpi.main small { color: #ffffffcc; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col .table, .table.bordered { border: 1px solid var(--line); border-radius: var(--radius); }
h4 { margin: 6px 0; }
.settings-form { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 16px; max-width: 760px; }
.settings-form .form-grid { grid-template-columns: 1fr 1fr; }
.checks { display: grid; gap: 10px; }
.receipt-preview { display: grid; place-items: center; background: var(--bg); padding: 12px; border-radius: 10px; }
.receipt-preview .receipt { background: #fff; padding: 10px; box-shadow: 0 2px 8px #0001; }

@media (max-width: 860px) {
  .pos { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .cart { border-inline-start: none; border-top: 1px solid var(--line); max-height: 52vh; }
  .two-col, .settings-form .form-grid { grid-template-columns: 1fr; }
  .tb-mid { order: 3; flex-basis: 100%; }
  .user { display: none; }
}

/* receipt (80mm) */
.receipt { width: 72mm; font-size: 12px; color: #000; line-height: 1.35; padding: 0; margin: 0; box-sizing: border-box; }
.kitchen .k-number { font-size: 30px; font-weight: 900; margin: 4px 0; }
.k-item { display: flex; gap: 6px; font-size: 17px; font-weight: 700; padding: 3px 0; border-bottom: 1px dotted #000; }
.k-qty { min-width: 9mm; }
.k-mods { font-size: 13px; font-weight: 500; }
.k-note { font-size: 15px; font-weight: 700; }
.receipt hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }
.r-center { text-align: center; }
.r-title { font-size: 16px; font-weight: 800; }
.r-kind { font-weight: 700; margin-top: 4px; }
.r-branch { font-weight: 700; }
.r-void { font-size: 16px; font-weight: 800; border: 2px solid #000; margin: 4px 0; }
.r-row { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.r-big { font-size: 15px; font-weight: 800; }
.r-val { white-space: nowrap; }
.bi { display: inline-flex; gap: 4px; align-items: baseline; }
.bi small { font-size: 9px; }
.r-items { width: 100%; border-collapse: collapse; }
.r-items th { font-weight: 700; font-size: 10px; }
.r-items th .bi { flex-direction: column; gap: 0; }
.r-items td, .r-items th { padding: 2px 1px; text-align: start; vertical-align: top; }
.r-items td:not(:first-child), .r-items th:not(:first-child) { text-align: end; white-space: nowrap; }
.r-qr { width: 34mm; height: 34mm; image-rendering: pixelated; margin-top: 6px; }
.r-footer { margin-top: 6px; white-space: pre-line; }

#print-area { display: none; }
.paper-58mm .receipt { width: 48mm; font-size: 10.5px; }
.paper-a4 .receipt { width: 100%; font-size: 13px; }
.paper-a4 .r-title { font-size: 20px; }
.paper-a4 .r-qr { width: 30mm; height: 30mm; }
.r-logo { max-width: 60%; max-height: 22mm; margin-bottom: 4px; }
@media print {
  /* The app locks the page height on screen; printing must flow over as many pages as needed. */
  html, body { height: auto !important; overflow: visible !important; background: #fff; }
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: static; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area thead { display: table-header-group; }
  #print-area tr { break-inside: avoid; page-break-inside: avoid; }
  #print-area td, #print-area th { word-break: break-word; overflow-wrap: anywhere; }
  .a4-lines { table-layout: fixed; }
  .a4-lines th:first-child, .a4-lines td:first-child { width: 6mm; }
  .a4-lines th:nth-child(2), .a4-lines td:nth-child(2) { width: auto; }
  .a4-lines td:not(:nth-child(2)) { white-space: normal; }
  /* Thermal printers print ~72mm (80mm roll) / ~48mm (58mm roll) from the left edge: no padding,
     or the right side is cut off. */
  #print-area.paper-80mm { width: 72mm; padding: 0; margin: 0; }
  #print-area.paper-58mm { width: 48mm; padding: 0; margin: 0; }
  #print-area .page-break { break-before: page; page-break-before: always; height: 0; }
  #print-area.paper-a4 { width: 100%; }
  #app, #toasts, .modal-backdrop { display: none !important; }
}

/* customers at the till */
.cust-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 46px; }
.cust-chip { display: flex; align-items: baseline; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.cust-chip strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.ghost-dark { background: #f0f3f7; border-color: transparent; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #3d2c00; }
.pay.four { grid-template-columns: 1fr 1fr 1fr 1fr; }
.pay.four .btn.big { padding: 14px 4px; font-size: 16px; }
.cust-list { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.cust-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: start; }
.cust-row:hover { background: #eef3fb; }
.cust-row .pill { margin-inline-start: 6px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
details summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.split-grid.three { grid-template-columns: 1fr 1fr 1fr; }
input.bad { border-color: var(--danger); }
.r-small { font-size: 10px; }
@media (max-width: 860px) { .form-grid.two, .split-grid.three { grid-template-columns: 1fr; } }

/* A4 invoice */
.a4 { color: #000; font-size: 12px; line-height: 1.45; width: 100%; }
.receipt-preview .a4 { background: #fff; padding: 16px; width: 760px; max-width: 100%; }
.a4-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
.a4-title { font-size: 20px; font-weight: 800; }
.a4-title .bi { flex-direction: column; }
.a4-logo { max-height: 60px; max-width: 200px; }
.a4-store { font-size: 18px; font-weight: 800; }
.a4-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; margin-bottom: 10px; }
.a4-kv { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted #bbb; padding: 2px 0; }
.a4-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
.a4-party { border: 1px solid #000; padding: 8px; }
.a4-party-title { font-weight: 800; margin-bottom: 4px; }
.a4-lines { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.a4-lines th, .a4-lines td { border: 1px solid #000; padding: 4px 6px; text-align: start; }
.a4-lines th { background: #eee; font-size: 11px; }
.a4-lines th .bi { flex-direction: column; gap: 0; }
.a4-lines td:not(:nth-child(2)) { text-align: end; white-space: nowrap; }
.a4-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.a4-bottom .r-qr { width: 34mm; height: 34mm; }
.a4-totals { min-width: 300px; }
.a4-footer { margin-top: 14px; border-top: 1px solid #000; padding-top: 6px; white-space: pre-line; text-align: center; }

/* auth (self-service) */
.auth-card .brand { text-decoration: none; color: inherit; }
.auth-intro { text-align: center; }
.auth-intro h2 { margin: 0; font-size: 20px; }
.auth-intro p { margin: 4px 0 0; }
.center { text-align: center; justify-self: center; }
.store-pill { display: grid; gap: 2px; text-align: center; background: var(--bg); border-radius: 10px; padding: 10px; }
.auth-card.lock h2 { margin: 0; text-align: center; }
.auth-card.lock > p { text-align: center; margin: 0; }

/* plan */
.plan-badge, .complete-badge { overflow: hidden; text-overflow: ellipsis; max-width: 100%; border: 1px solid #e0a800; background: var(--warn); color: #3d2c00; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.plan-badge.warn { background: #ffb3b3; color: #5b0000; }
.offer { display: grid; gap: 2px; background: var(--tint); border: 1px solid #b9d6ff; border-radius: 12px; padding: 12px 14px; }
.offer span { font-size: 22px; font-weight: 800; color: var(--primary); }
.plan-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-inline-start: 6px solid var(--primary); border-radius: var(--radius); padding: 18px 20px; }
.plan-card.trial { border-inline-start-color: #e0a100; }
.plan-card.expired, .plan-card.trial_ended { border-inline-start-color: var(--danger); }
.plan-card h3 { margin: 2px 0; }
.plan-card p { margin: 0; }
.plan-actions { display: grid; gap: 6px; justify-items: end; }
.big-num { font-size: 26px; direction: ltr; unicode-bidi: isolate; }
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.meter { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; }
.meter-head, .meter-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar { height: 8px; background: #eef1f5; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); }
@media (max-width: 860px) { .meters { grid-template-columns: 1fr; } }

/* onboarding */
.onboarding { margin: 12px 14px 0; background: #fff; border: 1px solid #bfe8d5; border-radius: var(--radius); padding: 12px 14px; flex-shrink: 0; }
.ob-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ob-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.ob-step { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px 6px 8px; cursor: pointer; font: inherit; font-weight: 600; }
.ob-step.done { color: var(--muted); text-decoration: line-through; }
.ob-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; }
.ob-step.done .ob-n { background: var(--primary); }

/* Everything clickable looks like a button (no bare text links). */
.link {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}
.link:hover { background: var(--tint); }
.btn.outline { background: #fff; border: 2px solid var(--primary); color: var(--primary); }
details summary { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; list-style: none; }
details[open] summary { margin-bottom: 8px; }
.auth-foot { display: grid; gap: 8px; }
.auth-foot .btn { width: 100%; }

/* products with photos, empty till */
.tile.has-img { padding: 0; overflow: hidden; grid-row: span 2; }
.tile.has-img .tile-name, .tile.has-img .tile-foot { padding: 0 10px; }
.tile.has-img .tile-foot { padding-bottom: 8px; }
.tile-img { width: 100%; height: 110px; object-fit: cover; background: var(--bg); display: block; }
.add-tile { border: 2px dashed var(--primary); color: var(--primary); font-weight: 700; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.add-tile .plus { font-size: 30px; line-height: 1; }
.first-product { grid-column: 1 / -1; display: grid; place-items: center; padding: 60px 10px; }
.btn.huge { font-size: 22px; padding: 22px 34px; border-radius: 14px; }
.cart-empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.cart-icon { font-size: 40px; display: block; opacity: 0.5; }
.cart-empty p { margin: 6px 0 0; font-size: 16px; }
.photo-box { display: flex; align-items: center; gap: 14px; }
.photo-box img, .photo-empty { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: var(--bg); }
.photo-empty { display: grid; place-items: center; font-size: 34px; }
.photo-actions { display: grid; gap: 6px; }
.big-field { font-size: 18px; padding: 12px 14px; }
.thumb-cell { width: 52px; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--bg); }
details.help summary { display: inline-block; color: var(--primary); font-weight: 600; cursor: pointer; }
details.help { margin: 4px 0; }
.tb-mid .tab, .auth-tabs .tab { border: 1px solid var(--line); background: #fff; }
.tb-mid .tab.on, .auth-tabs .tab.on { background: var(--primary); color: #fff; border-color: var(--primary); }
/* no button may look like plain text */
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.ghost:hover { background: var(--tint); }
.qty-val { min-width: 40px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-decoration: none; }
.shift-bar:empty { display: none; }

.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 3px #dc354522; }
.field-err { color: var(--danger) !important; font-weight: 600; }

/* ── polish: one button look, icons, motion, skeletons ───────────────── */
:root { --shadow-sm: 0 1px 2px #10182814; --shadow: 0 4px 14px #1018281a; --shadow-lg: 0 18px 48px #10182829; --ease: cubic-bezier(.2, .8, .2, 1); }
.ic { flex-shrink: 0; vertical-align: middle; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, border-color .15s, box-shadow .15s, transform .08s; box-shadow: var(--shadow-sm); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { box-shadow: 0 2px 8px #0075ff40; }
.btn.primary:hover { background: #0066e0; filter: none; }
.btn.outline:hover { background: var(--tint); }
.btn.danger:hover { background: #fdecee; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 8px; }
.btn.small.icon-only { padding: 6px; }
.icon-btn { display: inline-grid; place-items: center; transition: background .15s, transform .08s; }
.icon-btn:hover { background: var(--tint); }
.icon-btn:active { transform: scale(.94); }
.tab { display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s; }
.pay .btn.big { flex-direction: column; gap: 4px; padding: 12px 6px; font-size: 15px; min-height: 70px; }
.pay-confirm { display: grid; justify-items: center; gap: 4px; color: var(--primary); padding-top: 8px; }
.pay-field > span { display: inline-flex; align-items: center; gap: 6px; }
.split-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.search-wrap { position: relative; }
.search-wrap .search-ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .search { padding-inline-start: 42px; }
.cart-icon { color: var(--primary); opacity: .35; }
.add-tile { gap: 6px; }
.status .ic { color: var(--primary); }
.status.off .ic { color: #b07a00; }
.cart { box-shadow: var(--shadow-sm); }
.tile { box-shadow: var(--shadow-sm); transition: transform .12s var(--ease), box-shadow .15s, border-color .15s; }
.tile:hover { box-shadow: var(--shadow); border-color: #b9d6ff; transform: translateY(-1px); }
.kpi, .meter, .plan-card, .table-wrap, .settings-form { box-shadow: var(--shadow-sm); }
.modal { box-shadow: var(--shadow-lg); }
.photo-empty { color: var(--muted); }
.thumb.empty { color: var(--muted); }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 40px 10px; color: var(--muted); text-align: center; }
.empty-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--primary); }

@keyframes wl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wl-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes wl-slide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes wl-in { from { opacity: 0; transform: translateX(var(--dx, 8px)); } to { opacity: 1; transform: none; } }
@keyframes wl-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.modal-backdrop { animation: wl-fade .15s ease-out; }
.modal { animation: wl-pop .2s var(--ease); }
.toast { animation: wl-slide .2s var(--ease); }
.line { animation: wl-in .18s var(--ease); }
[dir='rtl'] .line { --dx: -8px; }
.admin-body > * { animation: wl-fade .2s ease-out; }

.sk { background: linear-gradient(90deg, #eef1f5 25%, #f7f9fb 37%, #eef1f5 63%); background-size: 400% 100%; animation: wl-shimmer 1.3s ease-in-out infinite; border-radius: 10px; }
.sk-page { display: grid; gap: 14px; }
.sk-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sk-kpi { height: 66px; }
.sk-table { display: grid; gap: 8px; }
.sk-row { height: 42px; }
.sk-tile { height: 96px; }
.sk-lines { display: grid; gap: 10px; padding: 6px 0; }
.sk-line { height: 16px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.pm-list { display: grid; gap: 8px; }
.pm-row { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pm-row.off { opacity: .6; }
.pm-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--tint); color: var(--primary); }
.switch { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; background: #fff; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick .icon-btn { width: 42px; height: 42px; }
.icon-pick .icon-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pm-checks .check { gap: 6px; }

.mod-picker { display: grid; gap: 16px; }
.mod-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.mod-head .req { color: #8a6100; font-weight: 600; }
.mod-options { display: flex; flex-wrap: wrap; gap: 8px; }
.mod-opt { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.mod-opt small { color: var(--muted); font-weight: 500; }
.mod-opt.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.mod-opt.on small { color: #ffffffcc; }
.line-mods { color: var(--primary) !important; }
.r-mods { font-size: 10px; }
.mod-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mod-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; box-shadow: var(--shadow-sm); }
.mod-edit-list { display: grid; gap: 8px; }
.mod-edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto auto; gap: 8px; align-items: center; }

.rep-section h4 { margin: 4px 0 10px; }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.rep-card { display: grid; grid-template-columns: 46px 1fr 18px; align-items: center; gap: 12px; text-align: start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; font: inherit; box-shadow: var(--shadow-sm); transition: transform .12s var(--ease), box-shadow .15s, border-color .15s; }
.rep-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #b9d6ff; }
.rep-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--primary); }
.rep-txt { display: grid; gap: 2px; }
.rep-txt small { color: var(--muted); }
.rep-go { color: var(--muted); }
[dir='ltr'] .rep-go { transform: scaleX(-1); }
.rep-back { display: flex; align-items: center; gap: 12px; }
.rep-back h3 { margin: 0; }
[dir='ltr'] .rep-back .ic { transform: scaleX(-1); }
.table tfoot td { font-weight: 800; background: #fafbfc; border-top: 2px solid var(--line); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm); }
.bar-col { flex: 1 0 34px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar-fill { width: 100%; max-width: 46px; background: linear-gradient(180deg, #3d95ff, var(--primary)); border-radius: 8px 8px 3px 3px; animation: wl-grow .5s var(--ease); transform-origin: bottom; }
.bar-val { font-size: 10px; color: var(--muted); white-space: nowrap; }
.bar-col small { font-size: 11px; color: var(--muted); }
@keyframes wl-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.cart-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 12px 10px; }
.cart-tools .btn { width: 100%; justify-content: center; }

/* ── app shell: sidebar (start side = right in Arabic) + page ───────────── */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { background: #fff; border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 30; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sb-brand img { width: 30px; height: 30px; }
.sb-brand div { display: grid; min-width: 0; }
.sb-brand strong, .sb-brand small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px; display: grid; align-content: start; gap: 6px; }
.sb-group { display: grid; gap: 2px; }
.sb-title { font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 10px 2px; }
.sb-item { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: transparent; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--ink); text-align: start; }
.sb-item:hover { background: var(--bg); }
.sb-item.on { background: var(--tint); color: var(--primary); }
.sb-item.sb-pos { background: var(--primary); color: #fff; margin: 2px 0 4px; }
.sb-item.sb-pos:hover { filter: brightness(1.05); }
.sb-foot { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; }
.sb-user { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.sb-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.page { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pagebar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); min-height: 56px; }
.pagebar h2 { margin: 0; font-size: 19px; }
.pagebar .branch-select { width: auto; min-width: 140px; }
.hamburger { display: none !important; }
.scrim { display: none; }
.spacer { flex: 1; }
.page-body { flex: 1; overflow-y: auto; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(290px, 86vw); transform: translateX(100%); transition: transform 0.22s ease; box-shadow: 0 0 40px #0003; }
  [dir='ltr'] .sidebar { transform: translateX(-100%); }
  .sidebar.open, [dir='ltr'] .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: #0005; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 25; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .hamburger { display: inline-flex !important; }
  .pagebar { padding: 8px 10px; gap: 8px; }
  .pagebar h2 { font-size: 17px; }
  .pagebar .status { display: none; }
  .admin-body { padding: 10px; }
  .two-col { grid-template-columns: 1fr !important; }
  .toolbar .field { min-width: 0; flex: 1 1 140px; }
  .kpis { grid-template-columns: repeat(2, 1fr) !important; }
  .modal { width: 100% !important; max-height: 94vh; border-radius: 16px 16px 0 0 !important; align-self: end; }
  .modal-backdrop { align-items: end !important; padding: 0 !important; }
}

/* ── point of sale header + start screen ─────────────────────────────── */
.pos-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); min-height: 52px; }
.pos-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pos-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-entry { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.picker-page { flex: 1; overflow-y: auto; padding: 18px; }
.reg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; max-width: 980px; margin: 0 auto; }
.reg-card { display: grid; justify-items: center; gap: 6px; padding: 22px 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; text-align: center; transition: transform 0.12s, box-shadow 0.12s; }
.reg-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px #0001; }
.reg-card .reg-ic { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: var(--tint); color: var(--primary); }
.reg-card.busy { border-color: #ffe08a; }
.reg-card.busy .reg-ic { background: var(--warn-bg); color: #8a6100; }
.reg-card.here { border-color: var(--primary); }
.reg-card strong { font-size: 17px; }

/* ── home ─────────────────────────────────────────────────────────────── */
.home { display: grid; gap: 14px; }
.home h4 { margin: 4px 0 0; }
.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick { display: flex; align-items: center; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font-weight: 700; font-size: 15px; text-align: start; }
.quick:hover { box-shadow: 0 6px 18px #0001; }
.quick .quick-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--tint); color: var(--primary); flex-shrink: 0; }
.quick.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.quick.primary .quick-ic { background: #ffffff26; color: #fff; }
.kpi .kpi-ic { color: var(--primary); display: inline-flex; }
.kpi.good strong { color: #198754; }
.card-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.card-box h4 { margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.home-reg { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.home-reg:last-of-type { border-bottom: none; }
.grow { flex: 1; min-width: 0; }
.home-bars { height: 170px; }
.bar-col.today .bar-fill { background: var(--primary); }
.warn { color: #c78a00; }
@media (max-width: 900px) { .quick-row { grid-template-columns: repeat(2, 1fr); } }

/* ── shared dashboard pieces ──────────────────────────────────────────── */
.sub-body { display: grid; gap: 12px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f7faff; }
.row-gap { display: flex; gap: 6px; align-items: center; }
.row-gap select { flex: 1; }
.form-grid.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.form-grid.narrow { max-width: 560px; }
@media (max-width: 700px) { .form-grid.three, .form-grid.two { grid-template-columns: 1fr !important; } }
.notice.soft { background: var(--tint); border-color: #cfe2ff; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.section-head h4 { margin: 0; display: flex; align-items: center; gap: 6px; }
.reg-list { display: grid; gap: 8px; }
.reg-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: start; width: 100%; }
.reg-row:hover { border-color: var(--primary); }
.reg-row.off { opacity: 0.6; }
.reg-row .reg-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--tint); color: var(--primary); flex-shrink: 0; }
.reg-row .grow { display: grid; gap: 2px; }
.style-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-opt { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.style-opt input { display: none; }
.style-opt:has(input:checked) { border-color: var(--primary); background: var(--tint); color: var(--primary); }
.sub-list { display: grid; gap: 6px; }
.sub-row { display: flex; gap: 6px; align-items: center; }
.sub-row input:not(.grow) { width: 110px; flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-x { border: none; background: transparent; color: inherit; cursor: pointer; padding: 0 0 0 2px; display: inline-flex; vertical-align: middle; }
.btn.disabled { opacity: 0.45; pointer-events: none; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.copy-row input { font-size: 12px; color: var(--muted); }

/* accounting */
.statement { gap: 0; }
.st-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.st-row.sub { font-weight: 700; border-bottom: 1px solid var(--ink); }
.st-row.grand { font-weight: 800; font-size: 17px; border-bottom: none; padding-top: 10px; }
.st-row.grand.pos .mono { color: #198754; }
.st-row.grand.neg .mono, .st-row .mono:has(+ *) { color: inherit; }
.st-row.grand.neg .mono { color: var(--danger); }
.st-head { font-weight: 800; color: var(--muted); font-size: 13px; padding: 12px 0 2px; }
.st-check { display: flex; align-items: center; gap: 6px; font-weight: 700; padding: 8px 10px; border-radius: 10px; margin-top: 8px; }
.st-check.ok { background: #e8f7ee; color: #146c43; }
.st-check.bad { background: #fdecec; color: var(--danger); }
.acc-group h4 { margin: 8px 0 6px; }
.jv-lines { display: grid; gap: 6px; }
.jv-line { display: grid; grid-template-columns: 1fr 120px 120px; gap: 6px; }
@media (max-width: 700px) { .jv-line { grid-template-columns: 1fr 1fr; } .jv-line select { grid-column: 1 / -1; } }
.remaining.bad { color: var(--danger); }

/* purchases */
.pl-head { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.pl-lines { display: grid; gap: 8px; margin: 10px 0; }
.pl-line { display: grid; grid-template-columns: 1fr 90px 110px 80px auto; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pl-line .pl-name { align-self: center; }
.pl-extra { grid-column: 1 / -1; display: flex; gap: 6px; }
@media (max-width: 700px) { .pl-line { grid-template-columns: 1fr 1fr; } .pl-name { grid-column: 1 / -1; } }

/* till additions */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pick { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 600; display: grid; gap: 4px; justify-items: center; text-align: center; }
.pick:hover { border-color: var(--primary); }
.pick.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pick.variant span { color: var(--primary); font-weight: 700; }
.line-offer { color: #198754; display: inline-flex; align-items: center; gap: 2px; }
.offer-row { color: #198754; }
.note-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; font-size: 13px; max-width: 180px; overflow: hidden; }
.tile-variants { color: var(--muted); font-weight: 500; font-size: 12px; }
.redeem-row { display: flex; gap: 8px; align-items: end; }
.wallet-history { display: grid; max-height: 220px; overflow-y: auto; }
.cust-bar { flex-wrap: wrap; }

/* sale layouts */
.grid.style-list { grid-template-columns: 1fr !important; gap: 6px; }
.grid.style-list .tile { flex-direction: row; align-items: center; justify-content: space-between; min-height: 0; padding: 12px 14px; aspect-ratio: auto; }
.grid.style-list .tile-name { -webkit-line-clamp: 1; }
.grid.style-list .tile-foot { gap: 10px; }
.grid.style-compact { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)) !important; gap: 6px; }
.grid.style-compact .tile { min-height: 72px; padding: 8px; }
.grid.style-compact .tile-name { font-size: 13px; }
.grid.size-s { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.grid.size-l { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid.size-l .tile-name { font-size: 17px; }
.grid.style-compact.size-s { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)) !important; }
.grid.style-compact.size-l { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; }

/* public invoice page */
.public-invoice { overflow: auto !important; height: auto !important; }
.public-invoice #app { height: auto; }
.public-wrap { max-width: 820px; margin: 0 auto; padding: 16px; display: grid; gap: 12px; }
.public-bar { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.grid.style-list { grid-auto-rows: auto; }
.grid.style-compact { grid-auto-rows: 72px; }
.grid.size-l:not(.style-list) { grid-auto-rows: 120px; }
/* Everything tappable looks tappable: menu items are light buttons, ghost buttons in bars get a border. */
.sb-item { background: #f5f7fa; }
.sb-item:hover { background: #edf1f6; }
.pos-bar .btn.ghost, .sb-actions .btn.ghost, .pagebar .btn.ghost, .cust-bar .btn.ghost { border-color: var(--line); }
.pos-title .branch-name::before { content: ' · '; }
@media (max-width: 700px) { .pos-title .branch-name, .pos-bar .status { display: none; } }
/* customer at the till: name + small figures on one line, the buttons below */
.cust-bar .cust-chip { flex: 1 1 100%; flex-wrap: wrap; row-gap: 2px; }
.cust-chip small { white-space: nowrap; direction: rtl; unicode-bidi: isolate; font-family: inherit; }
[dir='ltr'] .cust-chip small { direction: ltr; }
@media (max-width: 860px) {
  .cart-tools { display: flex !important; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; gap: 6px; padding: 0 8px 8px; scrollbar-width: none; }
  .cart-tools .btn { flex: 0 0 auto; width: auto !important; }
  .pos-bar .btn.danger span, .pos-bar .back-btn span { display: none; }
  .pos-title small { display: none; }
  .pos-title strong { max-width: 46vw; }
  .cart { max-height: 60vh; min-width: 0; }
  .pos { grid-template-columns: minmax(0, 1fr) !important; }
  .catalog { min-width: 0; }
}

/* product labels */
.labels .label { width: 50mm; height: 30mm; padding: 1.5mm 2mm; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; page-break-after: always; break-after: page; color: #000; }
.labels.label-38x25 .label { width: 38mm; height: 25mm; }
.labels.a4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2mm; }
.labels.a4 .label { width: auto; height: 30mm; border: 0.2mm dashed #999; page-break-after: auto; break-after: auto; }
.lb-store { font-size: 7px; }
.lb-name { font-size: 9px; font-weight: 700; line-height: 1.1; max-height: 2.3em; overflow: hidden; }
.lb-bc { width: 100%; height: 9mm; }
.lb-bc svg { width: 100%; height: 100%; }
.lb-code { font-size: 8px; }
.lb-price { font-size: 11px; font-weight: 800; }
.p-section { display: grid; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.p-section h4 { margin: 0; font-size: 14px; color: var(--muted); }
.form-grid.four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 700px) { .form-grid.four { grid-template-columns: 1fr 1fr; } }
.gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.g-slot { width: 72px; height: 72px; border: 1px dashed var(--line); border-radius: 10px; position: relative; display: grid; place-items: center; overflow: hidden; }
.g-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.g-slot .btn { position: relative; z-index: 1; }
.line-price { border: 1px dashed var(--line); background: #fff; border-radius: 6px; padding: 0 6px; font-size: 12px; color: var(--muted); cursor: pointer; display: inline-flex; gap: 3px; align-items: center; width: fit-content; }
.switch-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-weight: 600; font-size: 13px; cursor: pointer; }
.switch-chip input { width: 16px; height: 16px; }
.switch-chip:has(input:checked) { background: var(--warn-bg); border-color: #ffe08a; }
.coupon-row { display: flex; gap: 8px; align-items: end; }
.coupon-row .field { flex: 1; }
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.perm-group summary { display: flex; justify-content: space-between; align-items: center; font-weight: 700; cursor: pointer; padding: 4px 0; }
.perm { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.perm input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.perm span { display: grid; gap: 2px; }
.perm small { color: var(--muted); }
.reg-row.static { cursor: default; }
.mod-edit-row .mod-stock { width: 150px; }
.mod-edit-row .mod-qty { width: 64px; }
.jv-line.wide { grid-template-columns: 1fr 110px 110px 1fr 140px; }
@media (max-width: 800px) { .jv-line.wide { grid-template-columns: 1fr 1fr; } .jv-line.wide select:first-child { grid-column: 1 / -1; } }
.sub-account { padding-inline-start: 14px; color: var(--ink); }
.pill.warn { background: var(--warn-bg); color: #8a6100; }
.pill.danger { background: #fdecec; color: var(--danger); }
.attach { display: grid; gap: 6px; border-top: 1px dashed var(--line); padding-top: 8px; }
.attach-row { display: flex; align-items: center; gap: 8px; }
.alloc-list { display: grid; gap: 6px; }
.pl-search { align-items: flex-start; }
.r-bc { height: 12mm; margin: 4px 0; }
.r-bc svg { width: 70%; height: 100%; }
.r-footer-img { max-width: 50%; max-height: 30mm; margin-top: 4px; }
.kpi.bad strong { color: var(--danger); }
/* label + select rows (routing, payment method accounts): half and half */
.sub-row > span.grow { min-width: 0; }
.sub-row > span.grow + select { flex: 0 0 52%; width: 52%; }
@media (max-width: 600px) { .sub-row:has(> span.grow + select) { flex-wrap: wrap; } .sub-row > span.grow + select { flex-basis: 100%; width: 100%; } }

/* Saudi mobile input: flag + country code + number (always left-to-right). */
.phone-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 12px; cursor: text; }
.phone-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint); }
.phone-input .flag { display: inline-flex; flex: none; }
.phone-input .flag svg { border-radius: 2px; box-shadow: 0 0 0 1px #0001; }
.phone-input .cc { color: var(--muted); font-weight: 600; flex: none; }
.phone-input input { border: none !important; box-shadow: none !important; outline: none; background: transparent; padding-inline: 0 !important; flex: 1; min-width: 0; letter-spacing: .04em; }
.phone-input.big input { font-size: 20px; font-weight: 700; }
.phone-input:has(input.bad) { border-color: var(--danger); }

/* Sign-up: confirm the mobile by SMS. */
.verify-card .auth-intro { text-align: center; }
.verify-ic { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--tint); color: var(--primary); margin-bottom: 6px; }
.verify-number { font-size: 26px; font-weight: 700; letter-spacing: .06em; margin: 6px 0; unicode-bidi: isolate; }

/* Points of sale: branch chips + a card per point of sale with its own buttons. */
.reg-branches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.reg-card .reg-actions { display: grid; gap: 6px; width: 100%; margin-top: 6px; }
.reg-card > .btn { width: 100%; margin-top: 6px; }
div.reg-card { cursor: default; }

/* Sidebar accordion: a section header (button) folds its pages; the arrow turns when open. */
.sb-head { display: flex; align-items: center; justify-content: space-between; width: 100%; border: none; background: #f5f7fa; border-radius: 10px; padding: 9px 10px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); text-align: start; }
.sb-head:hover { background: #edf1f6; color: var(--ink); }
.sb-acc.open .sb-head { color: var(--ink); }
.sb-chev { transition: transform .2s var(--ease, ease); }
.sb-acc.open .sb-chev { transform: rotate(180deg); }
.sb-items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s var(--ease, ease); }
.sb-acc.open .sb-items { grid-template-rows: 1fr; }
.sb-items > div { overflow: hidden; display: grid; gap: 2px; padding-inline-start: 6px; }
.sb-acc.open .sb-items > div { padding-top: 2px; }
.sb-items > div { visibility: hidden; transition: visibility 0s .22s; }
.sb-acc.open .sb-items > div { visibility: visible; transition: none; }

/* Home: the filter (period chips, dates, branch) and wide, even summary cards. */
.home-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.home-filter .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.home-custom { display: flex; align-items: center; gap: 8px; }
.home-custom input { width: auto; }
.home-branch { width: auto; min-width: 180px; }
.home-kpis { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important; gap: 12px; }
.home-kpis .kpi { padding: 18px 20px; gap: 6px; border-radius: 14px; }
.home-kpis .kpi small { font-size: 14px; }
.home-kpis .kpi strong { font-size: 26px; }
.home-kpis .kpi.main { background: var(--primary); border-color: var(--primary); color: #fff; }
.home-kpis .kpi.main small, .home-kpis .kpi.main .kpi-ic { color: #fff; }
.home-bars.dense .bar-col small { font-size: 9px; }
@media (max-width: 640px) { .home-kpis { grid-template-columns: repeat(2, 1fr) !important; } .home-kpis .kpi strong { font-size: 20px; } }

/* Till: one pay button, park + More under it. */
.pay { grid-template-columns: 1fr !important; }
.pay-btn { width: 100%; font-size: 20px; padding: 16px; justify-content: center; }
.cart-tools { justify-content: stretch; gap: 8px; padding: 0 14px 12px; }
.cart-tools .btn { flex: 1; justify-content: center; }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.more-grid .btn { justify-content: flex-start; padding: 14px; background: #f5f7fa; }

/* Pay window: who → total → how → details. */
.pay-sheet { display: grid; gap: 14px; }
.pay-who { display: grid; gap: 8px; }
.pay-who-row { display: flex; align-items: center; gap: 10px; background: #f5f7fa; border-radius: 12px; padding: 8px 12px; min-height: 48px; }
.pay-who-row .grow { flex: 1; min-width: 0; }
.pay-seller { width: auto; min-width: 160px; }
.pay-due { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.pay-due span { font-weight: 700; font-size: 18px; }
.pay-due strong { font-size: 32px; direction: ltr; unicode-bidi: isolate; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pay-method { display: grid; justify-items: center; gap: 6px; padding: 14px 8px; border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.pay-method:hover { border-color: #b8d4ff; }
.pay-method.on { border-color: var(--primary); background: var(--tint); color: var(--primary); }
.pay-method.warn.on { border-color: #e0a800; background: var(--warn-bg); color: #8a6100; }
.pay-panel { min-height: 120px; }

/* After a sale / quotation / return / drawer cash. */
.done-sheet { display: grid; justify-items: center; gap: 12px; text-align: center; }
.done-ic { color: #198754; }
.done-number { font-size: 20px; font-weight: 800; }
.done-sheet .sums { width: 100%; max-width: 380px; }
.done-big { display: grid; gap: 2px; background: var(--tint); color: var(--primary); border-radius: 14px; padding: 12px 24px; }
.done-big strong { font-size: 34px; direction: ltr; unicode-bidi: isolate; }
.done-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; width: 100%; max-width: 380px; }
.pay-side { display: grid; gap: 14px; align-content: start; }
@media (min-width: 900px) {
  .pay-sheet { grid-template-columns: 1.1fr 1fr; align-items: start; gap: 20px; }
  .pay-panel { border-inline-start: 1px solid var(--line); padding-inline-start: 20px; }
}
/* (.modal comes later in this file, so the wide sizes need the extra class to win.) */
.modal.modal-wide { width: min(560px, 100%); }
.modal.modal-xl { width: min(980px, 100%); }
.modal.modal-xl:has(.pay-sheet) { width: min(880px, 100%); }
.sum-head { font-size: 12px; font-weight: 800; color: var(--muted); padding: 10px 0 2px; border-bottom: 1px solid var(--line); }

/* ── Settings: cards, switches, a save bar that lights up when something changed ── */
.set-form { display: grid; gap: 16px; padding-bottom: 8px; }
.set-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm, 0 1px 2px #0000000d); }
.set-head { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fbfcfe, #fff); }
.set-head h3 { margin: 0; font-size: 16px; }
.set-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.set-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--tint); color: var(--primary); }
.set-body { display: grid; gap: 4px; padding: 14px 18px 16px; }
.set-body > .form-grid { margin-top: 6px; }
.set-actions { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.set-link { display: flex; align-items: flex-end; padding-bottom: 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 2px; border-bottom: 1px dashed var(--line); cursor: pointer; }
.switch-row:last-child { border-bottom: none; }
.sw-text { display: grid; gap: 2px; }
.sw-text strong { font-weight: 600; }
.sw-text small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; padding: 0; border: none; border-radius: 999px; background: #cfd6e0; position: relative; cursor: pointer; transition: background .18s; }
input.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; transition: inset-inline-start .18s; }
input.switch:checked { background: var(--primary); }
input.switch:checked::after { inset-inline-start: 21px; }
input.switch:focus-visible { outline: 3px solid #0075ff55; outline-offset: 2px; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-top: 4px; background: #ffffffee; backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -6px 18px #0000000a; }
.save-bar .save-note { color: var(--muted); font-size: 13px; }
.save-bar .save-ic { color: #198754; }
.save-bar.dirty { border-color: #ffd65a; background: #fffbea; }
.save-bar.dirty .save-note { color: #8a6100; font-weight: 600; }
.save-bar.dirty .save-ic { color: #e0a800; }
.tz-clock { color: var(--muted); }
.set-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.set-preview { position: sticky; top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; }
.set-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preview-branch { width: auto; max-width: 180px; padding: 6px 10px; }
.pic-slot { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pic-slot:last-child { border-bottom: none; }
.pic-slot .grow { display: grid; gap: 3px; }
.pic-box { flex: none; width: 84px; height: 64px; border: 1px dashed #c9d2de; border-radius: 12px; display: grid; place-items: center; color: var(--muted); background: #fafbfd; overflow: hidden; }
.pic-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pic-actions { display: flex; gap: 6px; margin-top: 4px; }
.set-sub { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.set-sub > div { display: grid; }
.set-sub small { color: var(--muted); }
@media (max-width: 960px) { .set-split { grid-template-columns: 1fr; } .set-preview { position: static; } }

/* ── Points of sale: tidy tiles; ⚙ settings in the corner; the "add" tile ── */
.reg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.reg-card { position: relative; align-content: start; min-height: 220px; }
.reg-card .reg-gear { position: absolute; top: 8px; inset-inline-end: 8px; }
.reg-card.off { opacity: .6; background: #fafbfd; }
.reg-card.fresh { border-color: var(--primary); box-shadow: 0 0 0 4px var(--tint); }
.reg-card.fresh .reg-gear { background: var(--tint); color: var(--primary); }
.reg-add { border: 2px dashed #b8d4ff; background: #f7faff; color: var(--primary); font: inherit; justify-content: center; align-content: center; cursor: pointer; }
.reg-add:hover { background: var(--tint); }
.reg-add .reg-ic { background: #fff; }
.mysr-box { min-height: 120px; } .mysr-box .mysr-form { margin: 0 auto; }
.warn-note { background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; margin: 0; }

/* Sidebar «Point of sale»: stays blue on hover / when current; its ⚙ opens the points of sale. */
.sb-item.sb-pos, .sb-item.sb-pos.on { background: var(--primary); color: #fff; }
.sb-item.sb-pos:hover { background: #1a85ff; filter: none; }
.sb-item.sb-pos.on { box-shadow: 0 0 0 3px var(--tint); }
.sb-pos-wrap { display: flex; gap: 6px; align-items: stretch; margin: 2px 0 4px; }
.sb-pos-wrap .sb-item.sb-pos { margin: 0; flex: 1; }
.sb-pos-manage { flex: none; border-radius: 10px; background: var(--tint); color: var(--primary); border: none; }
.sb-pos-manage:hover { background: #d6e7ff; }

/* "?" next to a setting: a round blue button that opens its explanation. */
.help-btn { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font: inherit; font-weight: 800; font-size: 15px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px #0075ff55; vertical-align: middle; }
.help-btn:hover { filter: brightness(1.1); }
.help-btn:focus-visible { outline: 3px solid #0075ff55; outline-offset: 2px; }
.help-body p { margin: 0 0 8px; line-height: 1.7; }

.sw-end { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.set-readonly { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; align-self: end; }
/* (the "full width" rule for a tile's main button must not stretch its ⚙) */
.reg-card > .btn.reg-gear { width: 34px; height: 34px; margin: 0; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; background: #f5f7fa; }
.reg-card > .btn.reg-gear:hover { background: var(--tint); color: var(--primary); }

/* Sidebar: one text size for every line — pages, the point of sale and the section headers. */
.sb-item, .sb-head, .sb-item.sb-pos { font-size: 15px; font-weight: 600; line-height: 1.4; }
.sb-head { color: var(--ink); }
.sb-head:hover, .sb-acc.open .sb-head { color: var(--ink); }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Subscription: yearly / monthly plan cards, the period switch, Tamara, the complete-your-account card. */
.plan-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.plan-pick { display: grid; gap: 4px; justify-items: start; text-align: start; padding: 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; cursor: pointer; }
.plan-pick:hover { border-color: #b8d4ff; }
.plan-pick.on { border-color: var(--primary); background: var(--tint); }
.plan-pick .plan-price { font-size: 22px; font-weight: 800; direction: ltr; unicode-bidi: isolate; }
.plan-pick .plan-price small { font-size: 13px; font-weight: 600; color: var(--muted); margin-inline-start: 4px; }
.period-switch { display: flex; gap: 6px; }
.tamara-btn { width: 100%; justify-content: center; padding: 12px; background: #fff7f0; border: 1px solid #f5c39a; color: #3a2a1a; }
.tamara-btn strong { font-weight: 900; letter-spacing: .02em; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or-line::before, .or-line::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.complete-card { border-color: #b8d4ff; background: linear-gradient(180deg, var(--tint), #fff 60%); margin-bottom: 14px; }
.complete-head { display: flex; gap: 10px; align-items: flex-start; color: var(--primary); }
.complete-head h4 { margin: 0; color: var(--ink); }
@media (max-width: 640px) { .plan-picks { grid-template-columns: 1fr; } }

/* ── one size system: controls and buttons share heights (sm 34 · md 42 · lg 52) ── */
input.ctl:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select.ctl, input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select { min-height: 42px; }
input.ctl[type=checkbox], input.ctl[type=radio] { min-height: 0; }
textarea.ctl, textarea { min-height: 84px; }
.btn { min-height: 42px; padding-block: 0; line-height: 1.2; font-size: 15px; }
.btn.small { min-height: 34px; font-size: 13px; padding-block: 0; }
.btn.big { min-height: 52px; font-size: 17px; padding-block: 0; }
.btn.huge { min-height: 60px; }
.btn.icon-only { min-width: 42px; padding-inline: 0; }
.btn.small.icon-only { min-width: 34px; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-row > .btn { margin: 0; }
.modal-actions .btn { min-height: 42px; font-size: 15px; padding-inline: 18px; }
.icon-btn.chip-x { width: auto; height: auto; min-height: 0; padding: 0 0 0 2px; background: transparent; }

/* Every text input and select is exactly 42px (big amounts, codes and the till search are their own size). */
input.ctl:not([type=checkbox]):not([type=radio]):not([type=file]):not(.big-input):not(.otp-input):not(.search), select.ctl:not(.big-input) { height: 42px; min-height: 42px; padding-block: 0; box-sizing: border-box; }

/* ═══ Phones (≤ 640px): no zoom, one type scale, full-screen windows, tidy grids ═══ */
@media (max-width: 640px) {
  /* iOS zooms into any field under 16px: every field is 16px on phones. */
  input, select, textarea, .ctl { font-size: 16px !important; }
  /* One type scale: body 15, small 13, buttons 15 (14 small), titles 18/16. */
  body, .btn, .sb-item, .sb-head, .chip, td, th, label, .field > span { font-size: 15px; }
  .btn.small, small, .small, .muted.small { font-size: 13px; }
  .pagebar h2 { font-size: 18px; }
  h3, .modal-head h3 { font-size: 17px; }
  h4 { font-size: 15px; }

  /* Windows: the whole screen; the title stays on top, the buttons stay at the bottom, full width. */
  .modal-backdrop { align-items: stretch !important; padding: 0 !important; }
  .modal, .modal.modal-wide, .modal.modal-xl, .modal.modal-xl:has(.pay-sheet) { width: 100vw !important; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; display: flex; flex-direction: column; animation: wl-sheet-up .22s var(--ease, ease); }
  .modal-head { position: sticky; top: 0; z-index: 2; background: #fff; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
  .modal-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 14px; }
  .modal-actions { position: sticky; bottom: 0; z-index: 2; background: #fff; display: flex; gap: 8px; padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px #0b1b330d; }
  .modal-actions .btn { flex: 1 1 0; min-height: 46px; margin: 0; }
  .form-grid.two, .form-grid.three, .split-grid, .split-grid.three { grid-template-columns: 1fr; }

  /* Cards: two per row, full width — never one narrow card with empty space beside it. */
  .kpis, .home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .plan-picks { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .plan-actions { justify-items: stretch; min-width: 0; }
  .plan-pick { min-width: 0; padding: 12px; }
  .plan-pick .plan-price small { display: block; margin: 2px 0 0; }
  .plan-card { flex-direction: column; align-items: stretch; padding: 16px; }
  .plan-card > * { width: auto; min-width: 0; max-width: 100%; }
  .meters, .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .two-col { grid-template-columns: 1fr !important; }
  .rep-grid, .reg-grid, .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .card-box { padding: 14px; }
  .meter { min-width: 0; padding: 12px; }
  .meter > *, .meter-foot > * { min-width: 0; }
  .meter-foot .btn { width: 100%; height: auto; min-height: 40px; white-space: normal; line-height: 1.35; padding-block: 6px; }
  /* an odd last card takes the whole row instead of leaving a hole beside it */
  .meters > :last-child:nth-child(odd), .kpis > :last-child:nth-child(odd), .home-kpis > :last-child:nth-child(odd), .rep-grid > :last-child:nth-child(odd), .more-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .plan-pick .plan-price { font-size: 18px; white-space: nowrap; }
  .home-filter .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .home-filter .chips::-webkit-scrollbar { display: none; }
  .home-filter .chips .chip { flex: none; }
  .home-kpis .kpi { padding: 14px; gap: 4px; }

  /* Sidebar foot: language · support · sign out on one line. */
  .sb-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .sb-actions .btn { padding-inline: 6px; justify-content: center; min-width: 0; }
  .sb-actions .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Toolbars wrap neatly; buttons in them share the row. */
  .toolbar { gap: 8px; }
  .toolbar > .btn, .toolbar > .btn-row { flex: 1 1 auto; }
  .page-body, .admin-body { padding: 12px; }
}
@keyframes wl-sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Complete-your-details: the same yellow badge as the plan's. */
.complete-badge { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 6px; }
.sb-actions { display: flex; flex-wrap: nowrap; gap: 6px; }
.sb-actions .btn { flex: 1 1 0; min-width: 0; }

/* Settings → Start over: keep tiles, what goes, the undo banner. */
.reset-keep { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 18px; }
.reset-tile { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; text-align: start; cursor: pointer; font: inherit; min-height: 64px; }
.reset-tile.on { border-color: var(--primary); background: var(--tint, #eef5ff); }
.reset-tile-ic { color: var(--muted); display: inline-flex; flex: none; }
.reset-tile.on .reset-tile-ic { color: var(--primary); }
.reset-tile-txt { display: grid; gap: 2px; min-width: 0; }
.reset-tile-txt small { color: var(--muted); font-size: 13px; }
.reset-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.reset-chip { background: #fdecee; color: #8a1c1c; border: 1px solid #f3c6cb; border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.reset-chip b { font-weight: 800; }
.reset-always, .reset-safe { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.reset-always > svg, .reset-safe > svg { flex: none; margin-top: 3px; color: var(--primary); }
.reset-go { margin-top: 18px; width: 100%; }
.set-ic.danger { color: var(--danger); background: #fdecee; }
.reset-undo { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius); background: #fff8e1; border: 1px solid #f1d27a; }
.reset-undo > div { flex: 1; min-width: 0; }
.reset-undo p { margin: 2px 0 0; }
@media (max-width: 640px) {
  .reset-keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reset-keep > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* option rows in the modifiers window: name · price · default, then stock item · qty · delete */
  .mod-edit-row { grid-template-columns: minmax(0, 1fr) 88px auto; }
  .mod-edit-row > .mod-stock { width: 100%; }
  .mod-edit-row > .mod-qty { width: 100%; }
  /* page tabs: one row that slides sideways instead of three wrapped rows */
  .subtabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
  .subtabs::-webkit-scrollbar { display: none; }
  .subtabs > * { flex: none; }
  .reset-undo { flex-wrap: wrap; }
  .reset-undo .btn { width: 100%; }
}
