/* Tokens: light by default, dark via [data-theme="dark"] or system preference with [data-theme="system"] */
:root {
  color-scheme: light;
  --canvas: #F1F4F2; --card: #FFFFFF; --card-press: #F2F6F4;
  --ink: #0F1A15; --ink-2: #44514B; --muted: #5E6B65; --line: #E3E9E6; --input-border: #C3CFC9;
  --field: #F1F5F3; --field-focus: #FFFFFF; --chev: #AEBAB4; --switch-off: #CDD6D2; --check-border: #C3CEC9;
  --segment-bg: #E4EAE7; --segment-on: #FFFFFF; --chat-bg: #E7EEEA; --bubble-me: #D3F1E4; --day-bg: rgba(255,255,255,.78);
  --tabbar-bg: rgba(255,255,255,.97); --modal-bg: #FFFFFF; --grab: #C8D2CD; --overlay: rgba(6,20,15,.45);
  --toast-bg: #0F1A15; --toast-fg: #FFFFFF; --chip-on-bg: #0F1A15; --chip-on-fg: #FFFFFF;
  --brand: #0D6A55; --brand-2: #12936F; --brand-text: #0D6A55; --brand-dark: #0B3A2F; --brand-soft: #DDF2EA; --mint: #4CC3A0; --on-brand: #FFFFFF;
  --hero-from: #1B7A62; --hero-to: #0B3A2F; --hero-edge: transparent;
  --inbox-to: #EAF6FF; --upload-border: #BCCDC5; --choice-on: #F5FBF8; --seen-ring: #CBD5D0;
  --c-vaad: #2F6FE4;   --c-vaad-soft: #E3ECFD;
  --c-arnona: #7A4DD8; --c-arnona-soft: #EEE6FB;
  --c-water: #0B98BA;  --c-water-soft: #DDF3F8;
  --c-power: #D48A00;  --c-power-soft: #FDF0D5;
  --c-gas: #E5603A;    --c-gas-soft: #FCE6DE;
  --c-net: #D6457A;    --c-net-soft: #FBE3EC;
  --ok: #127A43; --ok-soft: #DCF3E5; --due: #934C00; --due-soft: #FCEBCF; --bad: #B32424; --bad-soft: #FBE1DE; --info: #2D5DA8; --info-soft: #E4ECF8;
  --stage: #DCE4E0; --panel-btn: #F7FAF8; --panel-border: #C5D2CB; --panel-hover: #E7EEEA; --panel-on: #FFFFFF; --device: #0E1915; --device-ring: transparent;
  --shadow-lg: 0 30px 60px -20px rgba(0,0,0,.35);
  --font: "Rubik", "Noto Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-card: 22px; --r-btn: 16px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0B110F; --card: #151D1A; --card-press: #1C2622;
  --ink: #E8EFEC; --ink-2: #BAC7C1; --muted: #98A6A0; --line: #24302B; --input-border: #3E4D47;
  --field: #1C2622; --field-focus: #222D29; --chev: #5E6B65; --switch-off: #36433D; --check-border: #4A5852;
  --segment-bg: #1C2622; --segment-on: #2E3A35; --chat-bg: #0E1613; --bubble-me: #154235; --day-bg: rgba(30,40,36,.9);
  --tabbar-bg: rgba(17,24,21,.97); --modal-bg: #18211D; --grab: #3A4742; --overlay: rgba(0,0,0,.62);
  --toast-bg: #E8EFEC; --toast-fg: #0F1A15; --chip-on-bg: #E8EFEC; --chip-on-fg: #0F1A15;
  --brand: #0E7A5C; --brand-2: #2FB58B; --brand-text: #5FD3AE; --brand-dark: #0B3A2F; --brand-soft: #143A30; --mint: #4CC3A0; --on-brand: #FFFFFF;
  --hero-from: #1D8A6E; --hero-to: #082A21; --hero-edge: rgba(255,255,255,.07);
  --inbox-to: #12283A; --upload-border: #3A4842; --choice-on: #142620; --seen-ring: #3A4742;
  --c-vaad: #7EA6FF;   --c-vaad-soft: #172443;
  --c-arnona: #B097F2; --c-arnona-soft: #251B3F;
  --c-water: #4FC6E2;  --c-water-soft: #0E2C35;
  --c-power: #F2B544;  --c-power-soft: #33270E;
  --c-gas: #F48C65;    --c-gas-soft: #3A1E14;
  --c-net: #F07DA9;    --c-net-soft: #3A1727;
  --ok: #52CC86; --ok-soft: #12301F; --due: #F0A64A; --due-soft: #352512; --bad: #F2766D; --bad-soft: #3B1A19; --info: #84AAF0; --info-soft: #172442;
  --stage: #070B09; --panel-btn: #151D1A; --panel-border: #2A3631; --panel-hover: #18211D; --panel-on: #1E2924; --device: #000000; --device-ring: rgba(255,255,255,.12);
  --shadow-lg: 0 30px 60px -20px rgba(0,0,0,.7);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --canvas: #0B110F; --card: #151D1A; --card-press: #1C2622;
    --ink: #E8EFEC; --ink-2: #BAC7C1; --muted: #98A6A0; --line: #24302B; --input-border: #3E4D47;
    --field: #1C2622; --field-focus: #222D29; --chev: #5E6B65; --switch-off: #36433D; --check-border: #4A5852;
    --segment-bg: #1C2622; --segment-on: #2E3A35; --chat-bg: #0E1613; --bubble-me: #154235; --day-bg: rgba(30,40,36,.9);
    --tabbar-bg: rgba(17,24,21,.97); --modal-bg: #18211D; --grab: #3A4742; --overlay: rgba(0,0,0,.62);
    --toast-bg: #E8EFEC; --toast-fg: #0F1A15; --chip-on-bg: #E8EFEC; --chip-on-fg: #0F1A15;
    --brand: #0E7A5C; --brand-2: #2FB58B; --brand-text: #5FD3AE; --brand-dark: #0B3A2F; --brand-soft: #143A30; --mint: #4CC3A0; --on-brand: #FFFFFF;
    --hero-from: #1D8A6E; --hero-to: #082A21; --hero-edge: rgba(255,255,255,.07);
    --inbox-to: #12283A; --upload-border: #3A4842; --choice-on: #142620; --seen-ring: #3A4742;
    --c-vaad: #7EA6FF;   --c-vaad-soft: #172443;
    --c-arnona: #B097F2; --c-arnona-soft: #251B3F;
    --c-water: #4FC6E2;  --c-water-soft: #0E2C35;
    --c-power: #F2B544;  --c-power-soft: #33270E;
    --c-gas: #F48C65;    --c-gas-soft: #3A1E14;
    --c-net: #F07DA9;    --c-net-soft: #3A1727;
    --ok: #52CC86; --ok-soft: #12301F; --due: #F0A64A; --due-soft: #352512; --bad: #F2766D; --bad-soft: #3B1A19; --info: #84AAF0; --info-soft: #172442;
    --stage: #070B09; --panel-btn: #151D1A; --panel-border: #2A3631; --panel-hover: #18211D; --panel-on: #1E2924; --device: #000000; --device-ring: rgba(255,255,255,.12);
    --shadow-lg: 0 30px 60px -20px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--stage); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; transition: background-color .25s; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-appearance: none; appearance: none; margin: 0; line-height: inherit; }
