/* Theme Option 1 (original): dark */
:root {
  --bg: #0f1420;
  --panel: #161d2e;
  --panel2: #1c2438;
  --border: #2a3450;
  --text: #e8ecf4;
  --muted: #8b94a7;
  --accent: #3b6ef5;
  --accent2: #2554d8;
  --green: #2ebd6b;
  --red: #e5484d;
  --yellow: #f0b429;
  --shadow: none;
}
/* Theme Option 2: Square-style light */
body[data-theme="square"] {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel2: #f0f1f3;
  --border: #dcdfe4;
  --text: #1a1d21;
  --muted: #6f767f;
  --accent: #006aff;
  --accent2: #0056d6;
  --green: #00a83a;
  --red: #cc2127;
  --yellow: #9a6b00;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
body[data-theme="square"] .panel,
body[data-theme="square"] .card,
body[data-theme="square"] .table-wrap,
body[data-theme="square"] .home-tile,
body[data-theme="square"] .reg-cart,
body[data-theme="square"] .reg-totals,
body[data-theme="square"] .reg-banner,
body[data-theme="square"] .reg-bottom,
body[data-theme="square"] .totals,
body[data-theme="square"] .login-box,
body[data-theme="square"] .modal { box-shadow: var(--shadow); }
body[data-theme="square"] .pad.cash { background: #35393f; }
body[data-theme="square"] .pad.cash.next { background: #4a4f57; }
body[data-theme="square"] .rbtn.hold { background: #35393f; }
body[data-theme="square"] .dept { background: #fff; }
body[data-theme="square"] .dept:hover { background: #f0f6ff; }
body[data-theme="square"] .entry-display { background: #fff; }
body[data-theme="square"] .pin-pad button { background: #fff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.green { color: var(--green); } .red { color: var(--red); } .yellow { color: var(--yellow); }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
a { color: var(--accent); cursor: pointer; }

/* layout */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 14px; background: var(--panel); border-bottom: 1px solid var(--border); padding: 8px 16px; flex-shrink: 0; }
.tb-home { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font-size: 15px; font-weight: 700; cursor: pointer; }
.tb-home:hover { background: var(--accent2); }
.tb-title { display: flex; align-items: baseline; gap: 8px; }
.tb-logo { width: 34px; height: 34px; }
.brand-sm { font-weight: 800; font-size: 16px; }
.tb-store { color: var(--muted); font-size: 14px; border-left: 1px solid var(--border); padding-left: 8px; }
.tb-view { color: var(--muted); font-size: 14px; }
.login-logo { width: 68px; height: 68px; margin-bottom: 6px; }
.login-product { font-weight: 800; font-size: 22px; letter-spacing: .5px; }
.reg-banner-row { display: flex; gap: 8px; align-items: stretch; }
.reg-blogo { width: 42px; height: 42px; flex-shrink: 0; align-self: center; }
.reg-banner-row .reg-banner { flex: 1; }
.home-support { position: fixed; right: 18px; bottom: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px 16px; font-size: 14px; box-shadow: var(--shadow); }
.home-support b { color: var(--accent); }
.topbar .spacer { flex: 1; }
.tb-support { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tb-support b { color: var(--text); }
@media (max-width: 760px) { .tb-support { display: none; } }

/* home screen */
.home { max-width: 1000px; margin: 0 auto; }
.home-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0 22px; }
.home-store { font-size: 26px; font-weight: 800; }
.home-stats { display: flex; gap: 12px; }
.home-stat { background: var(--panel); border-radius: 10px; padding: 10px 18px; text-align: right; }
.home-stat .v { font-size: 20px; font-weight: 800; }
.home-stat .l { font-size: 12px; color: var(--muted); }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.home-tile { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px 16px; cursor: pointer; transition: border-color .1s; }
.home-tile:hover { border-color: var(--accent); }
.home-tile.primary { background: linear-gradient(160deg, #3f74ff, #2554d8); border-color: transparent; }
.home-tile.primary .ht-sub { color: rgba(255,255,255,.75); }
.ht-icon { font-size: 30px; margin-bottom: 8px; }
.ht-label { font-size: 17px; font-weight: 700; }
.ht-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sidebar { width: 190px; background: var(--panel); display: flex; flex-direction: column; flex-shrink: 0; }
.brand { font-weight: 800; font-size: 17px; padding: 16px; border-bottom: 1px solid var(--border); }
nav { flex: 1; overflow-y: auto; padding: 8px 0; }
nav a { display: block; padding: 11px 16px; color: var(--text); text-decoration: none; border-left: 3px solid transparent; }
nav a:hover { background: var(--panel2); }
nav a.active { background: var(--panel2); border-left-color: var(--accent); font-weight: 600; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.sync-badge { font-size: 12px; color: var(--muted); }
.sync-badge.ok { color: var(--green); }
.sync-badge.err { color: var(--yellow); }
.user-badge { font-size: 12px; color: var(--muted); }
main { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* controls */
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.big { padding: 14px 18px; font-size: 16px; font-weight: 700; }
.btn:disabled { opacity: .45; cursor: default; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; font-size: 14px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field { margin-bottom: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--panel2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { background: var(--panel); border-radius: 10px; padding: 4px 12px 10px; overflow-x: auto; }

/* cards / stats */
.cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { background: var(--panel); border-radius: 10px; padding: 14px 18px; min-width: 150px; flex: 1; }
.card .label { font-size: 12px; color: var(--muted); }
.card .value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.panel { background: var(--panel); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }

/* login */
.login-screen { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-box { background: var(--panel); border-radius: 14px; padding: 30px 34px; width: 380px; text-align: center; }
.login-brand { font-size: 24px; font-weight: 800; }
.login-sub { color: var(--muted); margin: 6px 0 16px; }
.pin-display { height: 34px; font-size: 26px; letter-spacing: 10px; margin-bottom: 12px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pin-pad button { padding: 16px 0; font-size: 20px; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); cursor: pointer; }
.pin-pad button:hover { border-color: var(--accent); }
.login-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.login-msg { margin-top: 12px; min-height: 18px; color: var(--yellow); }

/* POS */
.pos-layout { display: flex; gap: 16px; height: calc(100vh - 40px); }
.pos-left { flex: 1.3; display: flex; flex-direction: column; min-width: 0; }
.pos-right { flex: 1; display: flex; flex-direction: column; min-width: 340px; max-width: 460px; }
.scan-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.scan-bar input { flex: 1; font-size: 17px; padding: 12px 14px; }
.search-results { background: var(--panel); border-radius: 10px; overflow-y: auto; flex: 1; }
.search-results .item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.search-results .item:hover { background: var(--panel2); }
.cart { background: var(--panel); border-radius: 10px; flex: 1; overflow-y: auto; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.cart-line .name { flex: 1; min-width: 0; }
.cart-line .name .sub { font-size: 11px; color: var(--muted); }
.cart-line input.qty { width: 52px; text-align: center; padding: 5px; }
.cart-line .price { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.cart-line .x { color: var(--red); cursor: pointer; padding: 0 4px; font-size: 16px; }
.totals { background: var(--panel); border-radius: 10px; padding: 12px 16px; margin-top: 10px; }
.totals .trow { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { font-size: 24px; font-weight: 800; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.pos-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.tender-btns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.age { background: rgba(229,72,77,.18); color: var(--red); }
.badge.ok { background: rgba(46,189,107,.15); color: var(--green); }
.badge.info { background: rgba(59,110,245,.15); color: var(--accent); }
.badge.warn { background: rgba(240,180,41,.15); color: var(--yellow); }

/* ---------- touch register ---------- */
.reg { display: flex; gap: 10px; height: calc(100vh - 104px); min-height: 480px; }
.reg-left { flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 8px; }
.reg-right { flex: 1.45; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.reg-banner { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; text-align: center; color: var(--yellow); font-weight: 600; min-height: 20px; }
.reg-cart { background: var(--panel); border-radius: 10px; flex: 1; overflow-y: auto; padding: 4px 0; }
.reg-cart-empty { padding: 30px 16px; text-align: center; line-height: 1.6; }
.reg-line { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.reg-line:hover { background: var(--panel2); }
.reg-line-name { font-size: 16px; font-weight: 600; }
.reg-line-sub { color: var(--accent); font-size: 13px; margin-top: 2px; }
.reg-line-amt { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; padding-left: 10px; }

.reg-left-bottom { display: flex; gap: 8px; }
.reg-side-btns { display: flex; flex-direction: column; gap: 8px; width: 128px; }
.rbtn { border: 0; border-radius: 10px; padding: 16px 10px; font-size: 16px; font-weight: 700; cursor: pointer; background: var(--panel2); color: var(--text); }
.rbtn.cancel { background: var(--red); color: #fff; }
.rbtn.hold { background: #2a3450; color: #fff; }
.rbtn.discount { background: var(--yellow); color: #241a00; }
.rbtn.primary { background: var(--accent); color: #fff; }
.rbtn.danger { background: var(--red); color: #fff; }
.rbtn:disabled { opacity: .4; cursor: default; }
.reg-totals { background: var(--panel); border-radius: 10px; padding: 10px 14px; flex: 1; }
.reg-totals .trow { display: flex; justify-content: space-between; padding: 2px 0; font-size: 14px; }
.reg-totals .trow.owes { font-size: 20px; font-weight: 800; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }
.pts-apply { background: var(--yellow); color: #3a2c00; border: 0; border-radius: 8px; padding: 7px 12px; font-weight: 800; font-size: 14px; cursor: pointer; }
.pts-apply:active { transform: scale(.96); }

.reg-tabs { display: flex; background: var(--panel); border-radius: 24px; padding: 4px; align-self: center; gap: 2px; }
.reg-tabs a { padding: 8px 22px; border-radius: 20px; color: var(--muted); font-weight: 600; text-decoration: none; }
.reg-tabs a.active { background: var(--accent); color: #fff; }

/* 6 columns × 4 visible rows; every tile the same quarter-height, scroll past 24 */
.reg-grid { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: calc((100% - 30px) / 4); gap: 10px; overflow-y: auto; min-height: 150px; flex: 1; align-content: start; }
.dept { background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 8px 10px; font-size: 15px; font-weight: 600; line-height: 1.25; cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; transition: border-color .12s, background .12s; }
.dept:hover { border-color: var(--accent); }
.dept:active { transform: scale(.97); }
.dept { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* drag reorder: long-press lifts the tile into a ghost that follows the finger */
.reg-grid.cat-move .dept { outline: 2px dashed var(--border); outline-offset: -2px; }
.reg-grid.cat-move .dept.drag-src { opacity: .35; }
.reg-grid.cat-move .dept.drop-hint { border-color: var(--accent); outline: 2px solid var(--accent); background: var(--panel); }
.dept-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: .9; transform: scale(1.05); box-shadow: 0 8px 24px rgba(0,0,0,.45); margin: 0; }
.dept.back { background: var(--panel); color: var(--accent); }
.dept-age { position: absolute; top: 7px; right: 8px; font-size: 10px; font-weight: 700; color: var(--red); background: rgba(229,72,77,.13); padding: 2px 7px; border-radius: 999px; }
.dept-price { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.reg-grid-note { grid-column: 1 / -1; text-align: center; padding: 24px; color: var(--muted); line-height: 1.7; }

.reg-entry { display: flex; gap: 6px; align-items: stretch; }
.entry-x { width: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel2); color: var(--muted); font-size: 16px; cursor: pointer; }
.entry-bs { width: 62px; font-size: 22px; color: var(--text); }
.entry-zero { color: var(--muted); }
.entry-display { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: 22px; padding: 8px 14px; min-height: 44px; display: flex; align-items: center; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.qty-chip { background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: 15px; margin-right: 8px; }
.entry-sku { width: 74px; border-radius: 10px; border: 0; background: #37b6e3; color: #04364a; font-weight: 800; font-size: 14px; line-height: 1.2; cursor: pointer; }

.reg-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pad { border: 0; border-radius: 8px; font-size: 20px; font-weight: 700; padding: 15px 4px; cursor: pointer; }
.pad.key { background: #f4f6fb; color: #10182b; border: 1px solid #c9d0e0; }
.pad.key:active { background: #d9e0f0; }
.pad.at { font-size: 24px; }
.pad.cash { background: #555e73; color: #fff; }
.pad.cash.next { background: #67718c; }
.pad.tender { color: #fff; font-size: 17px; }
.pad.credit, .pad.ebt, .pad.check, .pad.refund, .pad.loyal { background: var(--red); }
.pad.cashbtn { background: var(--green); }

.reg-bottom { display: flex; align-items: center; gap: 14px; background: var(--panel); border-radius: 10px; margin-top: 8px; padding: 8px 14px; }
.reg-bottom .spacer { flex: 1; }
.reg-user b { font-size: 15px; }
.reg-foot-btn { background: transparent; border: 0; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; padding: 4px 8px; border-radius: 8px; }
.reg-foot-btn:hover { background: var(--panel2); }
.reg-foot-btn .ico { font-size: 20px; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.loyal-pane { grid-column: 1 / -1; text-align: center; padding: 14px; }
.loyal-title { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.loyal-phone { font-size: 30px; letter-spacing: 4px; margin: 14px 0; font-variant-numeric: tabular-nums; }
.loyal-stats { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.loyal-stat { background: var(--panel); border-radius: 10px; padding: 10px 18px; }
.loyal-stat .v { font-size: 22px; font-weight: 800; }
.loyal-stat .l { font-size: 12px; color: var(--muted); }
.loyal-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.change-due { margin: 14px 0; font-size: 16px; color: var(--muted); }
.change-due b { display: block; font-size: 40px; color: var(--green); margin-top: 4px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--panel); border-radius: 14px; padding: 22px 26px; max-width: 640px; width: calc(100% - 40px); max-height: 88vh; overflow-y: auto; }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal.wide { max-width: 900px; }

/* ---- order detail (Sales.open) ---- */
.modal.xwide { max-width: 1080px; }
.sd-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .sd-grid { grid-template-columns: 1fr; } }
.sd-pane { background: var(--panel2, rgba(128,128,128,.07)); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.sd-sec { font-size: 15px; font-weight: 800; margin: 4px 0 2px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); display: inline-block; }
.sd-kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.sd-kv:last-child { border-bottom: 0; }
.sd-kv .k { color: var(--muted); }
.sd-kv .v { font-weight: 600; text-align: right; }
.sd-kv .v.red { color: var(--red); }
.sd-kv .v.green { color: var(--green); }
.sd-kv.strong .k, .sd-kv.strong .v { color: var(--text); font-weight: 800; }
.sd-sub { padding-left: 14px; }
.sd-sub .k { font-size: 13px; }
.sd-grand { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-dim, rgba(59,130,246,.12)); border: 1px solid var(--accent); }
.sd-grand .k { font-weight: 800; font-size: 16px; }
.sd-grand .f { color: var(--muted); font-size: 12px; margin-right: 10px; }
.sd-grand .v { font-weight: 800; font-size: 22px; color: var(--green); }
.sd-items { width: 100%; }
.sd-items .in { font-weight: 600; }
.sd-items .is { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.sd-mini { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sd-mini th { text-align: left; color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: .3px; padding: 6px 8px; background: var(--panel2, rgba(128,128,128,.1)); }
.sd-mini td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.sd-mini .num, .sd-mini th.num { text-align: right; }
.sd-link { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ---- internal touch keyboard (kiosk mode: OS keyboard suppressed) ---- */
#oskb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 300; background: var(--panel); border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(0,0,0,.45); padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); user-select: none; }
#oskb .kb-rows { display: flex; flex-direction: column; gap: 6px; max-width: 900px; margin: 0 auto; }
#oskb .kb-row { display: flex; gap: 6px; justify-content: center; }
#oskb button { flex: 1; max-width: 92px; padding: 13px 0; font-size: 19px; font-weight: 700; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text); cursor: pointer; }
#oskb button:active { background: var(--accent); color: #fff; }
#oskb button.k-wide { max-width: 260px; flex: 2.5; }
#oskb button.k-act { background: var(--accent); color: #fff; border: 0; }
#oskb button.k-on { outline: 2px solid var(--accent); }
#oskb.num button { max-width: 110px; padding: 15px 0; font-size: 22px; }

/* ---- employee work calendar ---- */
.wc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wc-head { text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; padding: 4px 0; }
.wc-cell { border: 1px solid var(--border); border-radius: 8px; min-height: 58px; padding: 5px 7px; background: var(--panel2, rgba(128,128,128,.06)); }
.wc-cell.empty { border: 0; background: transparent; }
.wc-cell.worked { cursor: pointer; border-color: var(--accent); }
.wc-cell.worked:hover { background: rgba(59,130,246,.12); }
.wc-cell.today { outline: 2px solid var(--accent); }
.wc-cell .d { color: var(--muted); font-size: 12px; }
.wc-cell .h { font-weight: 800; color: var(--green); margin-top: 2px; }
.wc-cell .n { font-size: 11px; }

/* toast */
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 12px 16px; min-width: 240px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }

/* tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 16px; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* receipt printing */
.print-only { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff; color: #000; }
  #print-root { width: 76mm; font-family: "Courier New", monospace; font-size: 11px; color: #000; }
  #print-root .r-center { text-align: center; }
  #print-root .r-row { display: flex; justify-content: space-between; }
  #print-root hr { border: none; border-top: 1px dashed #000; }
}
@media (max-width: 900px) {
  .pos-layout { flex-direction: column; height: auto; }
  .pos-right { max-width: none; }
  .sidebar { width: 60px; }
  .brand, .user-badge { display: none; }
  nav a { padding: 12px 8px; text-align: center; font-size: 18px; }
}

/* ---- large touch sizing: fill the screen, big targets everywhere ---- */
body { font-size: 16px; }
h1 { font-size: 24px; }
.btn { padding: 11px 18px; font-size: 16px; }
.btn.small { padding: 6px 12px; font-size: 14px; }
th, td { padding: 10px 12px; }
input, select, textarea { padding: 10px 12px; font-size: 16px; }
.topbar { padding: 10px 16px; }
.tb-home { padding: 12px 22px; font-size: 17px; }
.brand-sm { font-size: 19px; }
.tb-store, .tb-view { font-size: 16px; }
.tb-logo { width: 40px; height: 40px; }

/* home */
.home { max-width: 1200px; }
.home-store { font-size: 32px; }
.home-tiles { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.home-tile { padding: 28px 20px; }
.ht-icon { font-size: 42px; }
.ht-label { font-size: 21px; }
.ht-sub { font-size: 14px; }
.home-stat .v { font-size: 24px; }
.home-support { font-size: 16px; padding: 12px 20px; }

/* register fills the viewport */
#view.view-pos { display: flex; flex-direction: column; padding: 8px 12px; }
/* fill tall screens; scroll (not crush) on short ones */
#view.view-pos .reg { flex: 1; min-height: 560px; height: auto; }
.reg-banner { font-size: 16px; padding: 12px 14px; }
.reg-blogo { width: 48px; height: 48px; }
.reg-line { padding: 14px 16px; }
.reg-line-name { font-size: 19px; }
.reg-line-sub { font-size: 15px; }
.reg-line-amt { font-size: 20px; }
.reg-cart-empty { font-size: 16px; }
.rbtn { padding: 22px 12px; font-size: 20px; border-radius: 12px; }
.reg-side-btns { width: 150px; }
.reg-totals { padding: 12px 18px; }
.reg-totals .trow { font-size: 17px; padding: 3px 0; }
.reg-totals .trow.owes { font-size: 24px; white-space: nowrap; gap: 10px; }
.reg-tabs a { padding: 12px 30px; font-size: 17px; }
.dept { font-size: 16px; }
.dept-price { font-size: 14px; }
.dept-age { font-size: 11px; }
/* compact entry bar + keypad: the freed height goes to the department grid above */
.reg-entry { gap: 8px; }
.entry-display { font-size: 24px; min-height: 48px; padding: 4px 14px; }
.entry-x { width: 48px; font-size: 18px; border-radius: 10px; }
.entry-bs { width: 58px; font-size: 20px; }
.entry-sku { width: 80px; font-size: 14px; border-radius: 10px; }
.reg-pad { gap: 8px; }
.pad { padding: 0; min-height: 46px; font-size: 20px; border-radius: 10px; }
.pad.tender { font-size: 16px; }
.pad.at { font-size: 22px; }
.qty-chip { font-size: 17px; }
.reg-bottom { padding: 10px 16px; }
.reg-user b { font-size: 18px; }
.reg-foot-btn { font-size: 14px; }
.reg-foot-btn .ico { width: 46px; height: 46px; font-size: 24px; }

/* modals & lock screen */
.modal h3 { font-size: 20px; }
.pin-pad button { padding: 20px 0; font-size: 24px; }
.loyal-phone { font-size: 38px; }
.loyal-stat .v { font-size: 26px; }

/* ---- merchant dashboard ---- */
.dash-hero { padding: 18px 22px; margin-bottom: 12px; }
.dash-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dash-pulse { color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: 1.5px; }
.dash-period { display: flex; background: var(--panel2); border: 1px solid var(--border); border-radius: 22px; padding: 3px; align-self: center; }
.dash-period a { padding: 9px 22px; border-radius: 18px; color: var(--muted); font-weight: 600; }
.dash-period a.active { background: var(--accent); color: #fff; }
.dash-nav { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.dash-date { flex: 1; text-align: center; font-size: 18px; font-weight: 700; }
.dash-kpis { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.dash-kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; min-width: 130px; flex-shrink: 0; }
.dash-kpi .k { color: var(--muted); font-size: 12px; white-space: nowrap; }
.dash-kpi .v { font-size: 22px; font-weight: 800; margin-top: 2px; white-space: nowrap; }
.dash-kpi.primary .v { color: var(--accent); }
.dash-kpi.good .v { color: var(--green); }
.dash-kpi.bad .v { color: var(--red); }
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dash-panel { padding: 14px 16px; }
.dash-panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.dash-chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; }
.dash-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 14px; }
.dash-bar .fill { background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .2s; }
.dash-bar .lbl { text-align: center; font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; }
.dash-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.dash-row:last-child { border-bottom: 0; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr 1fr; } .dash-panel[style*="span 2"] { grid-column: span 2; } }

/* ---- promotions ---- */
.promo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.promo-card { padding: 14px 16px; }
.promo-card.off { opacity: .6; }
.promo-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.promo-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---- loyalty screen ---- */
.loyal-grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.ly-preview { background: var(--accent); color: #fff; }
.ly-preview h2, .ly-preview .muted { color: rgba(255,255,255,.85); }
.ly-pcard { background: rgba(255,255,255,.14); border-radius: 10px; padding: 10px 14px; margin-top: 10px; }
.ly-pcard .k { font-size: 13px; opacity: .85; }
.ly-pcard .v { font-size: 22px; font-weight: 800; margin-top: 2px; }
@media (max-width: 1000px) { .loyal-grid { grid-template-columns: 1fr; } }

/* ---- FNS brand ---- */
.brand-fns { color: #2fbe2f; font-weight: 800; letter-spacing: .5px; }
body[data-theme="square"] .brand-fns { color: #2fae2c; }

/* ---- Quickvee-style inventory shell ---- */
.inv-layout { display: flex; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; min-height: 72vh; background: var(--bg); }
.inv-side { width: 212px; flex-shrink: 0; background: #0e1420; padding: 14px 0; display: flex; flex-direction: column; gap: 2px; }
body[data-theme="square"] .inv-side { background: #10151f; }
.inv-side a { display: flex; align-items: center; gap: 11px; padding: 13px 18px; color: #9aa6b8; font-weight: 600; font-size: 15px; cursor: pointer; border-left: 3px solid transparent; text-decoration: none; }
.inv-side a:hover { color: #fff; }
.inv-side a.active { background: #17233a; color: #fff; border-left-color: var(--accent); border-radius: 0 12px 12px 0; margin-right: 10px; }
.inv-side .ico { width: 20px; text-align: center; }
.inv-side .sect { padding: 14px 18px 5px; color: #5c6a80; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.inv-side a.sub { padding: 9px 18px 9px 26px; font-size: 14px; }
.inv-side a .chev { margin-left: auto; color: #5c6a80; font-size: 13px; }
.inv-side a.sub .ico { width: 12px; font-size: 15px; }
.inv-main { flex: 1; min-width: 0; padding: 20px 24px; overflow-x: auto; }
.pg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pg-title h2 { margin: 0; font-size: 26px; letter-spacing: -.3px; }
.pg-title .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pg-head .spacer { flex: 1; }
.pg-head input[type="text"], .pg-head input:not([type]) { border-radius: 10px; padding: 11px 14px; }
.btn.add { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 12px 20px; font-weight: 700; font-size: 15px; }
.btn.add:hover { background: var(--accent2); }
.hint-banner { display: flex; gap: 13px; align-items: flex-start; background: rgba(59,110,245,.08); border: 1px solid rgba(59,110,245,.35); border-radius: 12px; padding: 14px 40px 14px 16px; margin-bottom: 16px; position: relative; }
.hint-banner .hicon { width: 42px; height: 42px; border-radius: 10px; background: rgba(59,110,245,.16); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.hint-banner b { display: block; margin-bottom: 2px; font-size: 15px; }
.hint-banner .htext { font-size: 13px; color: var(--muted); line-height: 1.5; }
.hint-banner .hx { position: absolute; top: 10px; right: 12px; cursor: pointer; color: var(--muted); font-size: 15px; padding: 4px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 15px 17px; }
.stat-card .k { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat-card .v { font-size: 27px; font-weight: 800; margin: 5px 0 3px; }
.stat-card .v.red { color: var(--red); } .stat-card .v.green { color: var(--green); }
.stat-card .s { font-size: 12px; color: var(--muted); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.chip { display: inline-flex; gap: 7px; align-items: center; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); }
.chip .n { background: var(--panel2); border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--muted); }
.chip.active { background: #10151f; color: #fff; border-color: #10151f; }
.chip.active .n { background: #2a3450; color: #cdd6e4; }
.iconbtn { width: 37px; height: 37px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; font-size: 15px; color: var(--text); }
.iconbtn:hover { border-color: var(--accent); }
.iconbtn.danger { color: var(--red); }
.iconbtn.danger:hover { border-color: var(--red); }
.cat-bar { width: 5px; height: 34px; border-radius: 3px; display: inline-block; vertical-align: middle; }
@media (max-width: 900px) { .inv-side { width: 60px; } .inv-side a { padding: 13px 0; justify-content: center; } .inv-side a span.lbl { display: none; } .inv-side a.active { margin-right: 4px; } }

/* ---- handheld portrait registers (PAX Elys & phone-size, <=520px) ----
   The Android wrapper injects a rough <=840px block; these rules override it
   (hence the !importants) so installed APKs pick this layout up from the
   server with no reinstall. Everything fits one screen: cart and department
   grid flex/scroll, keypad and tenders stay anchored at the bottom. */
@media (max-width: 520px) {
  main { padding: 5px !important; }
  .reg { flex-direction: column !important; height: 100% !important; gap: 5px !important; min-height: 0 !important; }
  .reg-banner-row { display: none; }                    /* reclaim vertical space */
  .reg-left { flex: 0 1 auto !important; min-width: 0 !important; min-height: 0 !important; gap: 5px !important; }
  .reg-cart { flex: 0 1 auto !important; min-height: 52px !important; max-height: 15vh !important; }
  .reg-line { padding: 6px 10px; }
  .reg-line-name, .reg-line-amt { font-size: 13.5px; }
  .reg-left-bottom { flex-direction: column-reverse; gap: 5px; }
  .reg-side-btns { flex-direction: row; width: 100%; gap: 5px; }
  .rbtn { flex: 1; padding: 8px 4px; font-size: 12px; white-space: nowrap; }
  .reg-totals { flex: 0 0 auto !important; padding: 6px 12px; }
  .reg-totals .trow { font-size: 11.5px; padding: 0; }
  .reg-totals .trow.owes { font-size: 15px; padding-top: 3px; margin-top: 2px; }
  .reg-right { flex: 1 1 auto !important; min-width: 0 !important; min-height: 0 !important; gap: 5px !important; }
  .reg-tabs { align-self: stretch; padding: 2px; }
  .reg-tabs a { flex: 1; text-align: center; padding: 6px 2px; font-size: 11.5px; white-space: nowrap; }
  .reg-grid { grid-template-columns: repeat(3, 1fr) !important; flex: 1 1 auto; min-height: 80px;
    max-height: none !important; overflow-y: auto; gap: 4px; }
  .dept { padding: 6px 3px; font-size: 12px; min-height: 44px; line-height: 1.2; }
  .reg-entry { flex: 0 0 auto; }
  .entry-display { font-size: 20px; }
  .reg-pad { flex: 0 0 auto; gap: 3px; }
  .pad { padding: 7px 2px !important; font-size: 13px !important; border-radius: 7px; min-height: 38px; }
  .reg-bottom { flex-wrap: nowrap !important; gap: 3px; padding: 4px; overflow-x: auto; }
  .reg-foot-btn { flex: 1 0 auto; font-size: 10px; padding: 4px 5px; display: flex; align-items: center; gap: 3px; }
  .reg-foot-btn .ico { font-size: 12px; display: inline; margin: 0; }
  .reg-user { display: none; }                          /* name/time live on Home */
  .home-tiles { grid-template-columns: repeat(2, 1fr); }
}
