/* ==========================================================================
   هوشیار وکیل — سیستمِ طراحی
   --------------------------------------------------------------------------
   چرا CSS دستی و نه Tailwind CDN: این وب‌اپ باید داخلِ ایران و در حالتِ آفلاین
   (PWA + Service Worker) هم بالا بیاید. وابستگی به CDN یعنی صفحه در نبودِ
   دسترسی بی‌استایل می‌شود. پس همان مقیاسِ رنگ و فاصلهٔ Tailwind اینجا به‌صورتِ
   توکنِ CSS بازتولید شده — همان ظاهر، بدونِ وابستگیِ شبکه.

   نگاشتِ توکن‌ها به پالتِ Tailwind:
     --brand-*        → slate-900 / slate-800  (سرمه‌ایِ برند)
     --bg             → slate-50               (پس‌زمینهٔ کم‌خستگی)
     --surface        → white                  (کارت‌ها)
     --line           → slate-200              (حاشیه‌های ظریف)
     --text / --muted → slate-900 / slate-500  (کنتراستِ بالا برای متنِ طولانی)
     --accent         → طلاییِ مات (تأکیدِ بسیار کم‌مصرف)
     --emerald        → سبزِ زمردیِ ملایم (موفقیت)
   ========================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  src: url('./fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('./fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('./fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  --brand-900: #0f172a;
  --brand-800: #1e293b;
  --brand-700: #334155;
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --line:      #e2e8f0;
  --line-soft: #f1f5f9;
  --text:      #0f172a;
  --muted:     #64748b;
  --muted-2:   #94a3b8;
  --accent:    #b48a3f;
  --accent-bg: #fdf8ef;
  --emerald:   #047857;
  --emerald-bg:#ecfdf5;
  --amber:     #b45309;
  --amber-bg:  #fffbeb;
  --danger:    #b91c1c;
  --danger-bg: #fef2f2;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 12px 32px -8px rgb(15 23 42 / 0.14);

  /* فونتِ رابط در برابرِ فونتِ متنِ حقوقی: پاسخِ AI عمداً کمی رسمی‌تر و
     بازتر چیده می‌شود تا حسِ «سند» بدهد، نه حسِ «پیامِ چت». */
  --font-ui:  'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-doc: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; overscroll-behavior-y: none; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; line-height: 1.4; }
p { margin: 0 0 0.75rem; }
a { color: inherit; }

/* دسترس‌پذیری: حلقهٔ فوکوسِ همیشه‌مرئی برای کاربرِ کیبورد */
:focus-visible {
  outline: 2px solid var(--brand-800);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.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;
}

/* ================================================================ چیدمانِ داشبورد
   ساختار: .shell یک ردیفِ flex است — سایدبار و ستونِ محتوا **کنارِ هم**.
   چون سند dir="rtl" است، اولین فرزند (سایدبار) به‌طور طبیعی سمتِ راست می‌نشیند؛
   نیازی به float یا position نیست.

   موبایل (زیر ۱۰۲۴px): سایدبار از جریانِ صفحه خارج و به کشویی تبدیل می‌شود.
   دسکتاپ: سایدبار همیشه دیده می‌شود و محتوا کنارش قرار می‌گیرد، نه زیرش.
   ================================================================ */
.shell {
  display: flex;
  min-height: 100dvh;
  align-items: stretch;
}

/* --- سایدبار --- */
.sidebar {
  display: flex; flex-direction: column;
  width: 280px; flex: 0 0 280px;      /* عرضِ ثابت، بدونِ کش‌آمدن */
  background: var(--surface);
  border-inline-start: 0;
  border-inline-end: 1px solid var(--line);
  padding: 0.75rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  overflow-y: auto;
}

.sidebar__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 1rem; padding: 0.25rem;
}
.sidebar__nav { display: grid; gap: 2px; }
.sidebar__foot {
  margin-top: auto; padding-top: 0.75rem;
  border-top: 1px solid var(--line-soft);
}

/* دکمهٔ بستن فقط در موبایل معنی دارد */
#navClose { display: none; }

/* --- ستونِ محتوا --- */
.content {
  flex: 1 1 auto;
  min-width: 0;                      /* جلوگیری از سرریزِ متنِ طولانی */
  display: flex; flex-direction: column;
  max-width: 860px;                  /* طولِ خطِ خوانا برای متنِ حقوقی */
}

