/* رصيدي — app stylesheet
   One token set, two themes. Motion: soft expo-out, nothing overshoots,
   enter ≤ 320ms, exit ≤ 200ms, frequent actions (tabs) ~180ms. */

@property --n { syntax: '<integer>'; inherits: false; initial-value: 0; }

/* ---------- tokens ---------- */
:root {
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --t-fast: 160ms; --t-enter: 320ms; --t-exit: 190ms;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);

  --bg: #F4F2EC; --bg2: #ECE9E1; --surface: #FFFFFF; --ink: #16171B; --ink2: #5B5F68; --ink3: #80848D;
  --line: rgba(22,23,27,.06); --line2: #E2DED5; --track: #EEEAE2; --field: #FFFFFF;
  --sh1: 0 1px 2px rgba(22,23,27,.04), 0 10px 26px -14px rgba(22,23,27,.16), inset 0 1px 0 rgba(255,255,255,.9);
  --sh2: 0 2px 6px rgba(22,23,27,.05), 0 22px 44px -18px rgba(22,23,27,.26), inset 0 1px 0 rgba(255,255,255,.9);
  --primary: #16171B; --on-primary: #FFFFFF; --accent: #0E8F6A; --accent-soft: #DFF4EA; --danger: #D64545;
  --glass: rgba(255,255,255,.66); --glass-line: rgba(255,255,255,.85);
  --bar: rgba(22,23,27,.92); --pill: #FFFFFF; --bar-ink: #9A9DA5; --bar-on: #16171B;
  --orb1: rgba(19,170,126,.30); --orb2: rgba(60,130,214,.20); --orb3: rgba(240,176,40,.20);
  --mint: #E2F5EC; --mint2: #CFEEDF; --mint-ink: #0B5B44;
  --peach: #FDEADB; --peach2: #FBDCC6; --peach-ink: #7A3610;
  --sky: #E5EFFB; --sky2: #D4E5F9; --sky-ink: #164A85;
  --butter: #FFF4CE; --butter2: #FEEAA9; --butter-ink: #6B4A00;
  --lilac: #EEE9FC; --lilac2: #E0D8F9; --lilac-ink: #45298F;
  --rose: #FCE6E6; --rose-ink: #B42828;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B0C0F; --bg2: #14161B; --surface: #15171C; --ink: #F2F1ED; --ink2: #A6AAB3; --ink3: #7C808A;
  --line: rgba(255,255,255,.06); --line2: #2A2D35; --track: #22252C; --field: #1A1D23;
  --sh1: inset 0 1px 0 rgba(255,255,255,.04), 0 14px 30px -16px rgba(0,0,0,.8);
  --sh2: inset 0 1px 0 rgba(255,255,255,.06), 0 24px 48px -18px rgba(0,0,0,.9);
  --primary: #F2F1ED; --on-primary: #0B0C0F; --accent: #3CC99C; --accent-soft: rgba(60,201,156,.16);
  --glass: rgba(21,23,28,.62); --glass-line: rgba(255,255,255,.08);
  --bar: rgba(30,33,40,.86); --pill: #F2F1ED; --bar-ink: #80848D; --bar-on: #0B0C0F;
  --orb1: rgba(40,200,150,.20); --orb2: rgba(70,130,230,.16); --orb3: rgba(230,170,40,.10);
  --mint: #0F241E; --mint2: #122D25; --mint-ink: #7EE2BF;
  --peach: #261A12; --peach2: #2F1F13; --peach-ink: #F6BB92;
  --sky: #0F1D33; --sky2: #14263F; --sky-ink: #98C4F6;
  --butter: #241D09; --butter2: #2D250B; --butter-ink: #F3D06E;
  --lilac: #1A1630; --lilac2: #221C3D; --lilac-ink: #BDAAF8;
  --rose: #2A1414; --rose-ink: #F4A6A6;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg2); color: var(--ink);
  font-family: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
button { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
svg { flex: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* theme switch fallback (no View Transitions) */
.theming, .theming * { transition: background-color .4s ease, color .4s ease, border-color .4s ease, box-shadow .4s ease, fill .4s ease, stroke .4s ease !important; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- shell ---------- */
.app {
  position: relative; width: 100%; height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto; overflow: hidden;
  background: var(--bg); isolation: isolate;
}
@media (min-width: 560px) {
  body { display: flex; align-items: center; justify-content: center; }
  .app { width: 430px; height: min(100dvh, 932px); border-radius: 40px; box-shadow: 0 40px 90px -40px rgba(0,0,0,.45); border: 1px solid var(--line); }
}
.stage { position: absolute; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); will-change: transform, opacity; }
.page {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; position: relative;
  padding: calc(18px + var(--safe-top)) 18px calc(32px + var(--safe-bottom)); overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.page::-webkit-scrollbar { display: none; }
.page > *, form > *, .fl { flex-shrink: 0; }
.page.tabbed { padding-bottom: calc(112px + var(--safe-bottom)); }
.page.auth { padding-inline: 20px; gap: 18px; }

/* ---------- screen transitions (router adds these) ---------- */
.in-fwd  { animation: inFwd var(--t-enter) var(--ease) both; }
.in-back { animation: inBack var(--t-enter) var(--ease) both; }
.in-tab  { animation: inTab 220ms var(--ease) both; }
.in-zoom { animation: inZoom 520ms var(--ease) both; }
.in-none { animation: none; }
.out-fwd  { animation: outFwd var(--t-exit) var(--ease-in) both; pointer-events: none; }
.out-back { animation: outBack var(--t-exit) var(--ease-in) both; pointer-events: none; }
.out-tab  { animation: outTab 140ms var(--ease-in) both; pointer-events: none; }
.out-zoom { animation: outZoom 260ms var(--ease-in) both; pointer-events: none; }
@keyframes inFwd  { from { opacity: 0; transform: translateX(calc(-40px * var(--dir))); } }
@keyframes inBack { from { opacity: 0; transform: translateX(calc(40px * var(--dir))); } }
@keyframes inTab  { from { opacity: 0; transform: translateY(6px); } }
@keyframes inZoom { from { opacity: 0; transform: scale(1.05); } }
@keyframes outFwd  { to { opacity: 0; transform: translateX(calc(28px * var(--dir))); } }
@keyframes outBack { to { opacity: 0; transform: translateX(calc(-28px * var(--dir))); } }
@keyframes outTab  { to { opacity: 0; } }
@keyframes outZoom { to { opacity: 0; transform: scale(.96); } }

/* first-visit choreography only: one orchestrated entrance, not on every tab switch */
.first .st > * { animation: rise .55s var(--ease) backwards; }
.first .st > *:nth-child(2) { animation-delay: 40ms; } .first .st > *:nth-child(3) { animation-delay: 80ms; }
.first .st > *:nth-child(4) { animation-delay: 120ms; } .first .st > *:nth-child(5) { animation-delay: 160ms; }
.first .st > *:nth-child(n+6) { animation-delay: 200ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- type ---------- */
.hdr { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 2px; }
.grp { display: flex; align-items: center; gap: 12px; }
.eyebrow { display: block; margin: 0; font-size: 13.5px; color: var(--ink2); }
.title { display: block; margin: 0; font-size: 23px; font-weight: 700; line-height: 1.3; }
.big { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.3; }
.sub { margin: 0; font-size: 15px; color: var(--ink2); line-height: 1.75; }
.cap { font-size: 12.5px; color: var(--ink2); }
.sec { display: flex; align-items: center; justify-content: space-between; margin: 6px 4px -2px; font-size: 14px; font-weight: 600; color: var(--ink2); }
.num { font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.soft { opacity: .8; }
.accent { color: var(--accent); font-weight: 700; }

/* ---------- surfaces ---------- */
.card {
  position: relative; border-radius: 26px; padding: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh1);
  transition: transform .3s var(--ease), box-shadow .3s ease;
}
button.card { width: 100%; text-align: right; cursor: pointer; }
@media (hover: hover) { .lift:hover { transform: translateY(-2px); box-shadow: var(--sh2); } }
.lift:active { transform: scale(.98); transition-duration: 100ms; }
.t-mint   { background: linear-gradient(155deg, var(--mint), var(--mint2)); color: var(--mint-ink); border-color: transparent; }
.t-peach  { background: linear-gradient(155deg, var(--peach), var(--peach2)); color: var(--peach-ink); border-color: transparent; }
.t-sky    { background: linear-gradient(155deg, var(--sky), var(--sky2)); color: var(--sky-ink); border-color: transparent; }
.t-butter { background: linear-gradient(155deg, var(--butter), var(--butter2)); color: var(--butter-ink); border-color: transparent; }
.t-lilac  { background: linear-gradient(155deg, var(--lilac), var(--lilac2)); color: var(--lilac-ink); border-color: transparent; }
.t-rose   { background: var(--rose); color: var(--rose-ink); border-color: transparent; }
.tile {
  width: 46px; height: 46px; flex: none; border-radius: 16px; background: var(--surface); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px -10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6);
}
:root[data-theme="dark"] .tile { background: rgba(255,255,255,.07); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.tile.t-mint { background: var(--mint2); } .tile.t-peach { background: var(--peach2); } .tile.t-sky { background: var(--sky2); }
.tile.t-butter { background: var(--butter2); } .tile.t-lilac { background: var(--lilac2); } .tile.t-rose { background: var(--rose); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 16px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.glass { background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); border: 1px solid var(--glass-line); box-shadow: var(--sh2); }
.track { position: relative; height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.track > i { position: absolute; top: 0; bottom: 0; right: 0; border-radius: inherit; }
.sep { height: 1px; background: var(--line); margin: 0 18px; }
.sheen { overflow: hidden; }
.sheen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.24) 48%, rgba(255,255,255,.05) 56%, transparent 70%);
  transform: translateX(-130%); animation: sheen 1.6s var(--ease) .5s 1 both;
}
@keyframes sheen { to { transform: translateX(130%); } }

/* ---------- balance card ---------- */
.bal {
  position: relative; overflow: hidden; border-radius: 32px; padding: 20px 20px 18px; color: #FFFFFF;
  background: radial-gradient(120% 90% at 100% 0%, #1CC08F 0%, rgba(28,192,143,0) 55%), linear-gradient(150deg, #12A67C 0%, #0E8F6A 45%, #09644A 100%);
  box-shadow: 0 30px 50px -28px rgba(10,110,80,.95), inset 0 1px 0 rgba(255,255,255,.3);
}
:root[data-theme="dark"] .bal {
  background: radial-gradient(120% 90% at 100% 0%, #14A57B 0%, rgba(20,165,123,0) 55%), linear-gradient(150deg, #0F8664 0%, #0A6248 50%, #063A2B 100%);
  box-shadow: 0 30px 60px -30px rgba(20,200,150,.45), inset 0 1px 0 rgba(255,255,255,.14);
}
.bal.crit {
  background: radial-gradient(120% 90% at 100% 0%, #F06B6B 0%, rgba(240,107,107,0) 55%), linear-gradient(150deg, #D84141 0%, #B42828 48%, #741515 100%);
  box-shadow: 0 30px 50px -26px rgba(180,40,40,.95), inset 0 1px 0 rgba(255,255,255,.3);
}
:root[data-theme="dark"] .bal.crit {
  background: radial-gradient(120% 90% at 100% 0%, #D85454 0%, rgba(216,84,84,0) 55%), linear-gradient(150deg, #B83434 0%, #8E1F1F 50%, #4F1010 100%);
  box-shadow: 0 30px 60px -30px rgba(220,70,70,.5), inset 0 1px 0 rgba(255,255,255,.14);
}
.bal .deco { position: absolute; left: -70px; top: -70px; width: 200px; height: 200px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 0 0 30px rgba(255,255,255,.035), 0 0 0 62px rgba(255,255,255,.025); pointer-events: none; }
.bal > :not(.deco) { position: relative; }
.inset { padding: 14px 14px 12px; border-radius: 20px; background: rgba(0,0,0,.13); border: 1px solid rgba(255,255,255,.1); }
.glassbtn {
  height: 42px; padding: 0 16px; border-radius: 21px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.16); color: #FFFFFF;
  font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .15s var(--ease), background-color .2s ease;
}
.glassbtn:active { transform: scale(.96); }
.glassbtn.solid { background: #FFFFFF; color: #0B5B44; border-color: #FFFFFF; }
.bal.crit .glassbtn.solid { color: #9C1F1F; }
.pillbtn { height: 40px; padding: 0 16px; border-radius: 20px; border: 0; background: var(--primary); color: var(--on-primary); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: transform .15s var(--ease); }
.pillbtn:active { transform: scale(.96); }
.ring { animation: ring 1.1s var(--ease) .15s backwards; }
.ringk { transform-box: view-box; transform-origin: 100px 100px; animation: knob 1.1s var(--ease) .15s backwards; }
@keyframes ring { from { stroke-dashoffset: 565; } }
@keyframes knob { from { transform: rotate(0deg); } }
.tl { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); }
.tl .fill { position: absolute; inset: 0; border-radius: 3px; background: rgba(255,255,255,.55); transform-origin: right; animation: growx 1.2s var(--ease) .3s backwards; }
.tl .band { position: absolute; top: -5px; bottom: -5px; border-radius: 8px; background: rgba(255,255,255,.2); border: 1px dashed rgba(255,255,255,.6); animation: fade .4s ease 1.2s backwards; }
.tl .run { position: absolute; inset: 0; animation: run 1.2s var(--ease) .3s backwards; }
.tl .dot { position: absolute; right: -7px; top: -4px; width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 0 0 5px rgba(255,255,255,.25); }
.days6 { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11px; opacity: .82; }
@keyframes run { from { transform: translateX(0); } }

/* count-up (CSS only, integer) */
.count { counter-reset: n var(--n); animation: count 1s var(--ease) .1s both; }
.count::after { content: counter(n); }
@keyframes count { from { --n: 0; } to { --n: var(--to); } }

/* ---------- buttons ---------- */
.btn {
  position: relative; overflow: hidden; width: 100%; height: 56px; border: 0; border-radius: 20px; background: var(--primary); color: var(--on-primary);
  font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; align-self: center; flex: none;
  box-shadow: 0 14px 26px -16px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.14);
  transition: transform .15s var(--ease), width .4s var(--ease), border-radius .4s var(--ease), background-color .25s ease;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line2); box-shadow: var(--sh1); font-weight: 500; }
.btn.danger { background: #C83434; color: #FFFFFF; }
.btn.soft-danger { background: var(--rose); color: var(--rose-ink); box-shadow: none; }
.btn.go { background: linear-gradient(150deg, #14A57B, #0B7A5A); color: #FFFFFF; box-shadow: 0 16px 28px -16px rgba(14,143,106,.9), inset 0 1px 0 rgba(255,255,255,.25); }
.btn[data-state="loading"], .btn[data-state="done"] { width: 56px; border-radius: 28px; pointer-events: none; }
.btn[data-state="done"] { background: var(--accent); color: #FFFFFF; }
.btn .lbl { transition: opacity .15s ease; }
.btn[data-state="loading"] .lbl, .btn[data-state="done"] .lbl { display: none; }
.btn .spin, .btn .ok { display: none; }
.btn[data-state="loading"] .spin { display: block; animation: spin .8s linear infinite; }
.btn[data-state="done"] .ok { display: block; animation: pop .35s var(--ease) both; }
.ibtn {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--sh1); transition: transform .15s var(--ease);
}
.ibtn:active { transform: scale(.92); }
.link { height: 40px; padding: 0; background: none; border: 0; color: var(--accent); font-size: 14.5px; font-weight: 600; cursor: pointer; }

/* ---------- fields ---------- */
.fl { position: relative; display: block; }
.fl input, .fl select {
  width: 100%; height: 60px; border-radius: 18px; border: 1.5px solid var(--line2); background: var(--field); color: var(--ink);
  padding: 22px 50px 6px 52px; font-size: 16px; outline: none; caret-color: var(--accent); -webkit-appearance: none; appearance: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.fl .lab { position: absolute; right: 50px; top: 20px; font-size: 15px; color: var(--ink3); pointer-events: none; transform-origin: right top; transition: transform .22s var(--ease), color .2s ease; }
.fl input:focus ~ .lab, .fl input:not(:placeholder-shown) ~ .lab, .fl select ~ .lab { transform: translateY(-11px) scale(.76); color: var(--ink2); }
.fl input:focus ~ .lab { color: var(--accent); }
.fl .ico { position: absolute; right: 16px; top: 19px; width: 22px; height: 22px; color: var(--ink3); pointer-events: none; transition: color .2s ease; }
.fl input:focus ~ .ico { color: var(--accent); }
.fl input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.fl .end { position: absolute; left: 8px; top: 8px; width: 44px; height: 44px; border: 0; background: none; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--ink3); cursor: pointer; }
.fl .okmark { position: absolute; left: 16px; top: 19px; color: var(--accent); opacity: 0; transform: scale(.6); transition: opacity .2s ease, transform .25s var(--ease); pointer-events: none; }
.fl[data-valid="true"] .okmark { opacity: 1; transform: none; }
.fl.ltr input { direction: ltr; text-align: right; }
.fl[data-err="true"] input { border-color: var(--danger); box-shadow: 0 0 0 4px var(--rose); }
.fl[data-err="true"] { animation: shake .4s cubic-bezier(.36,.07,.19,.97); }
.fl[data-err="true"] .ico, .fl[data-err="true"] .lab { color: var(--danger); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.errmsg { display: flex; align-items: center; gap: 6px; margin: -4px 6px 0; font-size: 13px; color: var(--danger); animation: fadeUp .25s ease both; }
.errmsg:empty { display: none; }
.strength { display: flex; align-items: center; gap: 10px; }
.strength .sbars { flex: 1; display: flex; gap: 5px; }
.strength .sbars i { flex: 1; height: 5px; border-radius: 3px; background: var(--track); transition: background-color .3s ease; }
.strength[data-l="1"] .sbars i:nth-child(-n+1) { background: var(--danger); }
.strength[data-l="2"] .sbars i:nth-child(-n+2) { background: #E0A400; }
.strength[data-l="3"] .sbars i { background: var(--accent); }

/* segmented control, driven by --i */
.seg { position: relative; display: flex; padding: 4px; border-radius: 18px; background: var(--bg2); border: 1px solid var(--line); }
.seg .thumb { position: absolute; top: 4px; bottom: 4px; right: 4px; width: calc((100% - 8px) / var(--n-items, 3)); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 12px -6px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.6); transform: translateX(calc(var(--i, 0) * -100%)); transition: transform .3s var(--ease); }
:root[data-theme="dark"] .seg .thumb { background: #2A2E36; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.seg button { position: relative; flex: 1; height: 40px; border: 0; background: none; border-radius: 14px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink3); transition: color .2s ease; }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { color: var(--ink); font-weight: 600; }

/* switch: RTL, on = knob to the left */
.switch { width: 52px; height: 32px; flex: none; border-radius: 16px; border: 0; position: relative; cursor: pointer; background: var(--line2); transition: background-color .25s ease; }
.switch > span { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .3s var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] > span { transform: translateX(-20px); }
.switch.red[aria-checked="true"] { background: var(--danger); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.row .tile { width: 40px; height: 40px; border-radius: 13px; }

/* ---------- ambient ---------- */
.aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.aurora span { position: absolute; width: 440px; height: 440px; border-radius: 50%; background: radial-gradient(circle, var(--orb1), transparent 64%); animation: drift 16s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { top: -190px; right: -150px; }
.aurora span:nth-child(2) { top: 230px; left: -230px; background: radial-gradient(circle, var(--orb2), transparent 64%); animation-duration: 20s; animation-delay: -7s; }
.aurora span:nth-child(3) { bottom: -230px; right: -60px; background: radial-gradient(circle, var(--orb3), transparent 64%); animation-duration: 18s; animation-delay: -3s; }
@keyframes drift { to { transform: translate3d(-60px, 50px, 0) scale(1.15); } }
.logo { position: relative; overflow: hidden; border-radius: 30%; background: linear-gradient(150deg, #1BBF8E, #0E8F6A 55%, #09644A); display: flex; align-items: center; justify-content: center; box-shadow: 0 22px 40px -18px rgba(14,143,106,.85), inset 0 1px 0 rgba(255,255,255,.4); }

/* splash */
.splash { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; overflow: hidden; }
.glowbg { position: absolute; width: 560px; height: 560px; border-radius: 50%; background: radial-gradient(circle, rgba(14,143,106,.32), transparent 60%); animation: glowIn 1.4s var(--ease) both; pointer-events: none; }
.ripple { position: absolute; width: 116px; height: 116px; border-radius: 36px; border: 2px solid #0E8F6A; animation: ripple 2.2s var(--ease) .8s infinite; pointer-events: none; }
.logoIn { animation: logoIn .8s var(--ease) .1s backwards; }
.draw { stroke-dasharray: 80; animation: draw 1s cubic-bezier(.6,0,.2,1) .3s backwards; }
.nameIn { animation: reveal .8s var(--ease) .8s backwards; }
.tagIn { animation: fadeUp .6s ease 1.2s backwards; }
@keyframes glowIn { from { opacity: 0; transform: scale(.3); } }
@keyframes ripple { from { opacity: .5; transform: scale(1); } to { opacity: 0; transform: scale(2.6); } }
@keyframes logoIn { from { opacity: 0; transform: scale(.8); } }
@keyframes draw { from { stroke-dashoffset: 80; } }
@keyframes reveal { from { opacity: 0; clip-path: inset(0 0 0 100%); transform: translateY(8px); } to { clip-path: inset(0 0 0 0); } }

/* onboarding */
.ob-track { position: relative; flex: 1; display: flex; flex-direction: column; touch-action: pan-y; }
.ob-slide { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; text-align: center; }
.ob-slide.in-fwd { animation: obIn .45s var(--ease) both; } .ob-slide.in-back { animation: obInBack .45s var(--ease) both; }
@keyframes obIn { from { opacity: 0; transform: translateX(calc(-44px * var(--dir))); } } @keyframes obInBack { from { opacity: 0; transform: translateX(calc(44px * var(--dir))); } }
.ob-stage { position: relative; width: 292px; height: 290px; display: flex; align-items: center; justify-content: center; }
.ob-halo { position: absolute; inset: 6px; border-radius: 50%; pointer-events: none; }
.ob-chip { position: absolute; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 19px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: var(--sh2); border: 1px solid var(--line); animation: fadeUp .5s var(--ease) .45s backwards; }
.ob-bell { position: absolute; top: 0; right: calc(50% - 26px); width: 52px; height: 52px; border-radius: 18px; background: linear-gradient(150deg, #F2B52E, #D99500); display: flex; align-items: center; justify-content: center; box-shadow: 0 16px 30px -14px rgba(217,149,0,.9), inset 0 1px 0 rgba(255,255,255,.35); z-index: 2; }
.ob-badge { position: absolute; top: -6px; left: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #E5484D; color: #FFFFFF; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--bg); }
.words > span { display: inline-block; animation: fadeUp .5s var(--ease) backwards; }
.words > span:nth-child(1) { animation-delay: .12s; } .words > span:nth-child(2) { animation-delay: .17s; } .words > span:nth-child(3) { animation-delay: .22s; } .words > span:nth-child(4) { animation-delay: .27s; }
.lede { animation: fadeUp .5s var(--ease) .32s backwards; }
.notif { animation: notifIn .5s var(--ease) backwards; }
@keyframes notifIn { from { opacity: 0; transform: translateY(-14px); } }
.ringLoop { animation: ringLoop 6s ease-in-out 1s infinite alternate; }
@keyframes ringLoop { from { stroke-dashoffset: 150; } to { stroke-dashoffset: 330; } }
.thermo { transform-origin: bottom; animation: thermo 4s ease-in-out .6s infinite alternate; }
@keyframes thermo { from { transform: scaleY(.4); } }
.obNext {
  position: relative; height: 64px; width: 64px; border: 0; border-radius: 32px; background: var(--primary); color: var(--on-primary); flex: none;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 14px 26px -16px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.14); transition: width .4s var(--ease), transform .15s var(--ease);
}
.obNext:active { transform: scale(.96); }
.obNext[data-last="true"] { width: 168px; }
.obNext .obRing { position: absolute; top: -4px; right: -4px; transform: rotate(-90deg); pointer-events: none; transition: opacity .2s ease; }
.obNext[data-last="true"] .obRing, .obNext[data-last="true"] .arrow { display: none; }
.obNext .lastlbl { display: none; white-space: nowrap; align-items: center; gap: 8px; }
.obNext[data-last="true"] .lastlbl { display: flex; animation: fade .3s ease .1s backwards; }
.obRing circle.p { transition: stroke-dashoffset .45s var(--ease); }
.dots { display: flex; gap: 6px; }
.dots button { height: 24px; width: 10px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; align-items: center; transition: width .35s var(--ease); }
.dots button i { height: 8px; width: 100%; border-radius: 4px; background: var(--line2); transition: background-color .25s ease; }
.dots button[aria-current="step"] { width: 28px; } .dots button[aria-current="step"] i { background: var(--ink); }

/* ---------- charts ---------- */
.bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; height: 168px; }
.bcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; background: none; border: 0; padding: 0; cursor: pointer; transition: opacity .2s ease; }
.bcol[aria-pressed="false"] { opacity: .5; }
.bwrap { position: relative; width: 100%; flex: 1; display: flex; align-items: flex-end; }
.bstack { position: relative; width: 100%; border-radius: 14px; }
.bfill { position: absolute; inset: 0; border-radius: 14px; transform-origin: bottom; animation: grow .7s var(--ease) backwards; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.bghost { position: absolute; right: 0; left: 0; bottom: 0; border-radius: 14px; border: 1.5px dashed var(--ink3); opacity: .45; animation: fade .4s ease .5s backwards; }
.bar { transform-origin: bottom; animation: grow .7s var(--ease) backwards; }
.hbar { transform-origin: right; animation: growx .8s var(--ease) backwards; }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes growx { from { transform: scaleX(0); } }
.expand { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.expand[data-open="true"] { grid-template-rows: 1fr; }
.expand > div { overflow: hidden; min-height: 0; }
.udot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: #E5484D; transition: opacity .3s ease, transform .3s var(--ease); }
.udot[data-read="true"] { opacity: 0; transform: scale(0); }
.rays { transform-box: view-box; transform-origin: 12px 12px; animation: spin 30s linear infinite; }

/* ---------- tab bar / sheet / toast ---------- */
.tabbar {
  position: absolute; bottom: calc(14px + var(--safe-bottom)); right: 16px; left: 16px; height: 70px; border-radius: 28px; background: var(--bar); padding: 7px; z-index: 5;
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: 0 24px 40px -18px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.06);
  transition: transform .3s var(--ease), opacity .2s ease;
}
.tabbar[hidden] { display: block; transform: translateY(120%); opacity: 0; pointer-events: none; }
.tabbar .pill { position: absolute; top: 7px; right: 7px; width: calc((100% - 14px) / 4); height: 56px; border-radius: 21px; background: var(--pill); box-shadow: 0 6px 16px -6px rgba(0,0,0,.4); transform: translateX(calc(var(--i, 0) * -100%)); transition: transform .3s var(--ease); }
.tabbar .tabs { position: relative; display: flex; height: 100%; }
.tab { position: relative; flex: 1; border: 0; border-radius: 20px; background: transparent; color: var(--bar-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; font-size: 11.5px; font-weight: 500; transition: color .2s ease; }
.tab[aria-current="page"] { color: var(--bar-on); }
.tab .badge { position: absolute; top: 9px; left: calc(50% - 15px); width: 8px; height: 8px; border-radius: 50%; background: #E5484D; box-shadow: 0 0 0 2px var(--bar); }
.tab .badge[hidden] { display: none; }
.scrim { position: absolute; inset: 0; z-index: 20; background: rgba(10,11,14,.5); display: flex; align-items: flex-end; animation: fade .25s ease both; }
.scrim.closing { animation: fadeOut .2s ease both; }
.sheet { position: relative; width: 100%; background: var(--surface); border-radius: 32px 32px 0 0; padding: 12px 24px calc(28px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: 0 -20px 40px -20px rgba(0,0,0,.4); animation: sheetIn .38s var(--ease) both; touch-action: none; }
.scrim.closing .sheet { animation: sheetOut .2s var(--ease-in) both; }
.toast { position: absolute; top: calc(14px + var(--safe-top)); right: 16px; left: 16px; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--primary); color: var(--on-primary); font-size: 14.5px; font-weight: 500; box-shadow: 0 20px 40px -16px rgba(0,0,0,.6); animation: toastIn .35s var(--ease) both; }
.toast.leaving { animation: toastOut .2s var(--ease-in) both; }
@keyframes sheetIn { from { transform: translateY(100%); } } @keyframes sheetOut { to { transform: translateY(100%); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-24px); } } @keyframes toastOut { to { opacity: 0; transform: translateY(-16px); } }

/* ---------- misc keyframes ---------- */
@keyframes fade { from { opacity: 0; } } @keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { opacity: 0; transform: scale(.8); } }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 2.4s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .35; } }
.pop { animation: pop .35s var(--ease) backwards; }
.skeleton { background: linear-gradient(90deg, var(--track), var(--bg2), var(--track)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- link meter ---------- */
.radar { position: relative; width: 150px; height: 150px; margin: 8px auto; display: flex; align-items: center; justify-content: center; }
.radar span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: radar 2s var(--ease) infinite; }
.radar span:nth-child(2) { animation-delay: .66s; } .radar span:nth-child(3) { animation-delay: 1.33s; }
@keyframes radar { from { opacity: .6; transform: scale(.35); } to { opacity: 0; transform: scale(1); } }
.option { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; border: 1.5px solid var(--line2); background: var(--surface); cursor: pointer; text-align: right; width: 100%; transition: border-color .2s ease, background-color .2s ease, transform .15s var(--ease); }
.option:active { transform: scale(.98); }
.option[aria-checked="true"] { border-color: var(--accent); background: var(--mint); }
.radio { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; transition: background-color .2s ease, border-color .2s ease; }
.radio svg { opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .2s var(--ease); }
[aria-checked="true"] > .radio { background: var(--accent); border-color: var(--accent); }
[aria-checked="true"] > .radio svg { opacity: 1; transform: none; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ---------- English: left-to-right mirror of the Arabic layout ---------- */
:root { --dir: 1; }
[dir="ltr"] { --dir: -1; }
[dir="ltr"] .flipx { transform: scaleX(-1); }
[dir="ltr"] button.card, [dir="ltr"] .option { text-align: left; }
[dir="ltr"] .track > i { right: auto; left: 0; }
[dir="ltr"] .tl .fill, [dir="ltr"] .hbar { transform-origin: left; }
[dir="ltr"] .tl .dot { right: auto; left: -7px; }
[dir="ltr"] .fl .lab { right: auto; left: 50px; transform-origin: left top; }
[dir="ltr"] .fl .ico { right: auto; left: 16px; }
[dir="ltr"] .fl .end { left: auto; right: 8px; }
[dir="ltr"] .fl .okmark { left: auto; right: 16px; }
[dir="ltr"] .fl.ltr input { text-align: left; }
[dir="ltr"] .seg .thumb { right: auto; left: 4px; transform: translateX(calc(var(--i, 0) * 100%)); }
[dir="ltr"] .switch > span { right: auto; left: 3px; }
[dir="ltr"] .switch[aria-checked="true"] > span { transform: translateX(20px); }
[dir="ltr"] .tabbar .pill { right: auto; left: 7px; transform: translateX(calc(var(--i, 0) * 100%)); }
[dir="ltr"] .ob-bell { right: auto; left: calc(50% - 26px); }
[dir="ltr"] .ob-badge { left: auto; right: -6px; }
[dir="ltr"] .obNext .obRing { right: auto; left: -4px; }
[dir="ltr"] .bal .deco { left: auto; right: -70px; }
[dir="ltr"] .tab .badge { left: auto; right: calc(50% - 15px); }
[dir="ltr"] .fl input, [dir="ltr"] .fl select { padding: 22px 52px 6px 50px; }

/* silent live refresh: draw the final state at once, keep only the live pulse */
.quiet *:not(.pulse) { animation: none !important; transition: none !important; }
.quiet .count { --n: var(--to); }
