/* Loyalty Points — design system. Arabic-first (RTL), logical properties throughout, mobile-first. */
:root {
    --brand: #0E7C66;
    --brand-600: #0B6A57;
    --brand-50: #E7F5F1;
    --accent: #D97706;
    --accent-50: #FEF3C7;
    --ink: #0F172A;
    --ink-2: #334155;
    --muted: #64748B;
    --line: #E2E8F0;
    --bg: #F6F8FA;
    --card: #FFFFFF;
    --danger: #DC2626;
    --danger-50: #FEE2E2;
    --ok: #059669;
    --ok-50: #D1FAE5;
    --warn: #B45309;
    --warn-50: #FEF3C7;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 4px 12px rgb(15 23 42 / .05);
    --shadow-lg: 0 12px 32px rgb(15 23 42 / .14);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-ar: "IBM Plex Sans Arabic", "Cairo", Tahoma, sans-serif;
    color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; min-height: 100vh; overflow-x: hidden; overflow-wrap: break-word; }
.grow, .card, .item, .lp-modal, td.wrap-cell { overflow-wrap: anywhere; }
[dir="rtl"] body, [dir="rtl"] input, [dir="rtl"] button, [dir="rtl"] select, [dir="rtl"] textarea { font-family: var(--font-ar); }
input, button, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- layout */
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: 16px; }
.narrow { max-width: 520px; }
.stack > * + * { margin-block-start: 12px; }
.stack-lg > * + * { margin-block-start: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.pos-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
main { padding-block: 20px 64px; }

/* ---------------- topbar */
.topbar { position: sticky; top: 0; z-index: 30; background: rgb(255 255 255 / .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #13a083); color: #fff; display: grid; place-items: center; font-size: 15px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.nav a:hover { background: var(--brand-50); text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }
.tabbar { display: none; }
@media (max-width: 760px) {
    .topbar .nav.desktop { display: none; }
    .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px env(safe-area-inset-bottom); justify-content: space-around; box-sizing: border-box; }
    /* Fixed height (60px + safe area) in every language so sticky/fixed bars above it can offset exactly. */
    .tabbar { height: calc(60px + env(safe-area-inset-bottom)); align-items: flex-start; }
    .tabbar a { display: flex; flex-direction: column; align-items: center; font-size: .72rem; color: var(--muted); padding: 4px 2px; gap: 2px;
        flex: 1 1 0; min-width: 0; max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
    .tabbar a > * { max-width: 100%; }
    .tabbar a .ico { font-size: 1.25rem; line-height: 1; }
    .tabbar a.active { color: var(--brand); font-weight: 700; }
    .tabbar a:hover { text-decoration: none; }
    main { padding-block-end: 96px; }
}

/* ---------------- cards & text */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card.tight { padding: 12px 14px; }
.card h2, .card h3 { margin-block-end: 10px; }
h1 { font-size: clamp(1.45rem, 2.6vw, 2rem); line-height: 1.25; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.bold { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.center { text-align: center; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--brand-50); color: var(--brand-600); white-space: nowrap; }
.pill.warn { background: var(--warn-50); color: var(--warn); }
.pill.danger { background: var(--danger-50); color: var(--danger); }
.pill.gray { background: #F1F5F9; color: var(--ink-2); }
.divider { height: 1px; background: var(--line); margin-block: 12px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .ico { font-size: 2rem; display: block; margin-block-end: 6px; }

/* ---------------- KPIs */
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.kpi .value { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: .78rem; font-weight: 700; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: #EEF2F6; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ---------------- forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: var(--radius-sm); background: #fff; font-size: 1rem; }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.readonly-field { background: #F1F5F9; color: var(--ink-2); display: flex; align-items: center; cursor: not-allowed; }
.input.big { min-height: 54px; font-size: 1.15rem; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-error { color: var(--danger); font-size: .88rem; font-weight: 600; }

/* ---------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 700; cursor: pointer; background: #EEF2F6; color: var(--ink); white-space: nowrap; transition: background .15s; }
.btn:hover { background: #E2E8F0; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: #F8FAFC; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: .86rem; }
.btn.lg { min-height: 54px; font-size: 1.08rem; padding-inline: 22px; }
.btn.block { width: 100%; }
.btn.busy { pointer-events: none; opacity: .7; }
.icon-btn { min-width: 40px; min-height: 40px; padding: 6px; }

/* ---------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
.t th, .t td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th { background: #F8FAFC; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.t tr:last-child td { border-bottom: 0; }
.t td.wrap-cell { white-space: normal; min-width: 180px; }
.t tr.clickable { cursor: pointer; }
.t tr.clickable:hover td { background: #F8FAFC; }

/* ---------------- list items / POS */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.item.selectable { cursor: pointer; }
.item.selectable:hover { border-color: var(--brand); }
.svc-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.svc { text-align: start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 76px; }
.svc:hover { border-color: var(--brand); background: var(--brand-50); }
.svc .price { font-weight: 800; color: var(--brand-600); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .86rem; font-weight: 600; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.totals { display: grid; gap: 6px; }
/* ======================================================================= POS fixed frame (all widths)
   The page never scrolls on the Counter. #app is a full-height column (top bar / banner / main).
   Left pane  : [shift bar][customer finder — results open as an overlay][services: grid scrolls inside]
   Right pane : cart = [header][products: scroll inside][payment panel: fixed; total + Complete never scroll]
   Phones     : one pane (left) + fixed Total/Complete bar; the cart opens as a full-screen sheet. */
html.page-frame, html.page-frame body { height: 100%; overflow: hidden; }
html.page-frame #app { height: 100%; display: flex; flex-direction: column; }
html.page-frame #app > .topbar, html.page-frame #app > div.wrap { flex: 0 0 auto; }
html.page-frame #app > main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-block: 12px; }
.pos-layout { flex: 1 1 auto; min-height: 0; height: 100%; }
.pos-main { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.pos-main > .pos-fixed, .pos-find { flex: 0 0 auto; }
.pos-find { position: relative; display: flex; flex-direction: column; gap: 10px; z-index: 6; }
.search-pop { position: absolute; top: calc(100% - 4px); inset-inline: 0; z-index: 20; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px; max-height: min(60vh, 460px); overflow-y: auto; overscroll-behavior: contain; }
.search-pop[hidden] { display: none; }
.cust-row { display: flex; align-items: center; gap: 10px; height: 66px; box-sizing: border-box; overflow: hidden; padding: 8px 10px; border-radius: var(--radius-sm); background: #F8FAFC; border: 1px solid var(--line); }
.cust-row.empty { background: transparent; border-style: dashed; }
.cust-row.blocked { border-color: var(--danger); }
.cust-avatar { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); font-weight: 800; }
.cust-id { min-width: 0; } .cust-id > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-stats { display: flex; gap: 6px; flex: 0 0 auto; }
.cust-stats > span { display: flex; flex-direction: column; align-items: center; padding: 2px 8px; border-radius: 8px; background: #fff; border: 1px solid var(--line); min-width: 52px; }
.cust-stats b { font-size: .95rem; line-height: 1.2; } .cust-stats small { font-size: .68rem; color: var(--muted); }
.cust-stats .has-reward { border-color: var(--accent); }
.cust-actions { gap: 4px; flex: 0 0 auto; }
@media (max-width: 600px) { .cust-stats > span:nth-child(n+3) { display: none; } .cust-stats > span { min-width: 44px; padding: 2px 6px; } }
@media (min-width: 960px) { .search-pop { top: 74px; } }
@media (max-width: 959px) { .search-pop { max-height: 45vh; } }  /* always fits above the Total bar / tab bar */
.pos-services { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.pos-services > * { flex: 0 0 auto; }
.svc-scroll { flex: 1 1 auto !important; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.cart-panel { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 0; height: 100%; }
.cart-head { flex: 0 0 auto; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.cart-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.cart-sheet-close { display: none; }
.cart-lines { flex: 1 1 auto; min-height: 96px; overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); transition: background-color .4s; }
.cart-line:last-child { border-bottom: 0; }
.cart-line.flash { background: var(--brand-50); }
.cart-line-qty { gap: 4px; }
.cart-pay { flex: 0 0 auto; max-height: 72%; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 18px 14px;
    border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -6px 12px -10px rgb(15 23 42 / .25); }
.cart-pay-scroll { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; }
.cart-pay-final { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; }
.cart-adjust summary { cursor: pointer; }
.pos-mobile-bar { display: none; }
@media (min-width: 960px) {
    .pos-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); gap: 16px; align-items: stretch; }
}
@media (max-width: 959px) {
    .pos-layout { display: flex; flex-direction: column; }
    .pos-main { flex: 1 1 auto; }
    /* leave room for the fixed Total/Complete bar (+ tab bar on phones) at the bottom of the services list */
    .svc-scroll { padding-bottom: 88px; }
    /* The cart stays mounted (its Total/Complete bar lives inside it) but is invisible until "Review" opens it as a sheet. */
    .cart-panel { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 80; height: 100%; border-radius: 0; border: 0;
        visibility: hidden; background: transparent; box-shadow: none; pointer-events: none; }
    .cart-panel .pos-mobile-bar { visibility: visible; pointer-events: auto; }
    html.cart-open .cart-panel { visibility: visible; background: #fff; pointer-events: auto; }
    html.cart-open .cart-sheet-close { display: inline-flex; }
    html.cart-open .pos-mobile-bar { display: none; }
    .pos-mobile-bar { display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
        background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 20px -12px rgb(15 23 42 / .35);
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
    .pos-mobile-bar a { color: inherit; text-decoration: none; min-width: 0; }
}
@media (max-width: 760px) {
    .pos-mobile-bar { bottom: calc(60px + env(safe-area-inset-bottom)); padding-bottom: 10px; }
    html.page-frame #app > main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    .svc-scroll { padding-bottom: 84px; }
}
/* ---------------- Counter: small-screen layout (root cause of clipping: flex/grid children kept min-width:auto,
   so the widest non-wrapping row — the selected-customer row — widened the whole column past the viewport,
   and the POS frame's overflow:hidden cut it off on both sides). */
html.page-frame #app > main { min-width: 0; width: 100%; }
.pos-layout > *, .pos-main > *, .pos-find > *, .pos-services > *, .pos-find form > * { min-width: 0; }
.pos-find form .input { min-width: 0; }
.cart-sheet-close { white-space: nowrap; }
.pos-cart-btn { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 4px 10px 4px 4px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--bg); font: inherit; color: inherit; text-align: start; cursor: pointer; }
[dir=rtl] .pos-cart-btn { padding: 4px 4px 4px 10px; }
.pos-cart-btn:active { background: var(--brand-50); }
.cart-ico { position: relative; width: 42px; height: 42px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1.2rem; flex: 0 0 auto; }
.cart-badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff;
    font-size: .75rem; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }
.cart-badge.zero { background: var(--muted); }
.cart-sum { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; } .cart-sum .tiny { color: var(--muted); } .cart-sum b { font-size: 1.15rem; white-space: nowrap; }
@media (max-width: 959px) {
    /* Phones/tablets: the Counter scrolls as a normal page (services get their natural height); only the cart bar
       and tab bar stay fixed. Desktop keeps the fixed frame. */
    html.page-frame, html.page-frame body { height: auto; overflow: visible; }
    html.page-frame #app { height: auto; display: block; }
    html.page-frame #app > main { display: block; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
    .pos-layout, .pos-main { height: auto; }
    .pos-services { flex: 0 0 auto; }
    .svc-scroll { overflow: visible; padding-bottom: 8px !important; }
    .pos-main { gap: 8px; }
    .pos-fixed .card { padding: 6px 10px; } .pos-fixed .card .small { font-size: .82rem; }
    .pos-find, .pos-services { padding: 10px; }
    .pos-find form .btn.lg { padding-inline: 14px; }
    .pos-services-head { flex-wrap: wrap !important; gap: 8px; } .pos-services-head h3 { font-size: 1rem; }
    .pos-services-head .input { max-width: none !important; flex: 1 1 140px; }
    .pos-services .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; } .pos-services .chips::-webkit-scrollbar { display: none; }
    .pos-services .chips .chip { flex: 0 0 auto; }
    .svc-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 136px), 1fr)); gap: 8px; }
    .svc { min-height: 64px; padding: 10px; }
    .pos-mobile-bar { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); gap: 10px; }
    .pos-mobile-bar .btn.lg { min-height: 48px; padding-inline: 18px; flex: 0 0 auto; }
    /* Cart sheet: items get most of the height; payment block is capped and scrolls on its own. */
    html.cart-open, html.cart-open body { overflow: hidden; }
    /* Sheet = flex column that always fits the screen: head (1 line) / items (flex, scroll) / payment (capped, own scroll; Complete never cut). */
    .cart-panel { display: flex; flex-direction: column; }
    .cart-panel .cart-head { flex: 0 0 auto; background: #fff; z-index: 2; padding: 10px 14px 8px; }
    .cart-head .row { flex-wrap: nowrap; } .cart-head h3 { min-width: 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cart-head .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cart-lines { flex: 1 1 0; min-height: 72px; padding: 4px 14px; }
    .cart-pay { flex: 0 0 auto; max-height: calc(100% - 140px); padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
    .cart-pay-final > .tiny { display: none; }
    .cart-pay .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .cart-pay .chips .chip { flex: 0 0 auto; }
    .cart-line-qty .btn.icon-btn { min-width: 40px; min-height: 40px; }
}
@media (max-width: 600px) {
    /* Selected customer: two lines (identity + clear on top; stats and quick actions below) instead of one clipped row. */
    .cust-row:not(.empty) { flex-wrap: wrap; height: auto; row-gap: 6px; }
    .cust-row:not(.empty) .cust-id { flex: 1 1 calc(100% - 54px); min-width: 0; }
    .cust-row:not(.empty) .cust-stats { order: 3; flex: 1 1 auto; }
    .cust-row:not(.empty) .cust-actions { order: 4; }
    .cust-row:not(.empty) .cust-stats > span:nth-child(n+3) { display: flex; }
    .cust-row .cust-stats > span { min-width: 0; flex: 1 1 0; }
}
@media (max-width: 760px) { html.page-frame #app > main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); } }
@media (max-width: 959px) and (max-height: 520px) {
    /* Phone landscape / short screens */
    .cart-panel .cart-head { padding: 6px 12px; } .cart-head .small { display: none; }
    .cart-lines { min-height: 48px; } .cart-line { padding: 6px 0; }
    .cart-pay { padding: 6px 12px 8px; gap: 6px; max-height: calc(100% - 112px); }
    .cart-pay-final .btn.lg { min-height: 44px; padding-block: 8px; }
    .cart-pay .totals { gap: 2px; }
}
@media (max-width: 360px) { .cart-head .pill { display: none; } }
@media (max-width: 420px) { .cust-row:not(.empty) .cust-stats > span:nth-child(3) { display: none !important; } }
.cart-who { display: block; font-size: .72rem; color: var(--ink-2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) {
    .pos-find form .btn.lg { padding-inline: 10px; font-size: .95rem; }
    .cart-sum b { font-size: 1rem; } .pos-mobile-bar .btn.lg { padding-inline: 12px; }
    .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (pointer: coarse) { .btn.sm { min-height: 40px; } .chip { min-height: 38px; } }

/* Long page forms: the primary action stays visible at the bottom of the viewport while the form is on screen. */
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: #fff; margin: 8px -18px -18px; padding: 12px 18px;
    border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -6px 12px -10px rgb(15 23 42 / .25); }
.sticky-actions.bare { margin: 8px 0 0; border-radius: var(--radius-sm); }
@media (max-width: 760px) { .sticky-actions { bottom: calc(60px + env(safe-area-inset-bottom)); } }
@media (max-width: 760px) { .cart-pay { bottom: calc(60px + env(safe-area-inset-bottom)); } }
.totals .row { flex-wrap: nowrap; justify-content: space-between; }
.totals .grand { font-size: 1.35rem; font-weight: 800; }
.balance-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.balance-strip > div { background: #F8FAFC; border-radius: var(--radius-sm); padding: 8px; text-align: center; }
.balance-strip b { display: block; font-size: 1.15rem; }
.stamps { display: flex; gap: 6px; flex-wrap: wrap; }
.stamp { width: 30px; height: 30px; border-radius: 50%; border: 2px dashed #CBD5E1; display: grid; place-items: center; font-size: .9rem; }
.stamp.on { background: var(--brand); border: 2px solid var(--brand); color: #fff; }

/* ---------------- membership card (customer pass) */
.member-card { border-radius: 20px; padding: 22px; color: #fff; background: linear-gradient(140deg, var(--tc1, #0E7C66), var(--tc2, #0F172A)); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.member-card::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgb(255 255 255 / .08); }
.member-card .big { font-size: 2.2rem; font-weight: 800; line-height: 1.1; }
.qr-box { background: #fff; border-radius: 16px; padding: 14px; display: inline-block; }
.qr-box svg { display: block; width: 200px; height: 200px; }

/* ---------------- landing */
.hero { padding-block: 40px 24px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.15; letter-spacing: -.01em; }
.hero p.lead { font-size: 1.12rem; color: var(--ink-2); max-width: 640px; }
.feature .ico { font-size: 1.6rem; }
.price-card { display: flex; flex-direction: column; gap: 10px; }
.price-card .amount { font-size: 1.8rem; font-weight: 800; }
.price-card ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.price-card li::before { content: "✓ "; color: var(--brand); font-weight: 800; }
.price-card.featured { border: 2px solid var(--brand); }
.section { padding-block: 32px; }
.section-title { text-align: center; margin-block-end: 20px; }
.industry-pick { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.industry-pick label { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; background: #fff; font-weight: 600; font-size: .9rem; }
.industry-pick input { accent-color: var(--brand); }
.industry-pick label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
details.faq { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff; }
details.faq summary { cursor: pointer; font-weight: 700; }
details.faq p { margin-block-start: 8px; color: var(--ink-2); }

/* ---------------- overlays */
.toast-host { position: fixed; inset-inline: 0; bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; padding-inline: 16px; }
@media (max-width: 760px) { .toast-host { bottom: 84px; } }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: 520px; pointer-events: auto; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
/* ======================================================================= Popups (single shared component)
   Fixed overlay appended to <body>; dialog is a flex column: header (title + ✕) / body (scrolls on its own) /
   footer (actions). Safe centring with margin:auto (never clips the top), vh fallback + dvh where supported,
   background scroll locked while open. Same structure for every popup type, LTR and RTL. */
html.lp-modal-open, html.lp-modal-open body { overflow: hidden; }
html.lp-modal-open body { padding-inline-end: var(--sbw, 0px); }
.lp-modal-back { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; z-index: 90;
    background: rgb(15 23 42 / .5); display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 16px; }
/* The dialog states its own layout explicitly (app-specific class names + explicit values) so generic
   third-party CSS — e.g. browser extensions styling `.modal` as position:fixed;top:0 — cannot collapse it. */
.lp-modal { position: relative; inset: auto; top: auto; left: auto; right: auto; bottom: auto; height: auto; min-height: 0; z-index: 1; transform: none;
    margin: auto; flex: 0 1 auto; width: 560px; max-width: 100%; max-height: calc(100vh - 32px); opacity: 1; visibility: visible;
    display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
@supports (height: 100dvh) { .lp-modal { max-height: min(92dvh, calc(100dvh - 32px)); } }
.lp-modal.wide { width: 760px; }
.lp-modal-header { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
[dir="rtl"] .lp-modal-header { padding: 14px 20px 14px 16px; }
.lp-modal-header.untitled { border-bottom: 0; padding-bottom: 0; }
.lp-modal-title { flex: 1 1 auto; min-width: 0; font-size: 1.08rem; margin: 0 !important; }
.lp-modal-x { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-size: 1.05rem; cursor: pointer; }
.lp-modal-x:hover { background: #F1F5F9; color: var(--ink); }
.lp-modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 20px; }
.lp-modal-footer { flex: 0 0 auto; padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; }
.lp-modal-footer > .row { margin: 0; justify-content: flex-end; }
.lp-modal-footer > .row.no-print { justify-content: center; }
@media (max-width: 480px) {
    .lp-modal-back { padding: 10px; }
    .lp-modal-footer > .row { flex-wrap: wrap; }
    .lp-modal-footer > .row > .btn { flex: 1 1 auto; }
}
.spinner { width: 22px; height: 22px; border: 3px solid #CBD5E1; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; justify-content: center; padding: 40px; }
.banner { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-50); color: var(--warn); font-weight: 600; font-size: .9rem; }
.banner.info { background: var(--brand-50); color: var(--brand-600); }

/* ---------------- receipt / print */
.receipt { max-width: 380px; margin-inline: auto; font-size: .92rem; }
.receipt .line { display: flex; justify-content: space-between; gap: 8px; }
@media print {
    .topbar, .tabbar, .no-print, .toast-host, .pos-mobile-bar { display: none !important; }
    html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
    .card { box-shadow: none; border: 0; }
    main { padding: 0; }
}
/* Receipt printing uses its own iframe document (receipt-actions.js). If the browser's own Print (Ctrl+P) is used while
   a popup is open, print only the popup content (no page behind it, no header/footer buttons). */
@media print {
    html.lp-modal-open body > *:not(.lp-modal-back) { display: none !important; }
    html.lp-modal-open .lp-modal-back { position: static !important; background: none !important; padding: 0 !important; overflow: visible !important; display: block !important; }
    html.lp-modal-open .lp-modal { box-shadow: none !important; max-height: none !important; width: auto !important; overflow: visible !important; border-radius: 0 !important; }
    html.lp-modal-open .lp-modal-header, html.lp-modal-open .lp-modal-footer { display: none !important; }
    html.lp-modal-open .lp-modal-body { overflow: visible !important; padding: 0 !important; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 480px) { .hide-sm { display: none; } }

/* ================================================================ Daily closing (shift vs day) */
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; direction: ltr; unicode-bidi: isolate; }
.ok { color: var(--ok); } .bad { color: var(--danger); } .warnc { color: var(--warn); }
.btn.icon { min-width: 40px; padding-inline: 10px; font-size: 1.1rem; }
.closing h1 { font-size: 1.6rem; }
.cl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.cl-date { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cl-date .input { width: auto; min-width: 160px; }
.cl-status { border-inline-start: 6px solid var(--brand); background: linear-gradient(135deg, var(--card) 60%, var(--brand-50)); }
.cl-status.st-review { border-color: #2563EB; } .cl-status.st-prov { border-color: var(--accent); background: linear-gradient(135deg, var(--card) 60%, var(--accent-50)); }
.cl-status.st-closed { border-color: var(--ok); background: linear-gradient(135deg, var(--card) 60%, var(--ok-50)); }
.cl-status.st-disc { border-color: var(--danger); background: linear-gradient(135deg, var(--card) 60%, var(--danger-50)); }
.cl-date-big { font-size: 1.15rem; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: .88rem; background: var(--brand-50); color: var(--brand-600); white-space: nowrap; }
.status-pill.st-review { background: #DBEAFE; color: #1D4ED8; } .status-pill.st-prov { background: var(--accent-50); color: var(--warn); }
.status-pill.st-closed { background: var(--ok-50); color: var(--ok); } .status-pill.st-disc { background: var(--danger-50); color: var(--danger); }
.banner.danger-banner { background: var(--danger-50); border-color: #FCA5A5; color: #7F1D1D; display: flex; flex-direction: column; gap: 8px; }
.banner.ok-banner { background: var(--ok-50); border-color: #6EE7B7; color: #065F46; font-weight: 700; }
.banner.warn-banner { background: var(--warn-50); border-color: #FCD34D; color: #78350F; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.kpi-grid.small-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: start; padding: 16px 16px 14px; border-radius: var(--radius);
    background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: inherit; min-height: 132px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--brand-50); opacity: .7; }
.kpi-card:hover, .kpi-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand); outline: none; }
.kpi-card.static { cursor: default; min-height: 0; box-shadow: none; } .kpi-card.static:hover { transform: none; box-shadow: none; border-color: var(--line); }
.kpi-card.static::after { display: none; }
.kpi-ico { position: relative; z-index: 1; font-size: 1.35rem; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-50); }
.kpi-title { color: var(--muted); font-weight: 700; font-size: .85rem; position: relative; z-index: 1; }
.kpi-value { font-size: 1.55rem; font-weight: 800; line-height: 1.15; position: relative; z-index: 1; overflow-wrap: anywhere; }
.kpi-sub { font-size: .78rem; color: var(--muted); position: relative; z-index: 1; }
.kpi-go { position: absolute; inset-inline-end: 14px; bottom: 12px; color: var(--muted); font-weight: 800; transition: transform .15s ease; }
.kpi-card:hover .kpi-go { color: var(--brand); transform: translateX(3px); } [dir=rtl] .kpi-card:hover .kpi-go { transform: translateX(-3px); }
.kpi-card.tone-brand .kpi-ico { background: var(--brand); color: #fff; } .kpi-card.tone-brand .kpi-value { color: var(--brand-600); }
.kpi-card.tone-ok .kpi-ico { background: var(--ok-50); } .kpi-card.tone-ok .kpi-value { color: var(--ok); }
.kpi-card.tone-warn .kpi-ico, .kpi-card.tone-warn::after { background: var(--accent-50); }
.kpi-card.tone-bad .kpi-ico, .kpi-card.tone-bad::after { background: var(--danger-50); } .kpi-card.tone-bad .kpi-value { color: var(--danger); }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pm-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(180deg, #fff, #FAFBFC); }
.pm-rows { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.pm-rows > b { text-align: end; }
.flow { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: baseline; }
.flow > b { text-align: end; } .flow .total { border-top: 2px solid var(--ink); padding-top: 6px; font-size: 1.05rem; }
.cmp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: var(--bg); border-radius: var(--radius-sm); padding: 10px; }
.cmp > div { display: flex; flex-direction: column; gap: 2px; } .cmp b { font-size: 1.05rem; }
.shift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.shift-card { text-align: start; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
    display: flex; flex-direction: column; gap: 8px; transition: box-shadow .15s ease, border-color .15s ease; border-inline-start: 5px solid var(--ok); }
.shift-card.open { border-inline-start-color: var(--accent); background: linear-gradient(180deg, #fff, var(--warn-50)); }
.shift-card:hover, .shift-card:focus-visible { box-shadow: var(--shadow-lg); border-color: var(--brand); outline: none; }
.issue { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg); font-size: .9rem; }
.issue.block { background: var(--danger-50); color: #7F1D1D; font-weight: 700; } .issue.warn { background: var(--warn-50); }
.item.disc { align-items: flex-start; border-inline-start: 4px solid var(--danger); } .item.disc.accepted, .item.disc.resolved { border-inline-start-color: var(--ok); }
.item.disc.explained { border-inline-start-color: var(--accent); } .item.disc.superseded { opacity: .6; border-inline-start-color: var(--line); }
.steps { padding-inline-start: 20px; color: var(--ink-2); display: grid; gap: 2px; }
.live-diff { align-self: end; padding: 12px; border-radius: var(--radius-sm); background: var(--bg); font-weight: 800; font-size: 1.05rem; min-height: 48px; display: flex; align-items: center; }
.timeline { list-style: none; border-inline-start: 2px solid var(--line); padding-inline-start: 14px; display: grid; gap: 10px; }
.timeline li { position: relative; } .timeline li::before { content: ""; position: absolute; inset-inline-start: -21px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.svc-bar { display: grid; gap: 4px; }
.mini { background: var(--bg); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 2px; } .mini span { font-size: .8rem; color: var(--muted); }
.cl-reconcile { border: 2px solid var(--brand); }
.shift-sum .row { gap: 8px; }
@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi-card { min-height: 116px; padding: 12px; } .kpi-value { font-size: 1.2rem; } .kpi-ico { width: 34px; height: 34px; font-size: 1.1rem; }
    .cl-date { width: 100%; } .cl-date .input { flex: 1 1 140px; min-width: 0; }
    .cmp { grid-template-columns: 1fr; }
    .closing h1 { font-size: 1.3rem; }
}
@media print { .closing .cl-date, .closing .kpi-go, .cl-reconcile { display: none !important; } }

/* ================================================================ Phones: data tables → stacked cards (labels from <th>, see core.js labelTables) */
@media (max-width: 600px) {
    .table-wrap:has(> table.t-cards) { overflow: visible; border: 0; background: transparent; }
    table.t-cards, table.t-cards tbody { display: block; width: 100%; }
    table.t-cards thead { display: none; }
    table.t-cards tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
    table.t-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0 !important; border: 0 !important; text-align: end; min-height: 32px; white-space: normal; }
    [dir=rtl] table.t-cards td { text-align: start; }
    table.t-cards td::before { content: attr(data-label); font-size: .8rem; font-weight: 700; color: var(--muted); text-align: start; flex: 0 0 auto; max-width: 45%; }
    table.t-cards td:not([data-label])::before, table.t-cards td[data-label=""]::before { display: none; }
    table.t-cards td:first-child { font-weight: 700; font-size: 1rem; }
    table.t-cards td:empty { display: none; }
    table.t-cards tr.clickable { cursor: pointer; } table.t-cards tr.clickable:active { background: var(--brand-50); }
}
/* Public header on very small phones: logo mark only, so language + sign-in always fit. */
@media (max-width: 400px) {
    .public-top .brand-text { display: none; }
    .public-top .wrap { gap: 8px; }
}
.hero .pill { white-space: normal; max-width: 100%; }
