/* ==========================================================================
   كالورز — الأنماط
   ثيم داكن واحد، خصائص CSS منطقية (inline-start/end) ليعمل RTL بلا مرايا.
   ========================================================================== */

/* ------------------------------- المتغيرات ------------------------------- */
:root {
  --bg:          #0b0f14;
  --bg-glow:     #10202a;
  --surface:     #141c25;
  --surface-2:   #1b2531;
  --surface-3:   #223040;
  --border:      rgba(255, 255, 255, .09);
  --border-2:    rgba(255, 255, 255, .16);

  --text:        #e9f1f7;
  --muted:       #90a4b8;
  --muted-2:     #6b8096;

  --accent:      #34e0a1;
  --accent-dim:  #1d8f68;
  --info:        #6ea8fe;
  --warn:        #ffb454;
  --danger:      #ff5d6c;

  --ring-good:   #34e0a1;
  --ring-warn:   #ffb454;
  --ring-over:   #ff5d6c;

  --radius:      18px;
  --radius-sm:   12px;
  --radius-lg:   26px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out:    cubic-bezier(.22, .9, .3, 1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Arabic",
          "Noto Naskh Arabic", "Geeza Pro", Tahoma, "Droid Arabic Naskh", sans-serif;
}

/* --------------------------------- الأساس -------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* لازم: قاعدة المتصفح [hidden]{display:none} تخسر أمام أي display صريح نكتبه
   (مثل .btn{display:inline-flex})، فتظهر عناصر يُفترض إخفاؤها. */
[hidden] { display: none !important; }

/* عزل ثنائي الاتجاه للأرقام.
   داخل صفحة RTL تُعامَل الإشارات والشُرَط كمحارف محايدة فيُعاد ترتيبها:
   «−750» تظهر «750−»، و«18.5 – 24.9» تنقلب إلى «24.9 – 18.5».
   العزل يثبّت اتجاه الرقم دون أن يقلب النص العربي حوله. */
.num,
.ring-value,
.result__value,
.option__tag,
.meal-card__cal,
.log-item__cal,
.fly {
  direction: ltr;
  unicode-bidi: isolate;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  line-height: 1.6;
}

/* توهّج خافت خلف كامل الصفحة يعطي عمقاً بلا صور */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(90% 60% at 50% 0%, var(--bg-glow) 0%, transparent 70%),
    radial-gradient(70% 50% at 50% 100%, #101a2a 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; touch-action: manipulation; }

h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.noscript {
  padding: 24px;
  text-align: center;
  color: var(--warn);
}

/* -------------------------------- الهيكل --------------------------------- */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding:
    calc(var(--safe-t) + 8px)
    calc(var(--safe-r) + 16px)
    calc(var(--safe-b) + 16px)
    calc(var(--safe-l) + 16px);
  max-width: 560px;
  margin-inline: auto;
}

.screen { animation: screen-in .32s var(--ease-out) both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* -------------------------------- العناصر -------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 4px;
}

.topbar__title { font-size: 1.05rem; font-weight: 700; letter-spacing: .2px; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.15rem;
  transition: transform .18s var(--ease-spring), background .18s, color .18s;
}
.icon-btn:active { transform: scale(.9); background: var(--surface-2); color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  transition: transform .16s var(--ease-spring), filter .16s, background .16s;
}
.btn:active { transform: scale(.96); }
.btn--primary {
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  color: #04241a;
  font-weight: 800;
  box-shadow: 0 8px 26px -12px var(--accent);
}
.btn--ghost { background: transparent; border-color: var(--border-2); color: var(--muted); }
.btn--danger { background: transparent; border-color: rgba(255,93,108,.4); color: var(--danger); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.field__row { display: flex; align-items: center; gap: 8px; }

.input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  transition: border-color .18s, background .18s;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.input--err { border-color: var(--danger); }
.input::placeholder { color: var(--muted-2); }

.field__unit {
  flex: none;
  padding-inline: 4px;
  color: var(--muted-2);
  font-size: .9rem;
}
.field__err { color: var(--danger); font-size: .82rem; margin-top: 5px; }
.field__hint { color: var(--muted-2); font-size: .8rem; margin-top: 5px; }

/* شرائح الاختيار */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .92rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .16s var(--ease-spring), background .18s, color .18s, border-color .18s;
}
.chip:active { transform: scale(.94); }
.chip[aria-pressed="true"], .chip.is-active {
  background: rgba(52, 224, 161, .14);
  border-color: var(--accent);
  color: var(--accent);
}

/* بطاقات الاختيار العمودية (النشاط، الهدف) */
.options { display: grid; gap: 8px; }
.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: start;
  transition: transform .16s var(--ease-spring), background .18s, border-color .18s;
}
.option:active { transform: scale(.985); }
.option[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(52, 224, 161, .09);
}
.option__main { min-width: 0; }
.option__label { font-weight: 700; font-size: .98rem; }
.option__desc { color: var(--muted-2); font-size: .8rem; margin-top: 2px; }
.option__tag {
  flex: none;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 3px 10px;
}
.option[aria-pressed="true"] .option__tag { color: var(--accent); background: rgba(52,224,161,.16); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.divider { height: 1px; background: var(--border); margin: 18px 0; border: 0; }

.section-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted-2);
  letter-spacing: .4px;
  margin: 22px 0 10px;
}