/* --- پردهٔ پشتِ کشوی موبایل --- */
.scrim {
  position: fixed; inset: 0; z-index: 35;
  background: rgb(15 23 42 / 0.45);
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  background: rgb(248 250 252 / 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__title {
  font-size: 0.98rem; font-weight: 700;
  margin-inline-end: auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__burger { display: none; }   /* در دسکتاپ لازم نیست */

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand__mark {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--brand-900); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.brand__name { font-size: 1rem; font-weight: 700; }
.brand__sub { font-size: 0.7rem; color: var(--muted); font-weight: 400; }

.credit-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 0.78rem; font-weight: 500; color: var(--brand-800);
  white-space: nowrap;
}
.credit-chip--vip { border-color: #e7d5ae; background: var(--accent-bg); color: var(--accent); }

.main { flex: 1; padding: 1rem; padding-bottom: 0; }

/* ---------------------------------------------------------------- آیتمِ منو */
.nav__item {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; padding: 0.7rem 0.75rem;
  background: transparent; border: 0; border-radius: var(--r-md);
  font: inherit; color: var(--text); cursor: pointer; text-align: start;
  transition: background-color .18s ease;
}
.nav__item:hover { background: var(--line-soft); }
.nav__item.is-active { background: var(--brand-900); color: #fff; }
.nav__item.is-active small { color: rgb(255 255 255 / 0.62); }
.nav__item b { display: block; font-weight: 500; font-size: 0.92rem; }
.nav__item small { display: block; font-size: 0.75rem; color: var(--muted); }
.nav__icon { font-size: 1.15rem; width: 1.6rem; text-align: center; flex-shrink: 0; }

/* ---------------------------------------------------------------- صفحاتِ قابلیت */
.view { padding-bottom: 1.5rem; }
.view__title { font-size: 1.1rem; margin-bottom: 0.35rem; }
.view__lead { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.1rem; max-width: 60ch; }
.view__out { margin-top: 1rem; }

/* خروجیِ متنیِ قابلیت‌ها — با همان حسِ «سند» */
.doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem;
  font-family: var(--font-doc);
  line-height: 1.95;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 68ch;
}

.case-row {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; text-align: start; font: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 0.8rem 0.9rem;
  margin-bottom: 0.5rem; cursor: pointer; color: var(--text);
  transition: border-color .18s ease;
}
.case-row:hover { border-color: var(--muted-2); }
.case-row__no {
  font-weight: 700; color: var(--accent); white-space: nowrap; font-size: 0.85rem;
}
.case-row__title { flex: 1; font-size: 0.9rem; }
.case-row__date { font-size: 0.72rem; color: var(--muted-2); white-space: nowrap; }

/* ---------------------------------------------------------------- دکمه‌ها */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.65rem 1.1rem;
  font: inherit; font-weight: 500;
  border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, opacity .18s ease;
  min-height: 44px;            /* هدفِ لمسیِ استانداردِ موبایل */
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--brand-900); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-800); }

.btn--ghost { background: transparent; color: var(--brand-700); border-color: transparent; }
.btn--ghost:hover:not(:disabled) { background: var(--line-soft); }

.btn--outline { background: var(--surface); color: var(--brand-800); border-color: var(--line); }
.btn--outline:hover:not(:disabled) { border-color: var(--muted-2); }

.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* ---------------------------------------------------------------- کارت‌ها */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

/* ---------------------------------------------------------------- فرم */
.field { margin-bottom: 1rem; }
.label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.4rem; color: var(--brand-800); }
.hint  { font-size: 0.78rem; color: var(--muted); margin-top: 0.4rem; }

.input, .textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-700);
  box-shadow: 0 0 0 3px rgb(51 65 85 / 0.10);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }

/* شمارهٔ موبایل و کدِ OTP همیشه چپ‌چین و لاتین بمانند */
.input--ltr { direction: ltr; text-align: left; letter-spacing: 0.05em; }
.input--otp { direction: ltr; text-align: center; font-size: 1.5rem; letter-spacing: 0.6em;
              padding-inline-start: 0.6em; font-weight: 700; }

/* ================================================================ چت */
.chat { display: flex; flex-direction: column; gap: 1.1rem; padding-bottom: 1rem; }

/* حبابِ کاربر — ساده و کوچک، عمداً کم‌وزن‌تر از پاسخ */
.msg--user {
  align-self: flex-start;
  max-width: 85%;
  background: var(--brand-900); color: #fff;
  padding: 0.7rem 1rem;
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) var(--r-sm);
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap; word-break: break-word;
}

