/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding-inline: var(--s-5);
  border: 1px solid transparent; border-radius: var(--r-pill);
  font-weight: 600; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-soft { background: var(--warm); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--accent); min-height: 44px; }
.btn-outline { background: var(--white); border-color: var(--accent); color: var(--ink); min-height: 44px; padding-inline: var(--s-3); font-size: 0.875rem; }
.btn-danger { background: var(--white); border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn-dashed { background: transparent; border: 1px dashed var(--accent); color: var(--ink); min-height: 44px; padding-inline: var(--s-3); font-size: 0.875rem; }
.btn:disabled { cursor: not-allowed; opacity: 0.7; }

/* ---------- رأس الشاشة ---------- */
.topbar { display: flex; align-items: center; justify-content: flex-start; min-height: 48px; gap: var(--s-4); }
.back { display: inline-flex; align-items: center; gap: var(--s-1); background: none; border: 0; color: var(--accent); min-height: 44px; font-weight: 500; }
.back .chev { font-size: 1.5rem; line-height: 1; }
.topbar-title { color: var(--muted); font-size: 0.9375rem; }

/* ---------- تقدّم وأسئلة ---------- */
.progress { display: flex; gap: 2px; height: 6px; }
.progress span { flex: 1; background: var(--line); border-radius: var(--r-pill); }
.progress span.on { background: var(--accent); }
.section-tag { font-size: 0.8125rem; font-weight: 700; color: var(--ink); }
.q-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.q-head h1 { font-size: 1.5rem; }
.pill-unsure { flex: none; }
.choices { border-block-start: 1px solid var(--line); }
.choice {
  display: block; width: 100%; text-align: start; background: none; border: 0;
  border-block-end: 1px solid var(--line); padding: var(--s-2) var(--s-2); min-height: 44px;
}
.choice { border-inline-start: 4px solid transparent; }
.choice[aria-checked="true"] { background: var(--tint); font-weight: 600; border-inline-start-color: var(--ink); }
.footer-bar {
  margin-block-start: auto;
  position: sticky; inset-block-end: 0; background: var(--white); border-block-start: 1px solid var(--line);
  padding: var(--s-3) var(--s-4) var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); align-items: stretch; text-align: center;
}
.screen.with-tabs .footer-bar { inset-block-end: var(--tab-h); }