.empty {
  text-align: center;
  color: var(--muted-2);
  padding: 34px 18px;
  font-size: .92rem;
}
.empty__icon { font-size: 2.2rem; display: block; margin-bottom: 10px; opacity: .75; }

/* =========================== شاشة البداية =============================== */
.onb__head { text-align: center; padding: 18px 0 22px; }
.onb__logo { font-size: 2.6rem; line-height: 1; }
.onb__title { font-size: 1.5rem; font-weight: 800; margin-top: 10px; }
.onb__sub { color: var(--muted); font-size: .93rem; margin-top: 6px; }

.seg { display: grid; grid-auto-flow: column; gap: 8px; }

/* بطاقة النتيجة الحيّة */
.result {
  position: sticky;
  bottom: calc(var(--safe-b) + 8px);
  margin-top: 20px;
  border-radius: var(--radius);
  padding: 18px;
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-2);
  box-shadow: 0 18px 40px -20px rgba(0,0,0,.9);
}
.result__label { color: var(--muted); font-size: .85rem; }
.result__value {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.result__unit { font-size: .95rem; color: var(--muted); font-weight: 600; }
.result__math {
  margin-top: 10px;
  font-size: .8rem;
  color: var(--muted-2);
  direction: ltr;
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.result__meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge {
  font-size: .76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
}
.badge--good { background: rgba(52,224,161,.14);  color: var(--accent); }
.badge--warn { background: rgba(255,180,84,.14);  color: var(--warn); }
.badge--bad  { background: rgba(255,93,108,.14);  color: var(--danger); }

.notice {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .84rem;
  line-height: 1.55;
  margin-top: 12px;
}
.notice--warn { background: rgba(255,180,84,.1);  color: #ffd39b; border: 1px solid rgba(255,180,84,.25); }
.notice--info { background: rgba(110,168,254,.1); color: #bcd6ff; border: 1px solid rgba(110,168,254,.22); }
.notice__icon { flex: none; }

/* ============================ الشاشة الرئيسية =========================== */
.home { display: flex; flex-direction: column; min-height: calc(100dvh - 40px); }

.ring-wrap {
  display: grid;
  place-items: center;
  padding: 10px 0 6px;
  flex: none;
}

.ring-btn {
  position: relative;
  width: min(74vw, 290px);
  aspect-ratio: 1;
  border: 0;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: transform .22s var(--ease-spring);
}
.ring-btn:active { transform: scale(.965); }

.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(255,255,255,.07); stroke-width: 14; }
.ring-prog {
  fill: none;
  stroke: var(--ring-good);
  stroke-width: 14;
  stroke-linecap: round;
  filter: drop-shadow(0 0 10px currentColor);
  color: var(--ring-good);
  transition: stroke-dashoffset .85s var(--ease-out), stroke .5s ease;
}
.ring-btn[data-tone="warn"] .ring-prog { stroke: var(--ring-warn); color: var(--ring-warn); }
.ring-btn[data-tone="over"] .ring-prog { stroke: var(--ring-over); color: var(--ring-over); }

/* الهالة النابضة خلف الدائرة */
.ring-halo {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52,224,161,.22), transparent 68%);
  animation: halo 3.4s ease-in-out infinite;
  pointer-events: none;
}
.ring-btn[data-tone="warn"] .ring-halo { background: radial-gradient(circle, rgba(255,180,84,.22), transparent 68%); }
.ring-btn[data-tone="over"] .ring-halo {
  background: radial-gradient(circle, rgba(255,93,108,.26), transparent 68%);
  animation-duration: 1.5s;
}
@keyframes halo {
  0%, 100% { opacity: .55; transform: scale(.95); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

.ring-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 2px;
}
.ring-value {
  font-size: clamp(2.9rem, 15vw, 4rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.ring-btn[data-tone="over"] .ring-value { color: var(--ring-over); }
.ring-unit { font-size: .9rem; color: var(--muted); font-weight: 600; }
.ring-total { font-size: .8rem; color: var(--muted-2); margin-top: 4px; }
.ring-hint {
  font-size: .74rem;
  color: var(--muted-2);
  margin-top: 8px;
  opacity: .85;
}

.home__stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 14px 0 4px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.stat__v { font-weight: 800; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.stat__k { font-size: .72rem; color: var(--muted-2); margin-top: 2px; }

.home__log { flex: 1; min-height: 0; }

.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  animation: item-in .28s var(--ease-out) both;
}
@keyframes item-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.log-item__name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.log-item__time { font-size: .74rem; color: var(--muted-2); font-weight: 500; }
.log-item__cal {
  flex: none;
  font-weight: 800;
  color: var(--warn);
  font-variant-numeric: tabular-nums;
}
.log-item__del {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-2);
  display: grid; place-items: center;
  transition: transform .16s var(--ease-spring), color .18s, border-color .18s;
}
.log-item__del:active { transform: scale(.86); color: var(--danger); border-color: var(--danger); }
.log-item.is-leaving { animation: item-out .22s ease forwards; }
@keyframes item-out {
  to { opacity: 0; transform: translateX(-30px) scale(.94); height: 0; margin: 0; padding-block: 0; }
}

/* ========================== طبقة الإجراءين ============================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 10, 14, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fade-in .2s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.overlay.is-closing { animation: fade-out .18s ease both; }
@keyframes fade-out { to { opacity: 0; } }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 420px;
}
.action {
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  transition: transform .2s var(--ease-spring), border-color .2s;
  animation: pop-in .34s var(--ease-spring) both;
}
.action:nth-child(2) { animation-delay: .06s; }
.action:active { transform: scale(.94); border-color: var(--accent); }
.action__icon { font-size: 2.3rem; }
.action__label { font-size: 1.12rem; font-weight: 800; }
.action__desc { font-size: .76rem; color: var(--muted-2); }

@keyframes pop-in {
  from { opacity: 0; transform: scale(.85) translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.overlay__close {
  position: absolute;
  inset-block-start: calc(var(--safe-t) + 14px);
  inset-inline-end: calc(var(--safe-r) + 14px);
}

/* ============================== الألواح ================================ */
.sheet-host {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 10, 14, .6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in .2s ease both;
}
.sheet-host[hidden] { display: none; }
.sheet-host.is-closing { animation: fade-out .2s ease both; }

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  animation: sheet-up .34s var(--ease-out) both;
  overflow: hidden;
}
.sheet-host.is-closing .sheet { animation: sheet-down .22s ease both; }
@keyframes sheet-up   { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { to { transform: translateY(100%); } }

.sheet__grip {
  width: 42px; height: 4px;
  border-radius: 99px;
  background: var(--border-2);
  margin: 10px auto 4px;
  flex: none;
}
.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px 12px;
  flex: none;
}
.sheet__title { font-size: 1.15rem; font-weight: 800; }
.sheet__body {
  padding: 0 16px calc(var(--safe-b) + 22px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* تبويبات الإنشاء */
.tabs {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 16px;
}
.tab {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: .95rem;
  transition: background .2s, color .2s;
}
.tab[aria-selected="true"] { background: var(--surface-3); color: var(--text); }

/* قوائم الإدارة */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.row__main { flex: 1; min-width: 0; }
.row__name { font-weight: 700; overflow-wrap: anywhere; }
.row__meta { font-size: .76rem; color: var(--muted-2); margin-top: 2px; }
.row__actions { display: flex; gap: 6px; flex: none; }
.row-btn {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-2);
  display: grid; place-items: center;
  font-size: .95rem;
  transition: transform .16s var(--ease-spring), color .18s, border-color .18s;
}
.row-btn:active { transform: scale(.88); }
.row-btn--del:active { color: var(--danger); border-color: var(--danger); }

/* ========================== شاشة الإختيار ============================== */
.filter-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  margin-inline: -16px;
  padding-inline: 16px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.filter-strip::-webkit-scrollbar { display: none; }

.pill-remaining {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(52,224,161,.12);
  color: var(--accent);
  font-weight: 800;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  transition: background .3s, color .3s;
}
.pill-remaining[data-tone="warn"] { background: rgba(255,180,84,.14); color: var(--warn); }
.pill-remaining[data-tone="over"] { background: rgba(255,93,108,.16); color: var(--danger); }
.pill-remaining small { font-size: .72rem; font-weight: 600; opacity: .8; }

.meal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.meal-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 96px;
  padding: 14px;
  text-align: start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  transition: transform .16s var(--ease-spring), border-color .18s;
}
.meal-card:active { transform: scale(.94); border-color: var(--accent); }
.meal-card.is-picked { animation: picked .42s var(--ease-spring); }
@keyframes picked {
  0%   { transform: scale(1); }
  35%  { transform: scale(.9); border-color: var(--accent); }
  100% { transform: scale(1); }
}
.meal-card__name { font-weight: 700; font-size: .98rem; overflow-wrap: anywhere; }
.meal-card__foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.meal-card__cal {
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.meal-card__cat { font-size: .7rem; color: var(--muted-2); }

/* =========================== الإعدادات والمصادر ========================= */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: 0; }
.set-row__label { font-weight: 600; }
.set-row__desc { font-size: .78rem; color: var(--muted-2); margin-top: 2px; }

.switch {
  flex: none;
  width: 52px; height: 31px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
  position: relative;
  transition: background .22s;
}
.switch::after {
  content: "";
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  width: 23px; height: 23px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .22s var(--ease-spring), background .22s;
}
.switch[aria-checked="true"] { background: rgba(52,224,161,.28); border-color: var(--accent); }
.switch[aria-checked="true"]::after { background: var(--accent); transform: translateX(-21px); }

.select {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.src-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.src-item:last-child { border-bottom: 0; }
.src-item__title { font-weight: 800; font-size: .98rem; }
.src-item__used {
  margin-top: 6px;
  font-size: .86rem;
  color: var(--accent);
  line-height: 1.6;
}
.src-item__cite {
  margin-top: 6px;
  font-size: .78rem;
  color: var(--muted);
  direction: ltr;
  text-align: start;
  line-height: 1.55;
}
.src-item__note { margin-top: 6px; font-size: .8rem; color: var(--muted-2); line-height: 1.6; }
.src-item__link {
  display: inline-block;
  margin-top: 8px;
  font-size: .8rem;
  color: var(--info);
  text-decoration: none;
  border-bottom: 1px solid rgba(110,168,254,.35);
}

.math-card {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
}
.math-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: .9rem;
  border-bottom: 1px dashed var(--border);
}
.math-line:last-child { border-bottom: 0; }
.math-line__k { color: var(--muted); }
.math-line__v { font-weight: 700; font-variant-numeric: tabular-nums; }
.math-line--total .math-line__v { color: var(--accent); font-size: 1.15rem; font-weight: 800; }

.disclosure {
  font-size: .82rem;
  color: var(--muted-2);
  line-height: 1.7;
  padding-inline-start: 18px;
  margin: 0;
}
.disclosure li { margin-bottom: 8px; }

/* ============================== التنبيهات =============================== */
.toast-host {
  position: fixed;
  inset-inline: 0;
  inset-block-end: calc(var(--safe-b) + 18px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding-inline: 16px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 460px;
  width: fit-content;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  box-shadow: 0 14px 34px -14px rgba(0,0,0,.95);
  font-size: .9rem;
  font-weight: 600;
  pointer-events: auto;
  animation: toast-in .3s var(--ease-spring) both;
}
.toast.is-out { animation: toast-out .22s ease both; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(.96); } }
.toast--warn  { border-color: rgba(255,180,84,.45); color: #ffd39b; }
.toast--good  { border-color: rgba(52,224,161,.45); color: var(--accent); }
.toast__action {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  font-size: .88rem;
  padding: 2px 4px;
}

/* ============================ المؤثرات ================================= */
.fx-host { position: fixed; inset: 0; z-index: 80; pointer-events: none; }

.fly {
  position: fixed;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--warn);
  text-shadow: 0 4px 18px rgba(0,0,0,.7);
  font-variant-numeric: tabular-nums;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

/* نبضة الدائرة عند الخصم */
.ring-btn.is-hit .ring-face { animation: hit .42s var(--ease-spring); }
@keyframes hit {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.11); }
  100% { transform: scale(1); }
}

/* كنس الدائرة عند تجدد اليوم */
.ring-btn.is-refill .ring-prog { animation: refill .9s var(--ease-out); }
@keyframes refill {
  from { stroke-dashoffset: var(--dash-len); }
}

/* ======================= احترام تقليل الحركة ============================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .ring-halo { opacity: .7; }
}
