/* E-REP — screens follow the Al Bayan Mobile layout; this is the new theme. */
@font-face { font-family: Plex; font-weight: 400; font-display: swap; src: url(../fonts/plex-ar-400.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 500; font-display: swap; src: url(../fonts/plex-ar-500.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 600; font-display: swap; src: url(../fonts/plex-ar-600.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 700; font-display: swap; src: url(../fonts/plex-ar-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 400; font-display: swap; src: url(../fonts/plex-la-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 500; font-display: swap; src: url(../fonts/plex-la-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 600; font-display: swap; src: url(../fonts/plex-la-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 700; font-display: swap; src: url(../fonts/plex-la-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  /* light — cool blue-grey neutrals */
  --bg: #EEF2F8; --surface: #FFFFFF; --ink: #0F1B33; --muted: #59667F; --faint: #8994AB; --line: #DDE3EE;
  --hero: #0F1B33; --hero-ink: #FFFFFF;
  --ok: #1F7A45; --ok-wash: #E3F3EA; --warn: #A15C00; --warn-wash: #FCEFD9; --danger: #C23A2B; --danger-wash: #FCE6E2;
  --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 10px 26px rgba(15, 27, 51, .08);
  /* accent — E-REP blue (default) */
  --brand: #034EA1; --brand-deep: #03367A; --brand-2: #3B82D9; --brand-wash: #E6EEF8; --brand-rgb: 3, 78, 161; --brand-ink: #034EA1;
  --r: 12px; --r-tile: 22px; --tap: 52px; --tabbar: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gut-l: max(16px, env(safe-area-inset-left, 0px)); --gut-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
:root[data-accent="teal"]     { --brand: #0B6F74; --brand-deep: #064A4E; --brand-2: #14A39D; --brand-wash: #E1F2F0; --brand-rgb: 11, 111, 116;  --brand-ink: #0B6F74; }
:root[data-accent="green"]    { --brand: #1F6B3A; --brand-deep: #124526; --brand-2: #34A35A; --brand-wash: #E3F2E8; --brand-rgb: 31, 107, 58;   --brand-ink: #1F6B3A; }
:root[data-accent="violet"]   { --brand: #4B3BC0; --brand-deep: #2E2385; --brand-2: #7466F0; --brand-wash: #EDEBFD; --brand-rgb: 75, 59, 192;   --brand-ink: #4B3BC0; }
:root[data-accent="amber"]    { --brand: #9C4A06; --brand-deep: #6B3203; --brand-2: #E08A2E; --brand-wash: #FCEBD9; --brand-rgb: 156, 74, 6;    --brand-ink: #9C4A06; }
:root[data-accent="graphite"] { --brand: #2B3448; --brand-deep: #161C29; --brand-2: #5C6B8A; --brand-wash: #E8EBF1; --brand-rgb: 43, 52, 72;    --brand-ink: #2B3448; }
/* dark — deep navy, accents lifted for contrast */
:root[data-scheme="dark"] {
  --bg: #0A1020; --surface: #131B2E; --ink: #E7ECF7; --muted: #9AA6C0; --faint: #6B7792; --line: #24304A;
  --hero: #1C2741; --ok: #5FCB8A; --ok-wash: #14341F; --warn: #F2AE57; --warn-wash: #3B2A10; --danger: #F27A69; --danger-wash: #43201B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 26px rgba(0, 0, 0, .35); color-scheme: dark;
  --brand-wash: rgba(var(--brand-rgb), .24); --brand-2: color-mix(in srgb, var(--brand) 50%, white); --brand-ink: color-mix(in srgb, var(--brand) 42%, white);
}
@media (prefers-color-scheme: dark) {
  :root[data-scheme="auto"] {
    --bg: #0A1020; --surface: #131B2E; --ink: #E7ECF7; --muted: #9AA6C0; --faint: #6B7792; --line: #24304A;
    --hero: #1C2741; --ok: #5FCB8A; --ok-wash: #14341F; --warn: #F2AE57; --warn-wash: #3B2A10; --danger: #F27A69; --danger-wash: #43201B;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 26px rgba(0, 0, 0, .35); color-scheme: dark;
    --brand-wash: rgba(var(--brand-rgb), .24); --brand-2: color-mix(in srgb, var(--brand) 50%, white); --brand-ink: color-mix(in srgb, var(--brand) 42%, white);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
/* in a browser (Safari / Chrome, not the Android shell): no double-tap zoom, taps land at once, inputs never below 16px (iOS zooms into smaller ones) */
html, body, button, a, label, input, select, textarea, .row, .lcard, .tile, .chip { touch-action: manipulation; }
input, select, textarea { font-size: max(16px, 1em); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 41; background: var(--brand-deep); }
body { font-family: Plex, system-ui, sans-serif; font-size: 16px; line-height: 1.5; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .money { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- header bar (every inner screen) ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  display: flex; align-items: center; gap: 4px; min-height: 60px;
  padding-block: 6px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px));
  background: linear-gradient(120deg, var(--brand-deep), var(--brand)); color: #fff; box-shadow: 0 4px 16px rgba(var(--brand-rgb), .28);
}
.topbar h1 { flex: 1; margin: 0; text-align: center; font-size: 19px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { display: block; font-size: 13px; font-weight: 400; opacity: .85; }
.topbar .spacer { width: 44px; }
.iconbtn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; color: inherit; flex-shrink: 0; }
.iconbtn:active { background: rgba(255, 255, 255, .15); }
.iconbtn svg { width: 24px; height: 24px; }

main.screen { flex: 1; padding-top: 16px; padding-bottom: calc(var(--tabbar) + 28px + var(--safe-b)); padding-left: var(--gut-l); padding-right: var(--gut-r); }
main.screen.no-tabs { padding-bottom: calc(120px + var(--safe-b)); }
@media (min-width: 720px) { main.screen { max-width: 720px; margin: 0 auto; width: 100%; } }

/* ---------- tab pages: soft backdrop, logo, tiles ---------- */
/* soft brand light behind tab pages */
.backdrop { position: fixed; inset: 0; z-index: -1; background:
  radial-gradient(60% 40% at 15% 10%, rgba(var(--brand-rgb), .14), transparent 70%),
  radial-gradient(55% 45% at 90% 35%, rgba(var(--brand-rgb), .12), transparent 70%),
  var(--bg); }
.homehead { display: flex; align-items: center; justify-content: space-between; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.homehead .iconbtn { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.brandmark { display: flex; justify-content: center; margin: 4px 0 18px; }
.brandmark svg { height: 120px; width: auto; max-width: 80%; }

.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  aspect-ratio: 1 / .92; padding: 14px 10px; border: 1px solid var(--line); border-radius: var(--r-tile);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-decoration: none; color: var(--ink);
  font-size: 15px; font-weight: 600; text-align: center; line-height: 1.35;
}
.tile:active { transform: scale(.98); }
.tile .ic { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--brand-wash); color: var(--brand-ink); }
.tile .ic svg { width: 30px; height: 30px; }
.tile small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.tile.alert { background: linear-gradient(160deg, #E0624E, #C2412D); border-color: transparent; color: #fff; }
.tile.alert .ic { background: rgba(255, 255, 255, .2); color: #fff; }
.tile.alert small { color: rgba(255, 255, 255, .85); }
.tile:disabled { opacity: .45; }


/* bottom navigation: four tabs, the active one lifted */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  padding-left: var(--gut-l); padding-right: var(--gut-r);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 20px rgba(18, 41, 46, .08);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--faint); font-size: 12px; font-weight: 600; }
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a[aria-current="page"] { color: var(--brand-ink); }
.tabbar a[aria-current="page"] .bub {
  display: grid; place-items: center; width: 56px; height: 56px; margin-top: -30px; border-radius: 50%;
  background: linear-gradient(140deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 6px 16px rgba(var(--brand-rgb), .35); border: 4px solid var(--bg);
}
.tabbar .badge { position: absolute; top: 6px; inset-inline-start: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ---------- lists ---------- */
.searchbar {
  position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 20;
  display: flex; align-items: center; gap: 8px; margin: -16px calc(-1 * var(--gut-r)) 8px calc(-1 * var(--gut-l));
  padding: 8px var(--gut-r) 8px var(--gut-l); background: var(--surface); border-bottom: 1px solid var(--line);
}
.searchbar input { flex: 1; min-width: 0; height: 46px; border: 0; border-bottom: 2px solid var(--line); background: transparent; font-size: 16px; padding: 0 4px; }
.searchbar input:focus { outline: 0; border-bottom-color: var(--brand-2); }
.searchbar svg { width: 22px; height: 22px; color: var(--faint); }
.searchbar .iconbtn { color: var(--ink); }

.list { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; background: none; width: 100%; text-align: start; border-inline: 0; border-top: 0; }
.row:last-child { border-bottom: 0; }
button.row, a.row { cursor: pointer; }
button.row:active, a.row:active { background: var(--brand-wash); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: end; flex-shrink: 0; }
.group-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 18px 4px 8px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chip { flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.tag { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; line-height: 20px; }
.tag.ok { background: var(--ok-wash); color: var(--ok); }
.tag.wait { background: var(--warn-wash); color: var(--warn); }
.tag.err { background: var(--danger-wash); color: var(--danger); }
.tag.info { background: var(--brand-wash); color: var(--brand-ink); }
.money { font-weight: 600; }
.neg { color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }


/* ---------- forms (report filters, receipt) ---------- */
.form { display: grid; gap: 18px; min-width: 0; }
.form > * { min-width: 0; }
.uline { display: block; }
.uline > span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }
.uline input { width: 100%; height: 48px; border: 0; border-bottom: 1.5px solid var(--faint); background: transparent; font-size: 19px; font-weight: 600; padding: 0 2px; }
.uline input:focus { outline: 0; border-bottom-color: var(--brand-2); }
.outlined { position: relative; display: block; }
.outlined > span { position: absolute; top: -10px; inset-inline-start: 18px; padding: 0 6px; background: var(--bg); font-size: 13px; font-weight: 600; color: var(--muted); }
.outlined select, .outlined input { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; height: 58px; border: 1.5px solid var(--brand-2); border-radius: 18px; background: var(--surface); padding: 0 18px; font-size: 16px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-weight: 500; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 13px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-end .15s; }
.switch input:checked { background: var(--brand-2); }
.switch input:checked::after { inset-inline-end: 23px; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 30px; border-radius: 24px; border: 0; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; box-shadow: 0 4px 12px rgba(var(--brand-rgb), .25); }
.pill.ghost { background: var(--surface); color: var(--brand-ink); box-shadow: none; border: 1.5px solid var(--brand-2); }
.pill.danger { background: var(--surface); color: var(--danger); box-shadow: none; border: 1.5px solid var(--danger); }
.pill:disabled { opacity: .45; cursor: default; }
.pill svg { width: 20px; height: 20px; }
.center { display: flex; justify-content: center; }
.input { width: 100%; min-height: 50px; padding: 10px 14px; border: 1.5px solid var(--faint); border-radius: var(--r); background: var(--surface); font-size: 17px; }
.input:focus { border-color: var(--brand-2); outline: 0; }
.input.ltr { direction: ltr; text-align: right; }
textarea.input { min-height: 84px; resize: vertical; }

/* ---------- invoice ---------- */
.docbar { position: sticky; top: calc(60px + env(safe-area-inset-top, 0px)); z-index: 20; margin: -16px calc(-1 * var(--gut-r)) 0 calc(-1 * var(--gut-l)); padding: 12px var(--gut-r) 6px var(--gut-l); background: var(--surface); border-bottom: 1px solid var(--line); }
.docbar .cust { margin: 0; text-align: center; font-size: 22px; font-weight: 700; color: var(--brand-ink); line-height: 1.3; }
.docbar .chips { justify-content: center; padding: 10px 0 4px; }
.cols { display: grid; grid-template-columns: 1fr 1.1fr 1.2fr .9fr; gap: 6px; padding: 10px 14px 6px; font-size: 13px; font-weight: 700; color: var(--brand-ink); text-align: center; }
.cols > :first-child, .lcard .vals > :first-child { text-align: start; }
.lcard { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 8px; cursor: pointer; border: 1px solid transparent; width: 100%; text-align: start; }
.lcard:active { border-color: var(--brand-2); }
.lcard .name { font-weight: 600; }
.lcard .vals { display: grid; grid-template-columns: 1fr 1.1fr 1.2fr .9fr; gap: 6px; margin-top: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.lcard .bonus { color: var(--ok); font-weight: 700; }
.lcard .req { font-size: 13px; color: var(--warn); margin-top: 4px; }
.docfoot {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; padding: 12px var(--gut-r) calc(12px + var(--safe-b)) var(--gut-l);
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 20px rgba(18, 41, 46, .1);
  display: flex; align-items: center; gap: 10px;
}
.docfoot .sum { flex: 1; min-width: 0; }
.docfoot .sum small { display: block; color: var(--muted); font-size: 13px; }
.docfoot .sum b { font-size: 22px; }
.docfoot .pill { padding: 0 18px; }

/* item picker: the line being edited stays on top */
.items { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--brand); color: #fff; cursor: pointer; flex-shrink: 0; box-shadow: 0 4px 12px rgba(var(--brand-rgb), .3); }
.round.light { background: var(--brand-wash); color: var(--brand-ink); box-shadow: none; }
.round svg { width: 24px; height: 24px; }

/* ---------- cards, sheets, toasts ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card, .card + .list, .list + .card { margin-top: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: end; }
.custhead { text-align: center; }
.custhead h2 { margin: 0 0 4px; font-size: 21px; color: var(--brand-ink); line-height: 1.35; }
.custhead .bal { margin-top: 10px; font-size: 14px; color: var(--muted); }
.custhead .bal b { display: block; font-size: 28px; color: var(--ink); }
.minitiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.minitiles button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 2px; border: 0; border-radius: 16px; background: var(--brand-wash); color: var(--brand-ink); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.minitiles button svg { width: 26px; height: 26px; }
.minitiles button.alert { background: var(--danger); color: #fff; }
.minitiles button:disabled { opacity: .4; }

.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(6, 12, 28, .5); display: flex; align-items: flex-end; animation: fadein .2s ease-out; backdrop-filter: blur(2px); }
.sheet { width: 100%; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px var(--gut-r) calc(16px + var(--safe-b)) var(--gut-l); animation: sheetup .42s cubic-bezier(.2,.9,.25,1.12); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
.sheet h3 { margin: 0 0 12px; font-size: 18px; text-align: center; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
.toast { position: fixed; inset-inline: 16px; top: calc(70px + env(safe-area-inset-top, 0px)); z-index: 70; background: var(--hero); color: var(--hero-ink); padding: 12px 16px; border-radius: var(--r); font-weight: 500; box-shadow: var(--shadow); animation: toastin .34s cubic-bezier(.2,.9,.3,1.2); }
.toast.err { background: var(--danger); }
.netstrip { font-size: 13px; padding: 6px 16px; text-align: center; }
.netstrip.offline { background: var(--warn-wash); color: var(--warn); }
.netstrip.sending { background: var(--brand-wash); color: var(--brand-ink); }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding-block: 24px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); max-width: 440px; margin: 0 auto; }
.login .brandmark svg { height: 190px; }
.login .form { margin-top: 8px; }
.pin { letter-spacing: 8px; text-align: center; }
.err-text { color: var(--danger); font-size: 14px; margin: 0; min-height: 21px; text-align: center; }

.map { height: calc(100vh - 200px); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }

/* ---------- home layout: brand row, visit banner, main action, quick grid, today ---------- */
.toprow { display: flex; align-items: center; gap: 10px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); margin-bottom: 14px; }
.toprow .logo-sm { width: 46px; height: 46px; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(18, 54, 168, .28)); }
.toprow .who { flex: 1; min-width: 0; }
.toprow .who b { display: block; font-size: 17px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toprow .who span { font-size: 13px; color: var(--muted); }
.toprow .iconbtn { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }

.visitban { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; margin-bottom: 14px; }
.visitban.on { background: var(--hero); color: var(--hero-ink); }
.visitban.off { background: var(--surface); border: 1.5px dashed var(--faint); color: var(--ink); cursor: pointer; width: 100%; text-align: start; font: inherit; }
.visitban .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.visitban.on .ic { background: rgba(255, 255, 255, .14); }
.visitban.off .ic { background: var(--brand-wash); color: var(--brand-ink); }
.visitban .ic svg { width: 24px; height: 24px; }
.visitban .main { flex: 1; min-width: 0; }
.visitban .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visitban .main span { font-size: 13px; opacity: .8; }
.visitban .end { min-height: 42px; padding: 0 18px; border-radius: 21px; border: 0; background: var(--danger); color: #fff; font-weight: 700; cursor: pointer; }
.visitban .timer { font-variant-numeric: tabular-nums; }

.mainaction { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 92px; padding: 16px 20px; border: 0; border-radius: 22px;
  background: linear-gradient(125deg, var(--brand-deep), var(--brand) 55%, color-mix(in srgb, var(--brand) 70%, var(--brand-2))); color: #fff; box-shadow: 0 10px 24px rgba(var(--brand-rgb), .3); cursor: pointer; text-align: start; font: inherit; }
.mainaction .ic { width: 56px; height: 56px; border-radius: 18px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex-shrink: 0; }
.mainaction .ic svg { width: 30px; height: 30px; }
.mainaction b { display: block; font-size: 20px; }
.mainaction span { font-size: 13px; opacity: .85; }
.mainaction .go { margin-inline-start: auto; opacity: .7; transform: scaleX(-1); }

.quick3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.quick3 button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.3; text-align: center; }
.quick3 button .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-wash); color: var(--brand-ink); display: grid; place-items: center; }
.quick3 button .ic svg { width: 24px; height: 24px; }
.quick3 button .n { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn); color: #fff; font-size: 11px; line-height: 20px; }


/* menu lists on بطاقات / كشوفات */
.pagetitle { padding-top: calc(16px + env(safe-area-inset-top, 0px)); margin: 0 0 14px; font-size: 24px; font-weight: 700; }
.menu { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.menu + .menu { margin-top: 14px; }
.menu button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: start; font: inherit; color: var(--ink); }
.menu button:last-child { border-bottom: 0; }
.menu button:active { background: var(--brand-wash); }
.menu .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-wash); color: var(--brand-ink); display: grid; place-items: center; flex-shrink: 0; }
.menu .ic svg { width: 24px; height: 24px; }
.menu .t { flex: 1; min-width: 0; }
.menu .t b { display: block; font-size: 16px; }
.menu .t span { font-size: 13px; color: var(--muted); }
.menu .chev { color: var(--faint); transform: scaleX(-1); }
.menu .chev svg { width: 20px; height: 20px; }

/* theme picker */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { min-height: 42px; border: 0; border-radius: 10px; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* home status strip */
.strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.strip > * { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 72px; padding: 8px 4px; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: none; cursor: pointer; }
.strip > * + * { border-inline-start: 1px solid var(--line); }
.strip b { font-size: 20px; font-variant-numeric: tabular-nums; }
.strip b.small { font-size: 14px; }
.strip b.warn { color: var(--warn); }
.strip small { font-size: 12.5px; color: var(--muted); }
.menu .ic.err { background: var(--danger-wash); color: var(--danger); }


/* =====================================================================
   Motion: page transitions, entering lists, press feedback, pops
   ===================================================================== */
@keyframes fadein { from { opacity: 0; } }
@keyframes sheetup { from { transform: translateY(100%); } }
@keyframes toastin { from { transform: translateY(-16px) scale(.96); opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes slide-in-l { from { transform: translateX(-28%); opacity: 0; } }
@keyframes slide-in-r { from { transform: translateX(28%); opacity: 0; } }
@keyframes slide-out-l { to { transform: translateX(-18%); opacity: 0; } }
@keyframes slide-out-r { to { transform: translateX(18%); opacity: 0; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.enter { animation: rise .42s cubic-bezier(.2,.8,.25,1) both; }
.pop { animation: pop .36s cubic-bezier(.2,.9,.3,1.3) both; }
button, .pcard, .crow, .oitem, .cat { transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease; }
button:active:not(:disabled), .crow:active, .oitem:active { transform: scale(.965); }

/* RTL: going forward slides in from the left, back from the right */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: cubic-bezier(.3,.7,.2,1); }
html[data-nav="fwd"]::view-transition-old(root) { animation-name: slide-out-r; }
html[data-nav="fwd"]::view-transition-new(root) { animation-name: slide-in-l; }
html[data-nav="back"]::view-transition-old(root) { animation-name: slide-out-l; }
html[data-nav="back"]::view-transition-new(root) { animation-name: slide-in-r; }
html[data-nav="tab"]::view-transition-old(root) { animation: .16s ease-out both fadeout; }
html[data-nav="tab"]::view-transition-new(root) { animation: .22s ease-out both fadein; }
@keyframes fadeout { to { opacity: 0; } }
.tabbar { view-transition-name: tabbar; }
.topbar { view-transition-name: topbar; }
::view-transition-old(tabbar), ::view-transition-new(tabbar), ::view-transition-old(topbar), ::view-transition-new(topbar) { animation: none; }

/* saved! */
.success { position: fixed; inset: 0; z-index: 95; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); animation: fadein .2s ease-out; }
.success.out { opacity: 0; transition: opacity .25s; }
.success .tick svg { width: 96px; height: 96px; }
.success .tick circle { fill: var(--ok); stroke: none; transform-origin: center; animation: pop .45s cubic-bezier(.2,.9,.3,1.3) both; }
.success .tick path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s .3s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success b { font-size: 20px; margin-top: 10px; animation: rise .4s .35s both; }
.success span { color: var(--muted); animation: rise .4s .45s both; }

/* ---------- pictures ---------- */
.pic { position: relative; display: grid; place-items: center; overflow: hidden; background: #fff; }
.pic img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .35s ease, transform .35s ease; transform: scale(1.02); }
.pic.ready img { opacity: 1; transform: none; }
.pic.loading { background: linear-gradient(90deg, #f1f4f9 25%, #e3e9f3 37%, #f1f4f9 63%) 0 0 / 400% 100%; animation: shimmer 1.3s linear infinite; }
:root[data-scheme="dark"] .pic.loading { background: linear-gradient(90deg, #1b2438 25%, #24304a 37%, #1b2438 63%) 0 0 / 400% 100%; }
.pic.none { background: linear-gradient(140deg, color-mix(in srgb, var(--tint, var(--brand)) 85%, white), var(--tint, var(--brand))); color: #fff; }
.pic.none span { font-size: 26px; font-weight: 700; letter-spacing: 1px; opacity: .92; direction: ltr; }

/* ---------- catalog (new invoicing) ---------- */
.cathead { gap: 2px; }
.cathead .ttl { flex: 1; min-width: 0; text-align: center; display: grid; justify-items: center; gap: 4px; }
.cathead .ttl b { max-width: 100%; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cathead .ttl small { font-size: 13px; opacity: .85; }
.seg { display: inline-flex; padding: 3px; border-radius: 14px; background: rgba(255, 255, 255, .16); }
.seg button { border: 0; background: none; color: #fff; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 11px; cursor: pointer; opacity: .82; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--brand-deep); opacity: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
main.catalog { padding-top: 0; padding-bottom: calc(120px + var(--safe-b)); }
.catbar { position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 20; margin: 0 calc(-1 * var(--gut-r)) 10px calc(-1 * var(--gut-l));
  padding: 8px var(--gut-r) 0 var(--gut-l); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); }
.catbar .searchbar { margin-bottom: 4px; }
.rail { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.rail::-webkit-scrollbar { display: none; }
.cat { flex-shrink: 0; scroll-snap-align: center; display: grid; justify-items: center; gap: 5px; width: 74px; border: 0; background: none; cursor: pointer; padding: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.cat > span:last-child { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .cic, .cat .pic.logo { width: 58px; height: 58px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--brand-ink); position: relative; border: 2px solid transparent; }
.cat .pic.logo { padding: 6px; }
.cat .cic svg { width: 26px; height: 26px; }
.cat .cic.hot { background: linear-gradient(140deg, #FFB547, #F06A2A); color: #fff; }
.cat .n { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 11px; line-height: 20px; }
.cat[aria-pressed="true"] { color: var(--brand-ink); }
.cat[aria-pressed="true"] .cic, .cat[aria-pressed="true"] .pic.logo { border-color: var(--brand-2); box-shadow: 0 6px 18px rgba(var(--brand-rgb), .28); transform: translateY(-2px); }

.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pgrid > .empty, .pgrid > .more { grid-column: 1 / -1; }
.pgrid > .more { display: flex; justify-content: center; padding: 8px; }
.pcard { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; border: 2px solid transparent; min-width: 0; }
.pcard.in { border-color: rgba(var(--brand-rgb), .45); }
.pcard .media { position: relative; }
.pcard .media .pic { aspect-ratio: 1 / .82; padding: 8px; }
.ribbon { position: absolute; top: 8px; inset-inline-start: 8px; display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 7px; border-radius: 10px;
  background: linear-gradient(140deg, #FFB547, #F06A2A); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 3px 10px rgba(240, 106, 42, .35); direction: ltr; }
.ribbon svg { width: 13px; height: 13px; fill: currentColor; }
.stock { position: absolute; bottom: 8px; inset-inline-end: 8px; padding: 0 8px; border-radius: 9px; background: rgba(15, 27, 51, .72); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px; }
.stock.out { background: var(--danger); }
.pcard .body { padding: 8px 10px 0; flex: 1; min-height: 0; }
.pcard .nm { font-weight: 700; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; direction: ltr; text-align: left; }
.pcard .sn { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: left; }
.pcard .foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px 10px; }
.pcard .price { display: grid; line-height: 1.2; min-width: 0; }
.pcard .price b { font-size: 16px; color: var(--brand-ink); }
.free { color: var(--ok); font-size: 12px; font-weight: 700; }
.addbtn { width: 40px; height: 40px; border-radius: 14px; border: 0; background: linear-gradient(140deg, var(--brand-2), var(--brand)); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 14px rgba(var(--brand-rgb), .3); flex-shrink: 0; }
.addbtn svg { width: 22px; height: 22px; }
.stepper { display: inline-flex; align-items: center; background: var(--brand-wash); border-radius: 14px; padding: 2px; flex-shrink: 0; direction: ltr; }
.stepper button { width: 34px; height: 36px; border: 0; background: none; color: var(--brand-ink); display: grid; place-items: center; cursor: pointer; border-radius: 12px; padding: 0; }
.stepper button svg { width: 18px; height: 18px; }
.stepper .q { width: auto; min-width: 30px; font-weight: 700; font-size: 15px; color: var(--ink); }
.stepper.sm button { width: 30px; height: 30px; }
.stepper.sm .q { min-width: 26px; text-align: center; font-weight: 700; }

.cartbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; padding: 10px var(--gut-r) calc(10px + var(--safe-b)) var(--gut-l); pointer-events: none;
  transform: translateY(130%); transition: transform .38s cubic-bezier(.2,.9,.25,1.15); }
.cartbar.show { transform: none; pointer-events: auto; }
.cartmain { width: 100%; max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 10px 8px 16px; border: 0; border-radius: 20px; cursor: pointer;
  background: linear-gradient(120deg, var(--brand-deep), var(--brand)); color: #fff; box-shadow: 0 12px 30px rgba(var(--brand-rgb), .42); text-align: start; }
.cicon { position: relative; width: 46px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex-shrink: 0; }
.cicon svg { width: 26px; height: 26px; }
.cicon .badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 22px; height: 22px; border-radius: 11px; background: #FFB547; color: #3a2400; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; padding: 0 5px; }
.cartmain .sum { flex: 1; display: grid; line-height: 1.25; }
.cartmain .sum b { font-size: 20px; }
.cartmain .sum small { opacity: .85; font-size: 12px; }
.cartmain .go { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--brand-deep); padding: 10px 14px; border-radius: 14px; font-weight: 700; }
.cartmain .go svg { width: 18px; height: 18px; }

/* product sheet */
.psheet { display: grid; gap: 12px; }
.psheet .hero { position: relative; border-radius: 18px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.psheet .hero .pic { aspect-ratio: 16 / 10; padding: 10px; }
.psheet h3 { margin: 0; text-align: start; font-size: 19px; direction: ltr; text-align: left; }
.psheet .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: 13px; }
.psheet .prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.psheet .prices > div { background: var(--bg); border-radius: 14px; padding: 8px 12px; display: grid; }
.psheet .prices > div.on { background: var(--brand-wash); box-shadow: inset 0 0 0 1.5px var(--brand-2); }
.psheet .prices small { color: var(--muted); font-size: 12px; }
.psheet .prices b { font-size: 17px; }
.offerbox { border-radius: 16px; padding: 10px 12px; background: linear-gradient(140deg, #FFF4E2, #FFE6D3); color: #6b3505; display: grid; gap: 8px; }
:root[data-scheme="dark"] .offerbox { background: linear-gradient(140deg, #3b2a10, #43201b); color: #f6c690; }
.offerbox > div:first-child { display: flex; align-items: center; gap: 6px; }
.offerbox svg { width: 18px; height: 18px; }
.offerbox .tiers { display: flex; flex-wrap: wrap; gap: 6px; }
.offerbox .chip { background: rgba(255, 255, 255, .7); border-color: transparent; color: inherit; min-height: 30px; font-size: 13px; }
.offerhint { font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 20px; }
.offerhint .free { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.offerhint .free svg { width: 16px; height: 16px; }
.qtyrow { display: flex; align-items: center; justify-content: center; gap: 14px; }
.qtyrow input { width: 120px; height: 58px; border: 0; border-radius: 16px; background: var(--bg); text-align: center; font-size: 26px; font-weight: 700; color: var(--ink); }
.qtyrow input:focus { outline: 2px solid var(--brand-2); }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: linear-gradient(140deg, var(--brand-2), var(--brand)); color: #fff; }
.round.light { background: var(--brand-wash); color: var(--brand-ink); }
.round svg { width: 24px; height: 24px; }
.psheet .quick { display: flex; justify-content: center; gap: 8px; }
.psheet .f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheetfoot { display: flex; align-items: center; gap: 10px; position: sticky; bottom: calc(-16px - var(--safe-b)); background: var(--surface); padding: 10px 0 4px; }
.sheetfoot > div { flex: 1; display: grid; }
.sheetfoot small { color: var(--muted); font-size: 12px; }
.sheetfoot b { font-size: 20px; }

/* review */
.review .chips { margin-bottom: 4px; }
.rlist { display: grid; gap: 10px; }
.rline { display: flex; gap: 10px; align-items: center; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; transition: transform .24s ease, opacity .24s ease, max-height .24s ease; max-height: 300px; }
.rline.leaving { transform: translateX(-30%); opacity: 0; max-height: 0; padding-block: 0; margin-block: -5px; }
.rline .pic.thumb { width: 64px; height: 64px; border-radius: 12px; flex-shrink: 0; padding: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.rline .mid { flex: 1; min-width: 0; display: grid; gap: 2px; justify-items: start; }
.rline .nm { font-weight: 700; font-size: 14px; line-height: 1.3; direction: ltr; text-align: left; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rline .calc { font-size: 13px; color: var(--muted); }
.rline .free { display: inline-flex; align-items: center; gap: 3px; border: 0; background: var(--ok-wash); border-radius: 10px; padding: 2px 8px; cursor: pointer; font-family: inherit; }
.rline .free.manual { background: var(--warn-wash); color: var(--warn); }
.rline .free.add { background: none; color: var(--faint); padding-inline: 0; }
.rline .free svg { width: 14px; height: 14px; }
.rline .req { font-size: 12px; color: var(--warn); }
.rline .end { display: grid; justify-items: end; gap: 6px; }
.addmore { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 50px; margin: 12px 0; border: 1.5px dashed rgba(var(--brand-rgb), .4); border-radius: 16px; background: none; color: var(--brand-ink); font-weight: 600; cursor: pointer; }
.addmore svg { width: 20px; height: 20px; }
.savings { display: flex; align-items: center; gap: 12px; background: linear-gradient(140deg, var(--ok-wash), color-mix(in srgb, var(--ok-wash) 60%, var(--surface))); color: var(--ok); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; animation: rise .4s both; }
.savings > svg { width: 30px; height: 30px; flex-shrink: 0; }
.savings div { display: grid; }
.savings small { color: var(--muted); }

/* offers */
.offers { display: grid; gap: 14px; }
.offercard { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 14px; overflow: hidden; }
.ohead { display: flex; align-items: center; gap: 12px; }
.ohead > div { flex: 1; display: grid; }
.ohead small { color: var(--muted); font-size: 12px; }
.ohead .badge { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(140deg, #FFB547, #F06A2A); color: #fff; }
.ohead .badge svg { width: 24px; height: 24px; fill: currentColor; }
.ohead .chip.on { background: #FFF1E4; color: #A04A10; border-color: transparent; direction: ltr; font-weight: 700; }
.offercard .tiers { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.tier { display: inline-flex; align-items: baseline; gap: 5px; background: var(--bg); border-radius: 12px; padding: 6px 10px; font-size: 13px; }
.tier b { font-size: 16px; }
.tier small { color: var(--faint); }
.ostrip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; scroll-snap-type: x proximity; }
.ostrip::-webkit-scrollbar { display: none; }
.oitem { position: relative; flex-shrink: 0; width: 118px; display: grid; gap: 4px; scroll-snap-align: start; border: 0; background: none; padding: 0; text-align: start; color: var(--ink); text-decoration: none; cursor: pointer; }
.oitem .pic { height: 100px; border-radius: 14px; padding: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.oitem .nm { font-size: 12px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; direction: ltr; text-align: left; }
.oitem .olabel { position: absolute; top: 6px; inset-inline-start: 6px; padding: 0 7px; border-radius: 9px; background: linear-gradient(140deg, #FFB547, #F06A2A); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; direction: ltr; }
.ostrip.home .oitem { width: 112px; }
.ostrip.home .oitem .pic { background: var(--surface); box-shadow: var(--shadow); }
.titlerow { display: flex; justify-content: space-between; align-items: center; }
.titlerow a { font-size: 13px; color: var(--brand-ink); text-decoration: none; font-weight: 600; }
.empty svg { width: 40px; height: 40px; opacity: .5; }

/* ---------- chat ---------- */
.tabhead { padding-inline: var(--gut-l) var(--gut-r); padding-bottom: 6px; }
.tabhead h2 { margin: 0; font-size: 24px; }
.avatar { position: relative; flex-shrink: 0; width: var(--s); height: var(--s); border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: calc(var(--s) * .36); }
.avatar svg { width: 55%; height: 55%; }
.avatar.online::after { content: ""; position: absolute; bottom: 1px; inset-inline-end: 1px; width: 11px; height: 11px; border-radius: 50%; background: #2BC46B; border: 2px solid var(--surface); }
.clist { margin-bottom: 14px; }
.crow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; }
.crow .main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.crow .top, .crow .bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.crow .top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .top small { color: var(--faint); font-size: 12px; flex-shrink: 0; }
.crow .bot span:first-child { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow.unread .bot span:first-child { color: var(--ink); font-weight: 600; }
.crow .typing { color: var(--ok) !important; }
.crow .count { min-width: 22px; height: 22px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; padding: 0 6px; flex-shrink: 0; }

.chathead { gap: 8px; }
.chathead .ttl { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.chathead .ttl b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chathead .ttl small { font-size: 12px; opacity: .85; min-height: 16px; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
main.thread { padding-bottom: calc(96px + var(--safe-b)); background:
  radial-gradient(50% 35% at 10% 15%, rgba(var(--brand-rgb), .07), transparent 70%), radial-gradient(45% 30% at 90% 70%, rgba(var(--brand-rgb), .06), transparent 70%); }
.bubbles { display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; margin: 12px 0 6px; }
.day span { font-size: 12px; color: var(--muted); background: var(--surface); padding: 3px 12px; border-radius: 10px; box-shadow: var(--shadow); }
.bub { max-width: 80%; padding: 7px 11px 5px; border-radius: 18px; position: relative; box-shadow: 0 1px 1.5px rgba(15, 27, 51, .08); word-wrap: break-word; white-space: pre-wrap; }
.bub.me { align-self: flex-start; background: linear-gradient(140deg, var(--brand-2), var(--brand)); color: #fff; border-start-start-radius: 6px; }
.bub.them { align-self: flex-end; background: var(--surface); border-start-end-radius: 6px; }
.bub.new { animation: pop .32s cubic-bezier(.2,.9,.3,1.3) both; transform-origin: bottom; }
.bub.pending { opacity: .75; }
.bub .who { display: block; font-size: 12px; font-weight: 700; color: var(--brand-ink); margin-bottom: 1px; }
.bub .meta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-size: 11px; opacity: .72; margin-top: 2px; direction: ltr; }
.bub .meta svg { width: 14px; height: 14px; }
.ticks { display: inline-flex; }
.ticks svg + svg { margin-inline-start: -9px; }
.ticks.read { color: #9FF0C4; opacity: 1; }
.custcard { display: flex; align-items: center; gap: 8px; border: 0; border-radius: 12px; padding: 6px 10px; background: rgba(255, 255, 255, .18); color: inherit; cursor: pointer; text-align: start; }
.bub.them .custcard { background: var(--brand-wash); color: var(--brand-ink); }
.custcard svg { width: 22px; height: 22px; }
.custcard span { display: grid; } .custcard small { opacity: .8; }
.composer { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: flex; align-items: flex-end; gap: 6px; padding: 8px var(--gut-r) calc(8px + var(--safe-b)) var(--gut-l);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); }
.composer .iconbtn { color: var(--muted); }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 0; border-radius: 22px; padding: 11px 16px; background: var(--surface); box-shadow: var(--shadow); max-height: 120px; line-height: 1.4; }
.composer textarea:focus { outline: 2px solid var(--brand-2); }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; background: linear-gradient(140deg, var(--brand-2), var(--brand)); color: #fff; cursor: pointer; flex-shrink: 0; box-shadow: 0 6px 14px rgba(var(--brand-rgb), .35); }
.send svg { width: 22px; height: 22px; transform: scaleX(-1); }
.menu .ic.ok { background: #FFF1E4; color: #D2631E; }

.ribbon.named { direction: rtl; }
.pcard.in .foot { flex-wrap: wrap; gap: 6px; }
.pcard.in .foot .price { flex-direction: row; display: flex; align-items: baseline; justify-content: space-between; width: 100%; gap: 6px; }
.pcard.in .foot .stepper { width: 100%; justify-content: space-between; }
.pcard.in .foot .stepper .q { flex: 1; }

/* ---------- route plan, photos, signature, approval ---------- */
.scrim.out { opacity: 0; transition: opacity .18s; }
.scrim.out .sheet { transform: translateY(12%); transition: transform .18s; }
.plancard { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 14px; margin: 14px 0 4px; }
.planhead { display: flex; align-items: center; gap: 12px; }
.planhead .ic { width: 44px; height: 44px; border-radius: 14px; background: var(--brand-wash); color: var(--brand-ink); display: grid; place-items: center; flex-shrink: 0; }
.planhead .ic svg { width: 24px; height: 24px; }
.planhead > div { flex: 1; min-width: 0; display: grid; }
.planhead small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 12px;
  background: conic-gradient(var(--ok) var(--p, 0%), var(--line) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; }
.planlist { display: grid; margin-top: 10px; }
.planstop { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px 0; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); }
.planstop .n { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-wash); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.planstop .n svg { width: 16px; height: 16px; }
.planstop.done .n { background: var(--ok-wash); color: var(--ok); }
.planstop.done .nm { color: var(--muted); text-decoration: line-through; }
.planstop.now .n { background: var(--brand); color: #fff; }
.planstop .nm { flex: 1; min-width: 0; display: grid; font-weight: 600; font-size: 15px; overflow: hidden; }
.planstop .nm small { color: var(--muted); font-weight: 400; font-size: 12px; }
.planstop .chev { color: var(--faint); transform: scaleX(-1); } .planstop .chev svg { width: 18px; height: 18px; }
.photostrip { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; scrollbar-width: none; }
.photostrip img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow); flex-shrink: 0; opacity: .85; }
.photostrip img.sent { opacity: 1; }
.sigsheet { display: grid; gap: 12px; }
.sigbox { position: relative; height: 220px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); overflow: hidden; touch-action: none; }
.sigpad { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.sighint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: #8994AB; pointer-events: none; transition: opacity .2s; font-size: 15px; }
.sighint svg { width: 22px; height: 22px; }
.sigactions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.sigimg { display: block; max-width: 60%; max-height: 120px; margin: 6px auto 0; background: #fff; border-radius: 10px; padding: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.approvalnote { display: flex; align-items: center; gap: 6px; color: var(--warn); font-weight: 600; }
.approvalnote svg { width: 18px; height: 18px; }
.minitiles button.alert { background: var(--danger-wash); color: var(--danger); }

/* ---- collection appointments & plan purposes (1.2) ---- */
.visitban.remind { background: var(--surface); border: 1.5px solid var(--brand); color: var(--ink); text-decoration: none; }
.visitban.remind .ic { background: var(--brand-soft, #e9effd); color: var(--brand-ink); }
.visitban.remind .main b { display: block; } .visitban.remind .main span { font-size: 13px; color: var(--muted); }
.planstop .purpose { display: inline-flex; gap: 4px; margin-inline-start: 6px; vertical-align: middle; } .planstop .purpose .tag { font-size: 11px; }
.planlist.appts .n.small { font-size: 12px; width: auto; min-width: 44px; padding: 0 4px; border-radius: 8px; }
.promisecard { border: 1.5px solid var(--brand); }
.segbar { display: flex; gap: 6px; justify-content: center; padding: 10px 0 4px; }
.segbar button { flex: 1; min-height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--muted); }
.segbar button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.segbar.mini { padding: 0; width: 120px; } .segbar.mini button { min-height: 36px; border-radius: 10px; }
.whenbox { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 10px; }
.disbox { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; } .disbox .uline { flex: 1; }
.pickrow { display: flex; align-items: center; gap: 10px; cursor: pointer; } .pickrow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); margin: 0; }
.pickrow.on { border-color: var(--brand); }
.rowtools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.segbar svg, .promisecard svg, .rowtools .chip svg, .chip svg { width: 20px; height: 20px; flex-shrink: 0; vertical-align: -4px; }
.promisecard > div:first-child svg { width: 22px; height: 22px; color: var(--brand-ink); }
.rowtools .chip { display: inline-flex; align-items: center; gap: 6px; }

/* photos attached to a document (receipt cash / cheque): tap to view full screen, tap again to close */
.photos img { display: block; cursor: zoom-in; }
.photos img.zoomed { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; object-fit: contain; background: #000; z-index: 60; border-radius: 0; margin: 0; cursor: zoom-out; }

/* a statement row that opens its invoice */
.row.tap { cursor: pointer; }
.row.tap:active { background: var(--line, #eee); }

/* receipt: invoice selection, per-invoice discount mode, 12-hour time picker */
.invhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 4px 8px; }
.invtools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.invtools .chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.invtools .segbar.mini { width: 104px; }
.invrow.on { border-color: var(--brand); }
.selsum { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 12px; margin: 2px 0 8px; border-radius: var(--r); background: var(--surface-2, rgba(var(--brand-rgb), .07)); color: var(--muted); }
.selsum b { color: var(--ink); }
.timepick { display: flex; align-items: center; gap: 6px; height: 48px; justify-content: flex-end; }
.timepick select { height: 40px; min-width: 56px; border: 1.5px solid var(--faint); border-radius: 12px; background: var(--surface); font: inherit; font-size: 18px; font-weight: 600; text-align: center; padding: 0 6px; }
.timepick .colon { font-weight: 700; font-size: 18px; }
.timepick .segbar.mini { width: 96px; margin-inline-start: 4px; }

/* item details sheet + long press */
.lp { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.itemsheet .itemhead { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 6px; }
.itemsheet .pic.big { width: 120px; height: 120px; border-radius: 16px; flex-shrink: 0; border: 1px solid var(--line); }
.itemsheet .pic.big.none { font-size: 34px; font-weight: 700; color: var(--tint, var(--brand)); background: var(--brand-wash); }
.itemsheet .itemmeta { flex: 1; min-width: 0; display: grid; gap: 3px; }
.itemsheet .group-title { margin: 12px 4px 6px; }
.itemsheet .row { min-height: 42px; }
button.row.tap { border-bottom: 1px solid var(--line); font: inherit; cursor: pointer; }
.warnnote { margin: 2px 0 8px; padding: 8px 12px; border-radius: var(--r); background: #fff6e0; color: #8a5a00; }
:root[data-scheme="dark"] .warnnote { background: #3a2d10; color: #ffd27a; }
