/* المنظم المالي الذكي — الواجهة */
:root {
  --bg: #f3f6f5;
  --bg-2: #e8eeec;
  --surface: #ffffff;
  --surface-2: #f7fafa;
  --text: #12221f;
  --text-soft: #3d514c;
  --muted: #6b7f7a;
  --line: #e2eae7;
  --line-strong: #cfdad6;
  --primary: #0f6f67;
  --primary-2: #0b5c56;
  --primary-soft: #e6f5f2;
  --primary-ink: #0a4f4a;
  --accent: #14b8a6;
  --income: #0c8a5b;
  --income-soft: #e6f7ef;
  --expense: #d11f4d;
  --expense-soft: #fde8ee;
  --warning: #c67a08;
  --warning-soft: #fff4e0;
  --danger: #d11f4d;
  --danger-soft: #fde8ee;
  --safe: #0c8a5b;
  --safe-soft: #e6f7ef;
  --gold: #b45309;
  --gold-soft: #fef3c7;
  --shadow: 0 10px 30px rgba(12, 40, 36, 0.07);
  --shadow-sm: 0 2px 10px rgba(12, 40, 36, 0.05);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --tab: 68px;
  --header: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --font: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

[data-theme="dark"] {
  --bg: #0b1211;
  --bg-2: #0e1715;
  --surface: #15201e;
  --surface-2: #1b2926;
  --text: #eef4f2;
  --text-soft: #c5d2ce;
  --muted: #8fa09b;
  --line: #24332f;
  --line-strong: #33443f;
  --primary: #2dd4bf;
  --primary-2: #14b8a6;
  --primary-soft: #12322e;
  --primary-ink: #99f6e4;
  --accent: #5eead4;
  --income: #34d399;
  --income-soft: #10261c;
  --expense: #fb7185;
  --expense-soft: #2a1218;
  --warning: #fbbf24;
  --warning-soft: #2a2110;
  --danger: #fb7185;
  --danger-soft: #2a1218;
  --safe: #34d399;
  --safe-soft: #10261c;
  --gold: #fbbf24;
  --gold-soft: #2a2110;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
html { background: #07110f; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  min-height: 100dvh;
  overflow: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
a { color: var(--primary); }

.num, .amount, .stat-value, .cycle-nav, input[type="number"] {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Shell */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 480px) {
  html { background: #07110f; }
  body { display: flex; align-items: center; justify-content: center; }
  .app {
    height: min(900px, calc(100dvh - 32px));
    min-height: 0;
    border-radius: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.06);
  }
}

/* Splash */
.splash {
  position: fixed; inset: 0; z-index: 80;
  max-width: 430px; margin: 0 auto; height: 100dvh;
  background: linear-gradient(160deg, #0b5c56, #127a70 50%, #0e8f7c);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  transition: opacity .45s var(--ease), visibility .45s;
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash img { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.splash h1 { margin: 8px 0 0; font-size: 22px; font-weight: 700; }
.splash p { margin: 0; opacity: .85; font-size: 13px; }
.splash .spin {
  width: 22px; height: 22px; margin-top: 12px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.topbar {
  flex: 0 0 auto;
  padding: calc(var(--safe-top) + 8px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand .titles { min-width: 0; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; }
.greet { margin: 0; color: var(--muted); font-size: 12px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  display: grid; place-items: center; color: var(--text-soft);
  transition: transform .15s var(--ease);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn.add-btn { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(15, 111, 103, .28); }
[data-theme="dark"] .icon-btn.add-btn { color: #042f2e; }

/* Cycle switcher */
.cycle-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 16px 8px; padding: 8px 8px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.cycle-bar button {
  width: 36px; height: 36px; border-radius: 10px; color: var(--primary);
  display: grid; place-items: center;
}
.cycle-bar button:active { background: var(--primary-soft); }
.cycle-meta { text-align: center; flex: 1; min-width: 0; }
.cycle-meta .range { margin: 0; font-size: 13.5px; font-weight: 600; }
.cycle-meta .hijri { margin: 1px 0 0; font-size: 11px; color: var(--muted); }
.demo-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--gold-soft); color: var(--gold);
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}

/* Main scroll */
.main {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 16px calc(var(--tab) + var(--safe-bot) + 36px);
  -webkit-overflow-scrolling: touch;
}
.main.fade > * { animation: fadeUp .45s var(--ease) both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.page-title { margin: 4px 0 12px; font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.section-h {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 10px;
}
.section-h h2 { margin: 0; font-size: 15px; font-weight: 700; }
.section-h .link { color: var(--primary); font-size: 13px; font-weight: 600; }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  padding: 16px;
}
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0b5c56 0%, #0f766e 48%, #1aa887 100%);
  color: #fff;
  border: 0;
  box-shadow: 0 16px 36px rgba(11, 92, 86, .28);
  padding: 18px 18px 16px;
}
[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #083d39 0%, #0c5c55 50%, #0f766e 100%);
  box-shadow: 0 16px 36px rgba(0,0,0,.4);
}
.hero::after {
  content: "";
  position: absolute; left: -40px; top: -50px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}
.hero-label { margin: 0; font-size: 12.5px; opacity: .85; font-weight: 500; }
.hero-amount { margin: 4px 0 0; font-size: 32px; font-weight: 700; letter-spacing: -0.04em; text-align: start; }
.hero-amount small { font-size: 15px; font-weight: 600; opacity: .85; margin-inline-start: 4px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.today-spend {
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
}
.today-spend b { font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 10px; box-shadow: var(--shadow-sm);
}
.stat .lbl { margin: 0; color: var(--muted); font-size: 11.5px; }
.stat .val { margin: 4px 0 0; font-size: 14px; font-weight: 700; }
.stat.income .val { color: var(--income); }
.stat.expense .val { color: var(--expense); }

/* Status banner */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 16px; margin-top: 10px;
  font-size: 13px; font-weight: 600;
}
.banner p { margin: 0; }
.banner .sub { font-weight: 400; color: inherit; opacity: .85; font-size: 12px; }
.banner.safe { background: var(--safe-soft); color: var(--safe); }
.banner.warn { background: var(--warning-soft); color: var(--warning); }
.banner.over { background: var(--danger-soft); color: var(--danger); }
.banner .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

/* 50/30/20 */
.rule {
  margin-top: 10px; padding: 14px;
}
.rule-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.rule-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
.rule-head span { color: var(--muted); font-size: 11.5px; }
.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.bar-row { display: grid; grid-template-columns: 72px 1fr 54px; gap: 8px; align-items: center; }
.bar-row .name { font-size: 12px; color: var(--text-soft); }
.bar-row .pct { font-size: 12px; font-weight: 700; text-align: start; }
.track { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; position: relative; }
.track > i { display: block; height: 100%; border-radius: 99px; width: 0; transition: width .7s var(--ease); }
.track > em {
  position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text);
  opacity: .35; border-radius: 2px;
}
.track.needs > i { background: #0f766e; }
.track.wants > i { background: #f59e0b; }
.track.savings > i { background: #6366f1; }
[data-theme="dark"] .track.needs > i { background: #2dd4bf; }
[data-theme="dark"] .track.wants > i { background: #fbbf24; }
[data-theme="dark"] .track.savings > i { background: #a5b4fc; }

/* Commitments strip */
.commit {
  display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 12px 14px;
}
.commit-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.commit-ico {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center; font-size: 16px;
  background: var(--primary-soft); flex: 0 0 auto;
}
.commit-item .mid { flex: 1; min-width: 0; }
.commit-item .mid b { display: block; font-weight: 600; }
.commit-item .mid span { color: var(--muted); font-size: 11.5px; }
.commit-item .amt { font-weight: 700; font-size: 13px; }

/* Lists */
.tx-list, .plain-list { display: flex; flex-direction: column; gap: 8px; }
.tx {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 11px 12px;
  box-shadow: var(--shadow-sm);
  text-align: start; width: 100%;
  transition: transform .15s var(--ease);
}
.tx:active { transform: scale(.985); }
.cat-ico {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center; font-size: 18px; flex: 0 0 auto;
}
.tx .mid { flex: 1; min-width: 0; }
.tx .mid b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .mid span { color: var(--muted); font-size: 11.5px; }
.tx .end { text-align: start; }
.tx .end .amt { font-weight: 700; font-size: 13.5px; }
.tx .end .amt.out { color: var(--expense); }
.tx .end .amt.in { color: var(--income); }
.badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 99px;
  background: var(--primary-soft); color: var(--primary-ink); margin-inline-start: 4px;
}

/* Budget rows */
.budget-row { padding: 12px 0; }
.budget-row + .budget-row { border-top: 1px solid var(--line); }
.budget-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.budget-top .left { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.budget-top .right { font-size: 12px; color: var(--muted); }
.progress { height: 9px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; width: 0; transition: width .7s var(--ease); background: var(--safe); }
.progress.warn > i { background: var(--warning); }
.progress.over > i { background: var(--danger); }
.budget-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.budget-foot .warn { color: var(--warning); font-weight: 600; }
.budget-foot .over { color: var(--danger); font-weight: 600; }
.budget-input {
  width: 96px; text-align: center; border: 1px solid var(--line);
  background: var(--surface-2); border-radius: 10px; padding: 4px 6px; font-weight: 600;
}

/* Search / filters */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 12px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.search input {
  flex: 1; border: 0; background: transparent; outline: none; padding: 10px 0;
}
.chips { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-soft); font-size: 12.5px; font-weight: 600;
}
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Charts */
.chart-card { padding: 16px; margin-top: 10px; }
.chart-wrap { position: relative; height: 200px; }
.chart-wrap.donut { height: 210px; }
.legend { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend-row .grow { flex: 1; }
.legend-row .amt { font-weight: 600; }

/* Goals */
.goal { padding: 14px; }
.goal + .goal { margin-top: 8px; }
.goal-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.goal-top b { font-size: 14px; }
.goal .progress { margin-top: 10px; }
.goal .progress > i { background: var(--primary); }

/* Settings */
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.set-link, .set-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 13px 14px; width: 100%; text-align: start;
  box-shadow: var(--shadow-sm);
}
.set-ico {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; background: var(--primary-soft); font-size: 18px;
  flex: 0 0 auto;
}
.set-link .mid, .set-row .mid { flex: 1; min-width: 0; }
.set-link .mid b, .set-row .mid b { display: block; font-weight: 600; font-size: 14px; }
.set-link .mid span, .set-row .mid span { color: var(--muted); font-size: 12px; }
.set-link .chev { color: var(--muted); }
.soon {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: var(--bg-2); padding: 2px 7px; border-radius: 99px;
}

/* Toggle */
.toggle {
  width: 44px; height: 26px; border-radius: 99px;
  background: var(--line-strong); position: relative; flex: 0 0 auto;
  transition: background .2s;
}
.toggle.on { background: var(--primary); }
.toggle i {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform .2s var(--ease);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle.on i { transform: translateX(-18px); }

.seg {
  display: flex; background: var(--bg-2); border-radius: 12px; padding: 3px; gap: 2px;
}
.seg button {
  flex: 1; padding: 7px 8px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Tab bar */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 6px 8px calc(var(--safe-bot) + 6px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: flex-end;
  z-index: 20;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; padding: 4px 0;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--primary); }

/* Sheets / modals */
.overlay {
  position: absolute; inset: 0; background: rgba(8, 16, 15, .45);
  z-index: 40; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: min(92%, 760px);
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(var(--safe-bot) + 16px);
  z-index: 41;
  transform: translateY(110%);
  transition: transform .35s var(--ease);
  overflow: auto;
  box-shadow: 0 -20px 50px rgba(0,0,0,.2);
}
.sheet.show { transform: none; }
.sheet .grab {
  width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong);
  margin: 6px auto 12px;
}
.sheet h3 { margin: 0 0 14px; font-size: 18px; font-weight: 700; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 12px; padding: 11px 12px; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.amount-input {
  font-size: 28px !important; font-weight: 700; text-align: center;
  letter-spacing: -0.03em; padding: 8px !important; background: transparent !important; border: 0 !important;
  box-shadow: none !important;
}
.currency-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: -8px; margin-bottom: 8px; }
.cat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.cat-pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line);
  font-size: 11px; text-align: center; color: var(--text-soft); min-height: 70px;
}
.cat-pick .emoji { font-size: 20px; }
.cat-pick.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.method-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.method-pick {
  padding: 8px 12px; border-radius: 99px; border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--text-soft);
}
.method-pick.on { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 13px 16px; border-radius: 14px;
  font-weight: 700; font-size: 15px;
  transition: transform .15s var(--ease), filter .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--bg-2); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-row { display: flex; gap: 8px; margin-top: 8px; }
.btn-row .btn { flex: 1; }

.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; border-radius: 14px; border: 1px dashed var(--line-strong);
  background: var(--surface-2); text-align: start; font-weight: 600; font-size: 13px;
}
.preset:active { background: var(--primary-soft); }
.preset span { font-size: 18px; }

/* Toast */
.toast {
  position: absolute; top: calc(var(--safe-top) + 12px); left: 16px; right: 16px;
  background: var(--text); color: var(--bg); z-index: 60;
  padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 13.5px;
  text-align: center; box-shadow: var(--shadow);
  transform: translateY(-120%); opacity: 0;
  transition: transform .3s var(--ease), opacity .3s;
}
.toast.show { transform: none; opacity: 1; }
[data-theme="dark"] .toast { background: #eef4f2; color: #0b1211; }

/* Dialog */
.dialog {
  position: absolute; left: 20px; right: 20px; top: 50%;
  transform: translateY(-50%) scale(.96);
  background: var(--surface); border-radius: 20px; padding: 20px;
  z-index: 51; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .2s var(--ease);
}
.dialog.show { opacity: 1; pointer-events: auto; transform: translateY(-50%); }
.dialog h3 { margin: 0 0 8px; }
.dialog p { margin: 0 0 16px; color: var(--text-soft); font-size: 14px; }

/* Empty */
.empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.empty .art { font-size: 36px; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 13.5px; }

.note-local {
  font-size: 12px; color: var(--muted); text-align: center; margin: 16px 8px 8px;
  line-height: 1.6;
}

.payday-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.payday-box input[type="number"] {
  width: 72px; text-align: center; font-weight: 700; font-size: 18px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 8px;
}

hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.amount-input::placeholder { color: var(--muted); opacity: .45; font-weight: 600; }


/* تنبيه ذكي */
.alert-card {
  margin-top: 10px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
}
.alert-card.alert { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, var(--line)); }
.alert-card.mild { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, var(--line)); }
.alert-card.over { background: var(--danger-soft); }
.alert-kicker { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--danger); }
.alert-card.mild .alert-kicker { color: var(--warning); }
.alert-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.alert-card p { margin: 0 0 6px; font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.alert-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.alert-meta span {
  background: var(--surface); border-radius: 999px; padding: 4px 9px;
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--line);
}

/* إدخال ذكي */
.smart-box { margin-top: 10px; padding: 12px; min-width: 0; }
.smart-row { display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%; }
.smart-row input {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 14px; padding: 11px 12px; outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.smart-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.mic-btn { width: 44px; height: 44px; min-width: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: 0 0 44px; }
.mic-btn.listening { background: var(--danger-soft); color: var(--danger); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.mic-btn svg { width: 22px; height: 22px; }
.smart-preview { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.smart-chip {
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600;
}
.smart-chip.missing { border-style: dashed; color: var(--warning); }
.btn-save-smart { margin-inline-start: auto; width: auto; padding: 8px 16px; border-radius: 999px; }
.smart-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }

/* لافتة استحقاق */
.due-banner {
  margin-top: 10px; padding: 10px 12px; border-radius: 16px;
  background: var(--primary-soft); color: var(--primary-ink);
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
}
.due-banner .grow { flex: 1; }
.badge-num {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 11px;
  display: inline-grid; place-items: center;
}

/* شارات الالتزام */
.pill { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.pill.today { background: var(--danger-soft); color: var(--danger); }
.pill.overdue { background: var(--danger-soft); color: var(--danger); }
.pill.soon { background: var(--warning-soft); color: var(--warning); }
.pill.paid { background: var(--safe-soft); color: var(--safe); }
.pill.upcoming { background: var(--primary-soft); color: var(--primary-ink); }

.seg-tabs { margin-bottom: 12px; }


/* التزام ثابت / ميزانية غير متطابقة */
.alert-card.mismatch {
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 25%, var(--line));
  color: var(--text);
}
.alert-card.mismatch .alert-kicker { color: var(--warning); }
.banner.mismatch { background: var(--warning-soft); color: var(--warning); }
.check-row {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 0 14px; font-size: 13.5px; font-weight: 600; color: var(--text-soft);
}
.check-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.fixed-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 4px; font-size: 11.5px; color: var(--muted); font-weight: 600;
}