/* ---------- بطاقات ---------- */
.card { background: var(--page); border-radius: var(--r-lg); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.card.warm { background: var(--warm); }
.card.soft { background: var(--soft); }
.step-card { background: var(--page); }
.welcome { padding-block-start: 88px; gap: var(--s-4); }
.welcome h1 { font-size: 2rem; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card h2 { font-size: 1.0625rem; }
.notice { border-radius: var(--r-md); padding: var(--s-3) var(--s-4); background: var(--warn-bg); color: var(--warn-ink); }
.notice strong { display: block; }
.notice.stop { background: var(--warm); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; min-height: 28px; padding-inline: var(--s-3); border-radius: var(--r-pill); background: var(--tint); color: var(--ink); font-size: 0.8125rem; }
.chip.dashed { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.chip.reviewed { background: #e4efe8; color: var(--ok); }
.chip.suggested { background: var(--warn-bg); color: var(--warn-ink); }
.chip.unclassified { background: var(--line); color: var(--muted); }
.toggle-chip { min-height: 44px; border: 1px solid var(--line); background: var(--white); border-radius: var(--r-pill); padding-inline: var(--s-4); }
.toggle-chip[aria-pressed="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.day-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s-1); }
.day-row .toggle-chip { padding-inline: 0; min-width: 0; }
.details { border-block-start: 1px solid var(--line); padding-block-start: var(--s-2); }
.row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.row.ruled { align-items: center; border-block-start: 1px solid var(--line); padding-block: var(--s-2); }
.plain-btn { display: block; width: 100%; padding: 0; background: none; border: 0; text-align: start; color: inherit; }
.h-md { font-size: 1.25rem; }
.sheet-body { display: flex; flex-direction: column; gap: var(--s-4); }
.icon-btn { flex: none; width: 44px; height: 44px; border-radius: var(--r-sm); border: 0; background: var(--white); font-size: 1.25rem; }
.ul-list > li + li { margin-block-start: var(--s-3); }
.ul-list { padding-inline-start: 0; }
.ul-list li::before { content: "• "; color: var(--accent); }

/* ---------- حالات: تحميل / فارغ / فشل ---------- */
.state { text-align: center; padding: var(--s-6) var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); align-items: center; border-radius: var(--r-lg); background: var(--page); }
.state.error { background: var(--danger-bg); color: var(--danger); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { background: var(--warn-bg); color: var(--warn-ink); padding: var(--s-2) var(--s-4); font-size: 0.875rem; text-align: center; }

/* ---------- شريط التبويب ---------- */
.tabbar {
  position: fixed; inset-block-end: 0; inset-inline: 0; max-width: var(--shell); margin-inline: auto; height: var(--tab-h);
  display: flex; background: var(--white); border-block-start: 1px solid var(--line); z-index: 5;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 0.75rem; min-width: 0; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tab .glyph { font-size: 1.25rem; line-height: 1; }

/* ---------- ورقة سفلية ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(63, 43, 78, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: var(--shell); max-height: 90dvh; overflow-y: auto; background: var(--white); border-start-start-radius: var(--r-lg); border-start-end-radius: var(--r-lg); padding: var(--s-5) var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }

/* ---------- بحث ---------- */
.search { display: flex; gap: var(--s-2); }
.search input { flex: 1; min-width: 0; min-height: 48px; border: 1px solid var(--muted); border-radius: var(--r-pill); padding-inline: var(--s-4); background: var(--white); }
.product { display: flex; flex-direction: column; gap: var(--s-2); background: var(--page); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); }
.product-title { font-weight: 600; overflow-wrap: anywhere; }
.product-brand { color: var(--muted); font-size: 0.875rem; }
.list-gap > li + li { margin-block-start: var(--s-3); }

/* ---------- اليوم ---------- */
.dose { display: flex; align-items: center; gap: var(--s-3); background: var(--page); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); min-height: 56px; }
.dose input { width: 24px; height: 24px; accent-color: var(--ink); flex: none; }
.dose.done { opacity: 0.7; }
.dose.done strong { text-decoration: line-through; }
.dose-copy { display: flex; flex-direction: column; min-width: 0; }
.welcome-mark { width: 56px; height: 56px; border-radius: var(--r-md); background: var(--tint); display: grid; place-items: center; font-size: 1.75rem; color: var(--ink); }

@media (max-width: 340px) {
  .screen { padding: var(--s-3); }
  h1 { font-size: 1.5rem; }
  .q-head h1 { font-size: 1.3125rem; }
  .btn { padding-inline: var(--s-4); }
  .toggle-chip { padding-inline: var(--s-3); }
}
.choice-stack { display: flex; flex-direction: column; gap: var(--s-3); }
.choice-stack .btn-outline { min-height: 48px; font-size: 1rem; padding-inline: var(--s-5); }

/* ---------- إفصاح (details) ---------- */
.disclosure { background: var(--page); border-radius: var(--r-md); }
.disclosure > summary { list-style: none; cursor: pointer; min-height: 48px; padding: var(--s-3) var(--s-4); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); font-weight: 600; border-radius: var(--r-md); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: "+"; font-size: 1.25rem; line-height: 1; color: var(--accent); flex: none; }
.disclosure[open] > summary::after { content: "−"; }
.disclosure-body { padding: 0 var(--s-4) var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.extra { display: flex; flex-direction: column; gap: var(--s-2); padding-block-start: var(--s-2); }
.extra h3 { font-size: 1rem; }
.first-step h3 { font-size: 1.125rem; }

/* ---------- تباين وتركيز ---------- */
::placeholder { color: var(--muted); opacity: 1; }
.tab:focus-visible, .disclosure > summary:focus-visible, .choice:focus-visible { outline-offset: -3px; }
.link-note { color: var(--ink); }
.product a, .state a, .notice a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.group-title { font-size: 1rem; color: var(--ink); margin-block-start: var(--s-2); }

/* روابط المصدر: هدف لمس كافٍ دون تغيير ارتفاع السطر */
.source-line a { display: inline-block; padding: 13px 4px; margin: -13px -4px; }
/* عرض 320: أزرار الأيام السبعة تبقى 40px على الأقل عرضًا */
@media (max-width: 360px) {
  .sheet { padding-inline: var(--s-3); }
  .day-row { gap: 2px; }
}
.link-block { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; }
