/* ============================================================
   مصاريفي — «عدّاد الرحلة»  ·  v3.0.0
   داكن فحميّ + كهرماني للمال فقط + أرقام جدولية (tabular-nums)
   ملف واحد · طبقة توكنات واحدة · بلا تدرجات زخرفية · بلا M3
   ------------------------------------------------------------
   عقد الوسم (يجب أن يطابقه index.html حرفياً):
   [الشريط]    .appbar > .icon-btn + .title(b+.sub) + .acts(.sync-state + .icon-btn)
   [الحاوية]   main.wrap > section.screen#viewTrips | section.screen#viewTrip
   [الرحلات]   .trip-card > .trip-mark + .trip-main(.trip-name+.trip-meta)
               + .trip-total(.num + .cur)
   [الملخص]    .summary#summaryCard > .label + .hero(.hero-amount.num + .hero-cur)
               + .alts > .alt(.sym+.v.num+.k) + .per
   [المرشح]    .filters > .search(.mi + input#expSearch + .clear)
               + .chip-scroll > .chip(.on)
   [الأيام]    .day-head > .d + .t.num
   [صف مصروف]  .exp-row > .mark + .main(.cat-name+.sub)
               + .amount(.num + .orig.num) + .state
   [شريط سفلي] .actionbar#actionBar > .btn.primary#btnAddExp + .btn.ghost#btnSplit
   [زر عائم]   button.fab#fabAdd  (شاشة الرحلات فقط)
   [الأوراق]   .scrim.modal > .sheet(.center) > .grab + .sheet-head(.sheet-title+.icon-btn.close)
               + .sheet-body + .sheet-foot
   [المبلغ]    .amount-hero > .seg > .seg-opt.on(.s+.code)
               + .amount-input(input#expAmount) + .conv + .rate-line(.badge) + .keypad(.open)
   [الصرف]     .fx-list > .fx-row(.fx-id + .inline-field(.pre+input+.post))
   [تفاصيل]    .more(.open) > .more-head + .more-body
   [الأعضاء]   .member-row > .mi.avatar + .name + .share.num + .del
   [القائمة]   .menu > .menu-item(.danger)
   [تنبيهات]   .toasts > .toast(.success|error|warn) > span + .undo
   [الحوار]    .dialog > .dlg-head + p + .dialog-note + .actions
   [البوابة]   .gate > .gate-brand + h1 + .gate-sub + .pin-row > .pin-box(.filled)
               + .pin-error + .gate-foot
   [مفيد]      .num .mi .badge(.manual|.live) .row-between .grid-2 .label-sm
               .muted .small .sr-only .vhidden .empty
   ============================================================ */

/* ===================== 1) التوكنات ===================== */
:root{
  /* الأسطح — فحميّ عميق */
  --bg:#0a0b0d;
  --surface:#131519;
  --surface-2:#191c21;
  --surface-3:#20242a;
  --line:#2a2f36;
  --line-soft:#22262c;

  /* النصوص */
  --ink:#f3f4f6;
  --ink-soft:#a6adb6;
  --muted:#6f767f;

  /* الكهرماني — للمال والإجراء الأساسي فقط */
  --accent:#f5a524;
  --accent-hi:#ffc15e;
  --accent-soft:rgba(245,165,36,.14);
  --accent-line:rgba(245,165,36,.34);
  --on-accent:#1a1206;

  /* الدلالات */
  --ok:#4ed08b;   --ok-soft:rgba(78,208,139,.14);
  --warn:#f5c26b; --warn-soft:rgba(245,194,107,.14);
  --bad:#ff6b6b;  --bad-soft:rgba(255,107,107,.14);

  /* الأبعاد */
  --r-chip:999px; --r-btn:14px; --r-input:14px; --r-card:18px; --r-sheet:24px;
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px; --sp-8:32px;

  /* الظل */
  --sh-1:0 1px 2px rgba(0,0,0,.5);
  --sh-2:0 12px 34px rgba(0,0,0,.55);

  /* الأمان على الهواتف */
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
  --bar-h:56px;

  /* الخطوط */
  --font:"SF Arabic","Geeza Pro","Noto Sans Arabic","Noto Kufi Arabic","Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  --font-display:var(--font);

  color-scheme:dark;
}