/* پاسخِ AI — بلوکِ رسمیِ شبیه سند، نه حبابِ چت */
.answer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  font-family: var(--font-doc);
}
.answer__head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem; color: var(--muted); font-weight: 500;
}
.answer__body {
  padding: 1.1rem;
  /* طولِ بهینهٔ خط برای مطالعهٔ طولانیِ متنِ حقوقی */
  max-width: 68ch;
  line-height: 1.9;
}
.answer__section { margin-bottom: 1.25rem; }
.answer__section:last-child { margin-bottom: 0; }
.answer__title {
  font-size: 0.75rem; font-weight: 700; color: var(--muted);
  letter-spacing: 0.06em; margin-bottom: 0.5rem;
}
.answer__issue { font-weight: 500; color: var(--brand-800); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step {
  position: relative;
  padding-inline-start: 2rem;
  padding-bottom: 1rem;
  counter-increment: step;
}
.step:last-child { padding-bottom: 0; }
.step::before {
  content: counter(step);
  position: absolute; inset-inline-start: 0; top: 0.15rem;
  width: 1.4rem; height: 1.4rem;
  display: grid; place-items: center;
  background: var(--line-soft); color: var(--brand-700);
  border-radius: 50%; font-size: 0.72rem; font-weight: 700;
}

/* --- استنادها: تگِ متمایز و قابلِ کلیک --- */
.cites { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.cite {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  background: var(--accent-bg);
  border: 1px solid #ecdcbd;
  border-radius: var(--r-sm);
  color: #8a6a2f;
  font-size: 0.76rem; font-weight: 500;
  cursor: pointer; font-family: var(--font-ui);
  transition: background-color .18s ease, border-color .18s ease;
}
.cite:hover { background: #faf1e2; border-color: var(--accent); }
.cite__icon { opacity: 0.75; }

/* --- نشانِ راستی‌آزمایی --- */
.verdict {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 0.45rem; padding: 0.18rem 0.5rem;
  border-radius: var(--r-sm);
  font-size: 0.74rem; font-weight: 500;
}
.verdict--partial { background: var(--amber-bg); color: var(--amber); }
.verdict--none    { background: var(--danger-bg); color: var(--danger); }
.verdict--unver   { background: var(--line-soft); color: var(--muted); }

.notice {
  border-radius: var(--r-md);
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  border: 1px solid;
}
.notice--warn   { background: var(--amber-bg);  border-color: #fde68a; color: #92400e; }
.notice--danger { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }
.notice--info   { background: var(--surface);   border-color: var(--line); color: var(--muted); }
.notice--ok     { background: var(--emerald-bg);border-color: #a7f3d0; color: var(--emerald); }

.answer__foot {
  padding: 0.7rem 1rem;
  background: var(--line-soft);
  border-top: 1px solid var(--line);
  font-size: 0.72rem; color: var(--muted); line-height: 1.6;
}

/* سؤالاتِ روشن‌کنندهٔ مرحلهٔ intake */
.clarify { border-inline-start: 3px solid var(--accent); }
.clarify ol { margin: 0.5rem 0 0; padding-inline-start: 1.2rem; }
.clarify li { margin-bottom: 0.4rem; }

/* ---------------------------------------------------------------- نوارِ ورودی */
.composer {
  position: sticky; bottom: 0; z-index: 20;
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  background: rgb(248 250 252 / 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.composer__box {
  display: flex; align-items: flex-end; gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 0.4rem 0.4rem 0.4rem 0.4rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.composer__box:focus-within {
  border-color: var(--brand-700);
  box-shadow: 0 0 0 3px rgb(51 65 85 / 0.08);
}
.composer__input {
  flex: 1; border: 0; outline: none; resize: none;
  background: transparent; font: inherit; color: var(--text);
  padding: 0.55rem 0.6rem;
  max-height: 40vh; line-height: 1.7;
}
.composer__input::placeholder { color: var(--muted-2); }
.composer__send {
  width: 40px; height: 40px; flex-shrink: 0;
  border: 0; border-radius: 50%;
  background: var(--brand-900); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  transition: background-color .18s ease, opacity .18s ease;
}
.composer__send:disabled { opacity: 0.35; cursor: not-allowed; }
.composer__send:hover:not(:disabled) { background: var(--brand-800); }
.composer__meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.45rem; font-size: 0.72rem; color: var(--muted);
}

/* ---------------------------------------------------------------- حالت‌ها */
.empty { text-align: center; padding: 2.5rem 1rem; }
.empty__mark {
  width: 56px; height: 56px; margin: 0 auto 1rem;
  border-radius: var(--r-lg);
  background: var(--brand-900); color: #fff;
  display: grid; place-items: center;
}
.empty h2 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.empty p  { color: var(--muted); font-size: 0.88rem; max-width: 40ch; margin-inline: auto; }

.suggestions { display: grid; gap: 0.5rem; margin-top: 1.5rem; text-align: start; }
.suggestion {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 0.8rem 0.95rem;
  cursor: pointer; font: inherit; color: var(--brand-800);
  transition: border-color .18s ease, box-shadow .18s ease;
  text-align: start;
}
.suggestion:hover { border-color: var(--muted-2); box-shadow: var(--shadow-sm); }

/* اسکلتِ بارگذاری — ظریف، بدونِ انیمیشنِ پرزرق‌وبرق */
.thinking {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--muted); font-size: 0.85rem; padding: 0.5rem 0;
}
.dots { display: inline-flex; gap: 3px; }
.dots i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--muted-2);
  animation: pulse 1.4s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%,60%,100% { opacity:.3 } 30% { opacity:1 } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- شیت/مودال */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgb(15 23 42 / 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 780px;
  max-height: 85dvh; overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}
.sheet__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.sheet__title { font-size: 1.05rem; }
.sheet__close {
  border: 0; background: transparent; cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--r-md); color: var(--muted);
  display: grid; place-items: center;
}
.sheet__close:hover { background: var(--line-soft); }

/* متنِ کاملِ ماده در شیتِ استناد */
.law-text {
  font-family: var(--font-doc);
  background: var(--bg);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 1rem;
  line-height: 2;
  white-space: pre-wrap;
  max-width: 68ch;
}

/* ---------------------------------------------------------------- پلن‌ها */
.plans { display: grid; gap: 0.75rem; }
.plan {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 1rem;
  cursor: pointer; text-align: start; width: 100%; font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.plan:hover { border-color: var(--muted-2); box-shadow: var(--shadow-sm); }
.plan--highlight { border-color: #e7d5ae; background: var(--accent-bg); }
.plan__info { flex: 1; }
.plan__title { font-weight: 700; }
.plan__sub { font-size: 0.8rem; color: var(--muted); }
.plan__price { font-weight: 700; white-space: nowrap; color: var(--brand-900); }
.plan__price small { font-weight: 400; color: var(--muted); font-size: 0.75rem; }

/* ---------------------------------------------------------------- صفحاتِ مستقل */
.page {
  min-height: 100dvh; display: grid; place-items: center;
  padding: 1.25rem; padding-top: max(1.25rem, env(safe-area-inset-top));
}
.page__card { width: 100%; max-width: 400px; }
.page__mark {
  width: 52px; height: 52px; margin: 0 auto 1.25rem;
  border-radius: var(--r-lg); background: var(--brand-900); color: #fff;
  display: grid; place-items: center;
}
.page h1 { font-size: 1.2rem; text-align: center; margin-bottom: 0.4rem; }
.page__lead { text-align: center; color: var(--muted); font-size: 0.87rem; margin-bottom: 1.5rem; }

.result-mark {
  width: 64px; height: 64px; margin: 0 auto 1.25rem;
  border-radius: 50%; display: grid; place-items: center;
}
.result-mark--ok   { background: var(--emerald-bg); color: var(--emerald); }
.result-mark--fail { background: var(--danger-bg);  color: var(--danger); }

.kv { display: flex; justify-content: space-between; gap: 1rem;
      padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); font-size: 0.87rem; }
.kv:last-child { border-bottom: 0; }
.kv__k { color: var(--muted); }
.kv__v { font-weight: 500; }

.toast {
  position: fixed; z-index: 60;
  bottom: max(1rem, env(safe-area-inset-bottom)); inset-inline: 1rem;
  max-width: 420px; margin-inline: auto;
  background: var(--brand-900); color: #fff;
  padding: 0.8rem 1rem; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); font-size: 0.87rem;
}
.toast--error { background: var(--danger); }

@media (min-width: 640px) {
  body { font-size: 15.5px; }
  .main { padding: 1.5rem; }
  .sheet { border-radius: var(--r-xl); margin-bottom: 2rem; }
  .sheet-backdrop { align-items: center; padding: 1rem; }
}

/* ================================================================ موبایل و تبلت
   زیرِ ۱۰۲۴px سایدبار از جریانِ صفحه بیرون می‌رود و کشویی می‌شود.
   نکتهٔ کلیدی: position:fixed فقط **در همین بازه** اعمال می‌شود؛ در دسکتاپ
   سایدبار یک آیتمِ عادیِ flex است و هرگز روی محتوا نمی‌افتد.
   ================================================================ */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0;
    z-index: 40;
    width: min(300px, 84vw); flex-basis: auto;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);          /* RTL: بیرون از لبهٔ راست */
    transition: transform .22s ease;
    visibility: hidden;
  }
  body.nav-open .sidebar { transform: translateX(0); visibility: visible; }

  #navClose { display: grid; }
  .topbar__burger { display: grid; }
  .content { max-width: none; }
}

/* در دسکتاپ پرده هیچ‌وقت نباید دیده شود */
@media (min-width: 1024px) {
  .scrim { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