input, textarea { -webkit-appearance: none; appearance: none; border-radius: 0; }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
[role="button"] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- presenter stage (desktop) ---------- */
.stage { min-height: 100%; display: flex; gap: 56px; align-items: center; justify-content: center; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px)); }
.panel { width: 290px; display: grid; gap: 20px; align-content: start; max-height: calc(100vh - 56px); overflow-y: auto; scrollbar-width: thin; }
.panel-brand { display: flex; gap: 12px; align-items: center; }
.panel-brand strong { display: block; font-size: 22px; line-height: 1.1; }
.panel-brand small { font-size: 13px; color: var(--ink-2); }
.logo { width: 46px; height: 46px; border-radius: 14px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; flex: none; }
.logo svg { width: 26px; height: 26px; }
.panel-label { margin: 0 0 8px; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--panel-border); background: var(--panel-btn); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; transition: background-color .15s, border-color .15s; }
.seg button:hover { border-color: var(--brand-2); }
.seg button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.panel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.panel-list button { width: 100%; text-align: start; border: 0; background: none; padding: 7px 10px; border-radius: 9px; font-size: 13.5px; color: var(--ink-2); }
.panel-list button:hover { background: var(--panel-hover); }
.panel-list button[aria-current="true"] { background: var(--panel-on); color: var(--ink); font-weight: 500; }
.panel-note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.panel-reset { border: 1px solid var(--panel-border); background: transparent; border-radius: 12px; padding: 9px 12px; font-size: 13.5px; }
.panel-reset:hover { border-color: var(--brand-2); }

.device { padding: 12px; background: var(--device); border-radius: 58px; box-shadow: 0 34px 70px -24px rgba(8, 40, 30, .5), 0 0 0 1px var(--device-ring); flex: none; }
.phone { position: relative; width: 390px; height: 844px; border-radius: 46px; overflow: hidden; background: var(--canvas); display: flex; flex-direction: column; isolation: isolate; transition: background-color .25s; }
.statusbar { height: 46px; flex: none; display: flex; justify-content: space-between; align-items: center; padding: 0 30px; font-size: 15px; font-weight: 600; direction: ltr; background: var(--canvas); transition: background-color .25s; }
.sb-icons { display: flex; gap: 5px; }
.sb-icons i { width: 16px; height: 10px; border-radius: 3px; background: currentColor; opacity: .85; }
.sb-icons i:nth-child(3) { width: 24px; }
.screen { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
.screen::-webkit-scrollbar { display: none; }
.phone.dark-top .statusbar { background: var(--brand-dark); color: #FFFFFF; }

/* shot mode for automated screenshots */
body.shot { background: var(--canvas); }
body.shot .panel { display: none; }
body.shot .stage { padding: 0; display: block; }
body.shot .device { position: fixed; left: 0; top: 0; padding: 0; border-radius: 0; box-shadow: none; background: none; width: 390px; transform: none !important; margin: 0 !important; }
body.shot .phone { border-radius: 0; width: 390px !important; height: 844px !important; }
body.shot .statusbar { display: flex !important; }
body.shot .screen { padding-top: 0 !important; }

/* real phone: full screen app */
@media (max-width: 560px) {
  body { background: var(--canvas); }
  .stage { padding: 0; display: block; }
  .panel { display: none; }
  .device { padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .phone { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; }
  /* set from JS: the part of the screen not covered by the on-screen keyboard */
  html.vv .phone { height: var(--app-h); transform: translateY(var(--app-top, 0px)); }
  .statusbar { display: none; }
  .screen { padding-top: env(safe-area-inset-top, 0px); }
}
@media (max-height: 900px) and (min-width: 561px) {
  .device { transform: scale(.92); transform-origin: center; margin: -34px 0; }
}