/* ===================== 2) الأساسيات ===================== */
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
html{color-scheme:dark}
html,body{margin:0; padding:0}
body{
  font-family:var(--font); background:var(--bg); color:var(--ink);
  min-height:100dvh; font-size:16px; line-height:1.5;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
body.locked{overflow:hidden; overscroll-behavior:none}
button{font:inherit; color:inherit; background:none; border:0; cursor:pointer}
input,textarea,select{font:inherit; font-size:16px; color:var(--ink)}
img{max-width:100%; display:block}
[hidden]{display:none !important}
.vhidden{visibility:hidden !important; pointer-events:none !important}

/* الأرقام: LTR + جدولية دائماً */
.num{
  font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1,"lnum" 1;
  direction:ltr; unicode-bidi:isolate; letter-spacing:-.01em;
}

/* حلقة التركيز — إلزامية لإمكانية الوصول */
:focus-visible{outline:2px solid var(--accent); outline-offset:2px; border-radius:6px}

/* الأيقونات */
.mi{
  width:1.25em; height:1.25em; display:inline-block; flex:none;
  fill:currentColor; vertical-align:-.22em;
}
[data-icon]{display:inline-flex; align-items:center; justify-content:center}
.icon-btn{
  width:44px; height:44px; min-width:44px; border-radius:12px;
  display:inline-flex; align-items:center; justify-content:center;
  color:var(--ink-soft);
  transition:transform .12s ease, background .12s ease, color .12s ease;
}
.icon-btn .mi{width:24px; height:24px}
.icon-btn:active{transform:scale(.92); background:var(--surface-3); color:var(--ink)}
.icon-btn.busy{opacity:.5; pointer-events:none}
.icon-btn.close{margin-inline-start:auto}

/* ===================== 3) الشريط العلوي (شريط واحد) ===================== */
.appbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:var(--sp-2);
  min-height:calc(var(--bar-h) + var(--safe-top));
  padding:calc(var(--sp-1) + var(--safe-top)) var(--sp-3) var(--sp-1);
  background:rgba(19,21,25,.9);
  border-bottom:1px solid var(--line-soft);
}
@supports (backdrop-filter:blur(1px)){
  .appbar{backdrop-filter:blur(14px) saturate(1.2)}
}
.appbar .title{flex:1; min-width:0; display:flex; flex-direction:column; justify-content:center}
.appbar .title b{
  font-family:var(--font-display); font-size:17px; font-weight:800; letter-spacing:-.01em;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.appbar .title .sub{
  font-size:11.5px; color:var(--muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.appbar .acts{display:flex; align-items:center; gap:var(--sp-1)}

/* حالة المزامنة — مصغّر واحد هادئ */
.sync-state{
  display:inline-flex; align-items:center; gap:6px;
  height:30px; padding:0 10px; border-radius:var(--r-chip);
  background:var(--surface-2); border:1px solid var(--line);
  font-size:11.5px; font-weight:700; color:var(--ink-soft); white-space:nowrap;
}
.sync-state .dot{width:8px; height:8px; border-radius:50%; background:var(--muted); flex:none}
.sync-state .dot.ok{background:var(--ok)}
.sync-state .dot.pending{background:var(--warn); animation:pulse 1.6s ease-in-out infinite}
.sync-state .dot.off{background:var(--bad)}
.sync-state.ok{color:var(--ok); border-color:rgba(78,208,139,.28); background:var(--ok-soft)}
.sync-state.pending{color:var(--warn); border-color:rgba(245,194,107,.28); background:var(--warn-soft)}
.sync-state.off{color:var(--bad); border-color:rgba(255,107,107,.28); background:var(--bad-soft)}
@keyframes pulse{50%{opacity:.35}}

/* ===================== 4) الحاوية والشاشات ===================== */
main.wrap{
  width:100%; max-width:620px; margin:0 auto;
  padding:var(--sp-3) 0 calc(112px + var(--safe-bottom));
}
.screen{padding:0 var(--sp-3)}
.screen > * + *{margin-top:var(--sp-3)}
.list{display:flex; flex-direction:column; gap:var(--sp-2)}

/* ===================== 5) بطاقة الرحلة ===================== */
.trip-card{
  display:flex; align-items:center; gap:var(--sp-3);
  width:100%; text-align:start;
  background:var(--surface); border:1px solid var(--line-soft);
  border-radius:var(--r-card); padding:var(--sp-3) var(--sp-4);
  transition:transform .12s ease, border-color .12s ease, background .12s ease;
}
.trip-card:active{transform:scale(.985); background:var(--surface-2)}
.trip-card:hover{border-color:var(--line)}
.trip-mark{
  width:46px; height:46px; flex:none; border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  background:var(--surface-3); color:var(--ink-soft);
}
.trip-mark .mi{width:24px; height:24px}
.trip-main{flex:1; min-width:0}
.trip-name{
  font-size:16px; font-weight:800; letter-spacing:-.01em;
  display:flex; align-items:center; gap:6px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.trip-meta{display:block; font-size:12px; color:var(--muted); margin-top:2px}
.trip-meta .mix{color:var(--ink-soft); font-weight:700}
.trip-total{display:flex; flex-direction:column; align-items:flex-end; gap:1px}
.trip-total .num{font-size:17px; font-weight:800; color:var(--accent)}
.trip-total .cur{font-size:10.5px; color:var(--muted); font-weight:700}

/* ===================== 6) ملخص الرحلة (عدّاد متعدد العملات) ===================== */
.summary{
  position:relative; overflow:hidden;
  background:var(--surface); border:1px solid var(--line-soft);
  border-radius:var(--r-card); padding:var(--sp-4) var(--sp-4) var(--sp-5);
  text-align:center;
}
.summary .label{font-size:11.5px; font-weight:700; color:var(--muted); letter-spacing:.06em}
.summary .hero{display:flex; align-items:baseline; justify-content:center; gap:6px; margin-top:2px}
.summary .hero-amount{font-size:36px; font-weight:800; color:var(--accent); line-height:1.15}
.summary .hero-cur{font-size:13px; font-weight:700; color:var(--ink-soft)}
.summary .alts{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(94px,1fr));
  gap:var(--sp-2); margin-top:var(--sp-3);
}
.summary .alt{
  min-width:0; padding:var(--sp-3) var(--sp-2);
  background:var(--surface-2); border:1px solid var(--line-soft); border-radius:var(--r-btn);
  display:flex; flex-direction:column; align-items:center; gap:1px;
}
.summary .alt .sym{font-size:11.5px; font-weight:800; color:var(--muted)}
.summary .alt .v{font-size:15px; font-weight:800; color:var(--ink)}
.summary .alt .k{font-size:10.5px; color:var(--muted); font-weight:700}
.summary .per{
  display:inline-flex; align-items:center; gap:6px; margin-top:var(--sp-3);
  background:var(--surface-2); color:var(--ink-soft); border:1px solid var(--line);
  border-radius:var(--r-chip); padding:5px 12px; font-size:12px; font-weight:800;
}
/* مسطرة العدّاد — اللمسة المميزة الوحيدة */
.summary::after{
  content:""; position:absolute; inset-inline:0; bottom:0; height:9px;
  background:repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 9px);
  opacity:.55;
  -webkit-mask-image:linear-gradient(to top, #000, transparent);
          mask-image:linear-gradient(to top, #000, transparent);
}

/* ===================== 7) المرشّحات والشرائح ===================== */
.filters{display:flex; flex-direction:column; gap:var(--sp-2)}
.search{
  display:flex; align-items:center; gap:var(--sp-2);
  height:46px; padding:0 var(--sp-3);
  background:var(--surface); border:1px solid var(--line-soft); border-radius:var(--r-chip);
}
.search .mi{width:20px; height:20px; color:var(--muted)}
.search input{flex:1; min-width:0; height:100%; border:0; outline:none; background:none; font-size:15px}
.search input::placeholder{color:var(--muted)}
.search .clear{
  width:32px; height:32px; border-radius:50%; color:var(--muted);
  display:inline-flex; align-items:center; justify-content:center;
}
.chip-scroll{
  display:flex; gap:var(--sp-2); overflow-x:auto; padding-bottom:2px;
  scrollbar-width:none; scroll-snap-type:x proximity;
}
.chip-scroll::-webkit-scrollbar{display:none}
.chip{
  flex:none; scroll-snap-align:start;
  display:inline-flex; align-items:center; gap:6px;
  height:40px; padding:0 var(--sp-3); border-radius:var(--r-chip);
  background:var(--surface); border:1px solid var(--line-soft);
  color:var(--ink-soft); font-size:13.5px; font-weight:700;
  transition:background .12s ease, color .12s ease, border-color .12s ease, transform .1s ease;
}
.chip .mi{width:19px; height:19px}
.chip:active{transform:scale(.96)}
.chip.on{background:var(--accent-soft); border-color:var(--accent-line); color:var(--accent-hi)}

/* ===================== 8) رؤوس الأيام وصفوف المصاريف ===================== */
.day-head{
  position:sticky; top:calc(var(--bar-h) + var(--safe-top)); z-index:5;
  display:flex; align-items:center; justify-content:space-between; gap:var(--sp-2);
  padding:var(--sp-3) var(--sp-1) 6px;
  background:linear-gradient(to bottom, var(--bg) 62%, rgba(10,11,13,0));
  font-size:11.5px; font-weight:800; color:var(--muted); letter-spacing:.05em;
}
.day-head .t{color:var(--ink-soft)}

.exp-row{
  display:flex; align-items:center; gap:var(--sp-3); width:100%; text-align:start;
  background:var(--surface); border:1px solid var(--line-soft);
  border-radius:var(--r-card); padding:11px var(--sp-3);
  transition:transform .12s ease, background .12s ease;
}
.exp-row:active{transform:scale(.99); background:var(--surface-2)}
.exp-row .mark{
  width:40px; height:40px; flex:none; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  background:var(--surface-3); color:var(--ink-soft);
}
.exp-row .mark .mi{width:22px; height:22px}
.exp-row .main{flex:1; min-width:0}
.exp-row .cat-name{font-size:14.5px; font-weight:700; display:flex; align-items:center; gap:6px}
.exp-row .sub{
  display:block; font-size:12px; color:var(--muted); margin-top:1px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.exp-row .amount{display:flex; flex-direction:column; align-items:flex-end; gap:1px}
.exp-row .amount .num{font-size:15.5px; font-weight:800; color:var(--accent)}
.exp-row .amount .orig{font-size:10.5px; color:var(--muted); font-weight:700}
.exp-row .state{width:8px; height:8px; border-radius:50%; flex:none}
.exp-row .state.pending{background:var(--warn)}
.exp-row .thumb{width:38px; height:38px; border-radius:10px; object-fit:cover; flex:none}

/* ===================== 9) حالات فارغة وهيكل مؤقّت ===================== */
.empty{text-align:center; padding:56px var(--sp-6) 40px; color:var(--muted)}
.empty .big{color:var(--muted); opacity:.85}
.empty .big .mi{width:60px; height:60px}
.empty h3{color:var(--ink-soft); margin:var(--sp-3) 0 4px; font-size:16px}
.empty p{margin:0; font-size:13.5px}
/* ===================== 10) الأزرار والشريط السفلي ===================== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:var(--sp-2);
  min-height:52px; padding:0 var(--sp-4); border-radius:var(--r-btn);
  font-size:15.5px; font-weight:800; letter-spacing:-.01em;
  transition:transform .12s ease, background .12s ease, opacity .12s ease;
}
.btn .mi{width:20px; height:20px}
.btn:active{transform:scale(.975)}
.btn:disabled{opacity:.45; pointer-events:none}
.btn.full{width:100%}
.btn.primary{background:var(--accent); color:var(--on-accent)}
.btn.primary:active{background:var(--accent-hi)}
.btn.ghost{background:var(--surface-3); color:var(--ink); border:1px solid var(--line)}
.btn.quiet{background:transparent; color:var(--ink-soft)}
.btn.danger{background:var(--bad-soft); color:var(--bad); border:1px solid rgba(255,107,107,.28)}
.btn.sm{min-height:44px; font-size:14px; padding:0 var(--sp-3)}
.actions-row{display:flex; gap:var(--sp-2)}
.actions-row > .btn{flex:1}

button.fab{
  position:fixed; z-index:45;
  inset-inline-end:var(--sp-4);
  bottom:calc(var(--sp-4) + var(--safe-bottom));
  display:inline-flex; align-items:center; gap:var(--sp-2);
  height:56px; padding:0 var(--sp-5); border-radius:var(--r-chip);
  background:var(--accent); color:var(--on-accent);
  font-size:15.5px; font-weight:800; box-shadow:var(--sh-2);
  transition:transform .12s ease, background .12s ease;
}
button.fab:active{transform:scale(.96); background:var(--accent-hi)}
button.fab .mi{width:22px; height:22px}

.actionbar{
  position:fixed; z-index:45; inset-inline:0; bottom:0;
  display:flex; align-items:center; gap:var(--sp-2);
  width:100%; max-width:620px; margin:0 auto;
  padding:var(--sp-2) var(--sp-3) calc(var(--sp-2) + var(--safe-bottom));
  background:rgba(19,21,25,.94); border-top:1px solid var(--line-soft);
}
@supports (backdrop-filter:blur(1px)){
  .actionbar{backdrop-filter:blur(14px) saturate(1.2)}
}
.actionbar .btn.primary{flex:1}
.actionbar .btn.ghost{flex:none; padding:0 var(--sp-3)}

/* ===================== 11) الأوراق والحوارات والقائمة ===================== */
.scrim{
  position:fixed; inset:0; z-index:100; display:none;
  align-items:flex-end; justify-content:center;
  background:rgba(4,5,7,.66);
}
.scrim.open{display:flex}
.scrim.center{align-items:center}
.sheet{
  width:100%; max-width:620px;
  max-height:92dvh; overflow-y:auto; overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  background:var(--surface); border-top:1px solid var(--line);
  border-radius:var(--r-sheet) var(--r-sheet) 0 0;
  padding:var(--sp-2) var(--sp-4) calc(var(--sp-4) + var(--safe-bottom));
  animation:sheetUp .24s cubic-bezier(.2,.8,.2,1);
  box-shadow:var(--sh-2);
}
.sheet.center{
  border-radius:var(--r-sheet); margin:auto var(--sp-4); max-height:88dvh;
  animation:popIn .2s ease; padding-bottom:var(--sp-4);
}
@keyframes sheetUp{from{transform:translateY(44px); opacity:.35} to{transform:translateY(0); opacity:1}}
@keyframes popIn{from{transform:scale(.95); opacity:.4} to{transform:scale(1); opacity:1}}
.grab{width:44px; height:5px; border-radius:3px; background:var(--line); margin:var(--sp-1) auto var(--sp-3)}
.sheet-head{
  position:sticky; top:calc(-1 * var(--sp-2)); z-index:2;
  display:flex; align-items:center; gap:var(--sp-2);
  padding:var(--sp-1) 0 var(--sp-3);
  background:linear-gradient(to bottom, var(--surface) 74%, rgba(19,21,25,0));
}
.sheet-title{font-size:18px; font-weight:800; letter-spacing:-.01em}
.sheet-body > * + *{margin-top:var(--sp-4)}
.sheet-foot{
  position:sticky; bottom:calc(-1 * (var(--sp-4) + var(--safe-bottom))); z-index:2;
  margin:var(--sp-4) calc(-1 * var(--sp-4)) 0;
  padding:var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-bottom));
  background:linear-gradient(to top, var(--surface) 78%, rgba(19,21,25,0));
  display:flex; gap:var(--sp-2);
}
.sheet-foot > .btn{flex:1}
.sheet-foot .btn.ghost{flex:1.15}

.dialog{
  width:100%; max-width:min(92vw,420px);
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:var(--r-sheet); padding:var(--sp-5);
  box-shadow:var(--sh-2); animation:popIn .18s ease;
}
.dlg-head{display:flex; align-items:center; gap:var(--sp-2); font-weight:800; font-size:17px}
.dlg-head .mi{width:24px; height:24px; color:var(--bad)}
.dialog p{margin:var(--sp-3) 0 var(--sp-1); font-size:14.5px; color:var(--ink)}
.dialog .dialog-note{margin:0; font-size:12px; color:var(--muted)}
.dialog .actions{display:flex; gap:var(--sp-2); margin-top:var(--sp-5); justify-content:flex-end}

.menu{display:flex; flex-direction:column; gap:2px}
.menu-item{
  display:flex; align-items:center; gap:var(--sp-3);
  min-height:54px; padding:0 var(--sp-3); border-radius:var(--r-btn);
  font-size:15px; font-weight:700; color:var(--ink); text-align:start;
  transition:background .12s ease;
}
.menu-item .mi{width:22px; height:22px; color:var(--ink-soft)}
.menu-item:active{background:var(--surface-3)}
.menu-item .sub{margin-inline-start:auto; font-size:11.5px; color:var(--muted); font-weight:700}
.menu-item.danger{color:var(--bad)}
.menu-item.danger .mi{color:var(--bad)}

/* ===================== 12) الحقول ===================== */
.field > label{display:block; font-size:12.5px; font-weight:700; color:var(--ink-soft); margin-bottom:6px}
.field > label .opt{color:var(--muted); font-weight:600; font-size:11.5px}
.label-sm{font-size:12.5px; font-weight:700; color:var(--ink-soft)}
.input{
  width:100%; min-height:52px; padding:0 var(--sp-3);
  background:var(--surface-2); color:var(--ink);
  border:1px solid var(--line); border-radius:var(--r-input);
  outline:none; transition:border-color .14s ease, background .14s ease;
}
textarea.input{min-height:96px; padding:var(--sp-3); line-height:1.6; resize:vertical}
.input::placeholder{color:var(--muted)}
.input:focus{border-color:var(--accent); background:var(--surface-3)}
.input.err{border-color:var(--bad)}
.helper{font-size:11.5px; color:var(--muted); margin-top:6px}
.helper.err{color:var(--bad)}
.row-between{display:flex; align-items:center; justify-content:space-between; gap:var(--sp-2)}
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:var(--sp-2)}

/* ===================== 13) المبلغ: بطل الورقة ===================== */
.amount-hero{
  background:var(--surface-2); border:1px solid var(--line);
  border-radius:var(--r-card); padding:var(--sp-3) var(--sp-3) var(--sp-4);
  transition:border-color .14s ease;
}
.amount-hero:focus-within{border-color:var(--accent-line)}

/* تبديل العملة السريع: ALL / EUR بارزتان */
.cur-row{display:flex}
.cur-row .seg{width:100%}
.seg{
  display:flex; gap:4px; padding:4px; height:52px;
  background:var(--surface-3); border:1px solid var(--line); border-radius:var(--r-chip);
}
.seg-opt{
  flex:1; display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:44px; border-radius:var(--r-chip);
  font-size:14.5px; font-weight:800; color:var(--ink-soft);
  transition:background .14s ease, color .14s ease, transform .1s ease;
}
.seg-opt .s{font-size:19px; font-weight:800}
.seg-opt .code{font-size:11px; font-weight:700; opacity:.75}
.seg-opt:active{transform:scale(.97)}
.seg-opt.on{background:var(--accent); color:var(--on-accent)}

.amount-input{display:flex; align-items:baseline; justify-content:center; gap:8px; margin-top:var(--sp-3)}
.amount-input .cur-tag{font-size:20px; font-weight:800; color:var(--muted)}
.amount-input input{
  width:100%; max-width:230px; border:0; outline:none; background:none;
  text-align:center; direction:ltr;
  font-size:38px; font-weight:800; color:var(--ink); letter-spacing:-.02em;
  font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1;
}
.amount-input input::placeholder{color:var(--surface-3)}
.conv{text-align:center; font-size:12.5px; color:var(--ink-soft); min-height:18px; margin-top:6px}
.conv b{color:var(--accent)}
.rate-line{display:flex; align-items:center; justify-content:center; gap:6px; margin-top:5px; font-size:11.5px; color:var(--muted)}

/* شارة مصدر السعر: يدوي / حيّ / تقديري */
.badge{
  display:inline-flex; align-items:center; gap:4px;
  height:20px; padding:0 8px; border-radius:var(--r-chip);
  font-size:10.5px; font-weight:800;
  border:1px solid var(--line); color:var(--ink-soft); background:var(--surface-3);
}
.badge.manual{color:var(--accent-hi); border-color:var(--accent-line); background:var(--accent-soft)}
.badge.live{color:var(--ok); border-color:rgba(78,208,139,.28); background:var(--ok-soft)}
.badge.fallback{color:var(--warn); border-color:rgba(245,194,107,.28); background:var(--warn-soft)}

/* لوحة أرقام داخلية (اختيارية) */
.keypad{display:none; grid-template-columns:repeat(3,1fr); gap:var(--sp-2); margin-top:var(--sp-3)}
.keypad.open{display:grid}
.keypad button{
  height:54px; border-radius:var(--r-btn);
  background:var(--surface-3); color:var(--ink);
  font-size:20px; font-weight:700; font-variant-numeric:tabular-nums;
  transition:background .1s ease, transform .1s ease;
}
.keypad button:active{background:var(--surface-2); transform:scale(.97)}
.keypad button.fn{color:var(--ink-soft); font-size:16px}
.keypad-toggle{
  display:flex; width:max-content; align-items:center; gap:6px; margin:var(--sp-2) auto 0;
  font-size:12.5px; font-weight:700; color:var(--ink-soft);
}

/* ===================== 14) التفاصيل القابلة للطي ===================== */
.more{background:var(--surface-2); border:1px solid var(--line-soft); border-radius:var(--r-card); overflow:hidden}
.more-head{
  display:flex; align-items:center; gap:var(--sp-2); width:100%;
  min-height:52px; padding:0 var(--sp-3);
  font-size:14.5px; font-weight:700; color:var(--ink);
}
.more-head .mi{width:20px; height:20px; color:var(--ink-soft)}
.more-head .chev{margin-inline-start:auto; color:var(--muted); transition:transform .2s ease}
.more-head .count{font-size:11.5px; color:var(--muted); font-weight:700}
.more.open .more-head .chev{transform:rotate(180deg)}
.more-body{display:none; padding:0 var(--sp-3) var(--sp-4)}
.more.open .more-body{display:block}
.more-body > * + *{margin-top:var(--sp-4)}

.loc-row{display:flex; gap:var(--sp-2); align-items:center}
.loc-row .input{flex:1}
.photo{
  position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; min-height:112px; padding:var(--sp-3);
  background:var(--surface); border:1px dashed var(--line); border-radius:var(--r-card);
  color:var(--muted); overflow:hidden;
}
.photo img{max-height:190px; border-radius:12px}
.photo .photo-hint{font-size:12.5px; font-weight:700}
.photo-acts{display:flex; gap:var(--sp-2); margin-top:var(--sp-2); flex-wrap:wrap}

/* ===================== 15) الأعضاء والتقسيم ===================== */
.member-row{
  display:flex; align-items:center; gap:var(--sp-2);
  background:var(--surface-2); border:1px solid var(--line-soft);
  border-radius:var(--r-btn); padding:6px var(--sp-3); margin-bottom:var(--sp-2);
}
.member-row .mi.avatar{width:20px; height:20px; color:var(--muted)}
.member-row .name{flex:1; font-weight:700; font-size:14.5px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.member-row .share{font-weight:800; color:var(--accent)}
.member-row .del{
  width:44px; height:44px; border-radius:12px; color:var(--muted);
  display:inline-flex; align-items:center; justify-content:center;
}
.member-row .del:active{color:var(--bad); background:var(--bad-soft)}
.add-member-row{display:flex; gap:var(--sp-2); align-items:center}
.add-member-row .input{flex:1}
.add-member-row .btn{flex:none}
.split-hero{
  position:relative; overflow:hidden; text-align:center;
  background:var(--surface-2); border:1px solid var(--line-soft);
  border-radius:var(--r-card); padding:var(--sp-5) var(--sp-4);
}
.split-hero .label{font-size:11.5px; font-weight:700; color:var(--muted); letter-spacing:.06em}
.split-hero .total{font-size:32px; font-weight:800; color:var(--accent); margin-top:2px}
.split-hero .total small{font-size:13px; color:var(--ink-soft); font-weight:700}
.split-hero .per{
  display:inline-flex; gap:6px; align-items:center; margin-top:var(--sp-3);
  background:var(--surface-3); border:1px solid var(--line); border-radius:var(--r-chip);
  padding:6px 14px; font-size:13px; font-weight:800; color:var(--ink-soft);
}
.split-mix{
  display:flex; gap:var(--sp-2); justify-content:center; flex-wrap:wrap; margin-top:var(--sp-3);
  font-size:11.5px; color:var(--muted); font-weight:700;
}

/* ===================== 21) أسعار الصرف اليدوية (ALL / EUR مقابل SAR) ===================== */
.fx-list{display:flex; flex-direction:column; gap:var(--sp-2)}
.fx-row{
  display:flex; align-items:center; gap:var(--sp-3);
  background:var(--surface-2); border:1px solid var(--line-soft);
  border-radius:var(--r-card); padding:var(--sp-3);
}
.fx-row .fx-id{display:flex; align-items:center; gap:var(--sp-2); min-width:92px}
.fx-row .fx-sym{
  width:38px; height:38px; flex:none; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  background:var(--surface-3); color:var(--ink); font-size:15px; font-weight:800;
}
.fx-row .fx-id .n{display:flex; flex-direction:column; line-height:1.25; min-width:0}
.fx-row .fx-id b{font-size:13.5px; font-weight:800}
.fx-row .fx-id span{font-size:10.5px; color:var(--muted)}
.inline-field{
  flex:1; display:flex; align-items:center; gap:6px;
  min-height:48px; padding:0 var(--sp-3);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-input);
  transition:border-color .14s ease;
}
.inline-field:focus-within{border-color:var(--accent)}
.inline-field .pre,.inline-field .post{font-size:12px; font-weight:700; color:var(--muted); white-space:nowrap}
.inline-field input{
  flex:1; min-width:0; border:0; outline:none; background:none;
  text-align:center; direction:ltr;
  font-size:16px; font-weight:800; font-variant-numeric:tabular-nums;
}
.inline-field input::placeholder{color:var(--muted); font-weight:700}
.fx-live{display:flex; align-items:center; justify-content:space-between; gap:var(--sp-2); margin-top:var(--sp-2)}
.fx-note{font-size:11.5px; color:var(--muted); line-height:1.8; margin:0}
.fx-note b{color:var(--ink-soft)}

/* ===================== 16) التنبيهات وتفاصيل المصروف ===================== */
.toasts{
  position:fixed; z-index:200; inset-inline:0;
  bottom:calc(88px + var(--safe-bottom));
  display:flex; flex-direction:column; align-items:center; gap:var(--sp-2);
  pointer-events:none; padding:0 var(--sp-3);
}
.toast{
  width:min(92vw,420px); pointer-events:auto;
  display:flex; align-items:center; gap:var(--sp-2);
  background:var(--surface-3); color:var(--ink);
  border:1px solid var(--line); border-radius:var(--r-btn);
  padding:11px var(--sp-3); font-size:13.5px; font-weight:700;
  box-shadow:var(--sh-2); animation:toastIn .22s ease;
}
.toast .mi{width:18px; height:18px}
.toast.success{border-color:rgba(78,208,139,.3); background:#0f2018}
.toast.error{border-color:rgba(255,107,107,.3); background:#221316}
.toast.warn{border-color:rgba(245,194,107,.3); background:#211a10}
.toast .undo{
  margin-inline-start:auto; color:var(--accent); font-weight:800; font-size:13px;
  padding:4px 8px; border-radius:8px;
}
.toast .undo:active{background:var(--accent-soft)}
@keyframes toastIn{from{transform:translateY(14px); opacity:0} to{transform:translateY(0); opacity:1}}

.detail-hero{display:flex; flex-direction:column; align-items:center; gap:var(--sp-2); padding-top:var(--sp-2)}
.detail-hero .amount{font-size:34px; font-weight:800; color:var(--accent)}
.detail-hero .eq{font-size:13px; color:var(--ink-soft)}
.detail-hero img{width:100%; max-height:280px; object-fit:cover; border-radius:var(--r-card); margin-top:var(--sp-2)}
.detail-rows{display:flex; flex-direction:column; margin-top:var(--sp-3)}
.detail-row{
  display:flex; align-items:flex-start; gap:var(--sp-3);
  padding:var(--sp-3) 0; border-bottom:1px solid var(--line-soft);
}
.detail-row:last-child{border-bottom:0}
.detail-row .mi{width:20px; height:20px; color:var(--muted); margin-top:2px}
.detail-row .k{font-size:12.5px; color:var(--muted); font-weight:700; min-width:72px}
.detail-row .v{flex:1; font-size:14.5px; color:var(--ink); word-break:break-word}
.detail-row .v.num{color:var(--accent); font-weight:800}

/* ===================== 17) بوابة القفل (PIN) ===================== */
.gate{
  min-height:100dvh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:var(--sp-2);
  padding:var(--sp-8) var(--sp-6) calc(var(--sp-6) + var(--safe-bottom));
  text-align:center; position:relative; overflow:hidden;
}
.gate::before{
  content:""; position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(680px 340px at 50% -12%, rgba(245,165,36,.15), transparent 70%),
    radial-gradient(560px 320px at 50% 112%, rgba(122,138,160,.12), transparent 72%);
}
.gate > *{position:relative}
.gate-brand{
  width:78px; height:78px; border-radius:24px;
  display:flex; align-items:center; justify-content:center;
  background:var(--surface-2); border:1px solid var(--line);
  color:var(--accent); box-shadow:var(--sh-1);
}
.gate-brand .mi{width:40px; height:40px}
.gate h1{margin:var(--sp-4) 0 2px; font-family:var(--font-display); font-size:26px; font-weight:800; letter-spacing:-.02em}
.gate-sub{margin:0 0 var(--sp-5); font-size:13.5px; color:var(--ink-soft)}
.pin-row{display:flex; gap:var(--sp-3); direction:ltr}
.pin-box{
  width:56px; height:64px; text-align:center;
  background:var(--surface-2); border:1px solid var(--line); border-radius:var(--r-input);
  font-size:24px; font-weight:800; color:var(--ink);
  font-variant-numeric:tabular-nums; outline:none;
  transition:border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.pin-box.filled{background:var(--surface-3)}
.pin-box:focus{border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft)}
.pin-error{min-height:20px; font-size:12.5px; font-weight:700; color:var(--bad); margin-top:var(--sp-3)}
.gate-foot{font-size:11.5px; color:var(--muted); margin-top:var(--sp-4); max-width:300px}

/* ===================== 18) العرض المكبّر ===================== */
.viewer{
  position:fixed; inset:0; z-index:300; display:none;
  align-items:center; justify-content:center; padding:var(--sp-5);
  background:rgba(3,4,6,.95);
}
.viewer.open{display:flex}
.viewer img{max-width:100%; max-height:88dvh; border-radius:var(--r-card)}
.viewer .close{
  position:absolute; top:calc(var(--sp-4) + var(--safe-top)); inset-inline-end:var(--sp-4);
  width:48px; height:48px; border-radius:50%;
  background:rgba(19,21,25,.8); color:var(--ink);
  display:inline-flex; align-items:center; justify-content:center;
}
.viewer .close .mi{width:26px; height:26px}

/* ===================== 19) أدوات ===================== */
.muted{color:var(--muted)}
.small{font-size:12px}
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; border:0;
}
.spin{animation:spin 1s linear infinite; display:inline-block}
@keyframes spin{to{transform:rotate(360deg)}}
.divider{border:0; border-top:1px solid var(--line-soft); margin:var(--sp-4) 0}

/* ===================== 20) الاستجابة والحركة المقلّلة ===================== */
@media (max-width:360px){
  .pin-box{width:50px; height:58px; font-size:21px}
  .summary .hero-amount{font-size:32px}
  .amount-input input{font-size:34px}
  .seg-opt .code{display:none}
  .appbar .title .sub{display:none}
}
@media (min-width:640px){
  .summary .hero-amount{font-size:40px}
  .sheet{border-radius:var(--r-sheet); margin:auto; max-height:88dvh; border:1px solid var(--line)}
  .scrim{align-items:center}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important; animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
}
