/* ============================================================
   خاطرات یک تحلیلگر | Trader's Diary — استایل اصلی
   ------------------------------------------------------------
   بخش‌های این فایل:
   ۱) متغیرهای ۴ تم اختصاصی (CSS Variables)
   ۲) ریست و پایه (Reset / Base)
   ۳) اجزای عمومی (دکمه، کارت، ورودی، کلید سوییچ، ...)
   ۴) هدر و خوش‌آمدگویی
   ۵) باکس حدیث
   ۶) تب‌ها و نوار پایین
   ۷) کارت‌های قیمت بازار
   ۸) گزارش‌ساز
   ۹) پروفایل و امنیت
   ۱۰) صفحه قفل (Lock Screen)
   ۱۱) Toast و انیمیشن‌ها
   ۱۲) واکنش‌گرایی (Media Queries) و دسترس‌پذیری
============================================================ */

/* ============================================================
   ۱) سیستم ۴ تم — با تغییر attribute ای `data-theme` روی <html>
   کل برنامه بدون رفرش تغییر ظاهر می‌دهد.
============================================================ */
:root,
:root[data-theme="light"] {
  /* تم روشن: Clean Light */
  --bg-1: #eef2f7;
  --bg-2: #f8f5ef;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --text: #0f1c2e;
  --muted: #5d6b82;
  --accent: #0d9488;          /* فیروزه‌ای-سبز (رنگ اصلی) */
  --accent-2: #6366f1;        /* رنگ مکمل */
  --accent-soft: rgba(13, 148, 136, 0.12);
  --gold: #b8860b;
  --header-grad: linear-gradient(135deg, #0f766e 0%, #115e59 55%, #134e4a 100%);
  --header-text: #ffffff;
  --border: rgba(15, 28, 46, 0.09);
  --shadow: 0 10px 30px rgba(20, 45, 90, 0.10);
  --shadow-soft: 0 4px 14px rgba(20, 45, 90, 0.07);
  --up: #dc2626;              /* رشد (قرمز — عرف بازار ایران) */
  --down: #16a34a;            /* افت (سبز) */
  --up-soft: rgba(220, 38, 38, 0.10);
  --down-soft: rgba(22, 163, 74, 0.10);
  --nav-bg: rgba(255, 255, 255, 0.86);
  --danger: #dc2626;
  --ring: rgba(13, 148, 136, 0.45);
}

:root[data-theme="dark"] {
  /* تم تاریک: Dark Mode */
  --bg-1: #0a1120;
  --bg-2: #0e1730;
  --surface: #111a2e;
  --surface-2: #0d1526;
  --surface-glass: rgba(17, 26, 46, 0.78);
  --text: #e6edf7;
  --muted: #8fa0b8;
  --accent: #2dd4bf;
  --accent-2: #818cf8;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --gold: #d4af37;
  --header-grad: linear-gradient(135deg, #0b1226 0%, #101c38 60%, #131f42 100%);
  --header-text: #eaf2ff;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.35);
  --up: #f87171;
  --down: #4ade80;
  --up-soft: rgba(248, 113, 113, 0.12);
  --down-soft: rgba(74, 222, 128, 0.12);
  --nav-bg: rgba(13, 21, 38, 0.82);
  --danger: #f87171;
  --ring: rgba(45, 212, 191, 0.5);
}

:root[data-theme="luxury"] {
  /* تم بلومبرگ: مشکی / سفید / قرمز سلطنتی — به‌جای طلایی پررنگ قبلی */
  --bg-1: #08080a;
  --bg-2: #101014;
  --surface: #131317;
  --surface-2: #1b1b20;
  --surface-glass: rgba(19, 19, 23, 0.82);
  --text: #f4f4f6;
  --muted: #90909a;
  --accent: #e03232;           /* قرمز سلطنتی */
  --accent-2: #b91c1c;         /* قرمز تیره برای گرادیان */
  --accent-soft: rgba(224, 50, 50, 0.13);
  --gold: #e8e3d8;             /* عاجی ملایم (به‌جای طلای تند) */
  --header-grad: linear-gradient(135deg, #0a0a0c 0%, #141418 55%, #1a1a1f 100%);
  --header-text: #ffffff;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.62);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.48);
  --up: #ff5252;               /* قرمز روشن برای رشد */
  --down: #2fbf71;             /* سبز ملایم برای افت */
  --up-soft: rgba(255, 82, 82, 0.13);
  --down-soft: rgba(47, 191, 113, 0.13);
  --nav-bg: rgba(11, 11, 14, 0.85);
  --danger: #ff5252;
  --ring: rgba(224, 50, 50, 0.5);
}

:root[data-theme="royal"] {
  /* تم سبز سلطنتی: Royal Green */
  --bg-1: #04120c;
  --bg-2: #08251a;
  --surface: #0c2b1e;
  --surface-2: #103727;
  --surface-glass: rgba(12, 43, 30, 0.80);
  --text: #e9f7ef;
  --muted: #8fb8a5;
  --accent: #2fd48a;           /* زمردی درخشان */
  --accent-2: #c9a13b;         /* طلای سلطنتی */
  --accent-soft: rgba(47, 212, 138, 0.14);
  --gold: #d4af37;
  --header-grad: linear-gradient(135deg, #04231a 0%, #0a3d2a 55%, #0d4d33 100%);
  --header-text: #eafff5;
  --border: rgba(47, 212, 138, 0.18);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.55), 0 0 24px rgba(47, 212, 138, 0.07);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.4);
  --up: #f1846a;
  --down: #5fd69a;
  --up-soft: rgba(241, 132, 106, 0.14);
  --down-soft: rgba(95, 214, 154, 0.14);
  --nav-bg: rgba(6, 30, 21, 0.85);
  --danger: #f1846a;
  --ring: rgba(47, 212, 138, 0.5);
}

/* ============================================================
   ۲) ریست و پایه
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Vazirmatn', 'IRANSans', 'Iranian Sans', 'Segoe UI', Tahoma, Arial, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.75;
  overflow-x: hidden;
  transition: background 0.45s ease, color 0.45s ease;
  -webkit-font-smoothing: antialiased;
}

/* انتقال نرم رنگ‌ها هنگام تغییر تم */
body, .app-header, .hadith-card, .card, .bottom-nav, .lock-overlay,
.btn, .input, .select, .theme-btn, .nav-btn, .toast, .data-status {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
img, svg { display: block; }

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

.icon { width: 20px; height: 20px; flex: none; }

.app {
  max-width: 760px;
  margin-inline: auto;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ============================================================
   ۳) اجزای عمومی
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.4;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.3s ease, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-primary:not(:disabled):hover { box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 55%, transparent); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: var(--up-soft);
  color: var(--up);
  border: 1px solid color-mix(in srgb, var(--up) 35%, transparent);
}
.btn-block { width: 100%; }

/* چرخش آیکون هنگام به‌روزرسانی */
.btn .icon.spinning { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* کارت */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}
.card-title { font-size: 1.02rem; font-weight: 800; margin-bottom: 6px; }
.card-desc { font-size: 0.85rem; color: var(--muted); }
.card-desc.tiny { font-size: 0.75rem; opacity: 0.85; margin-top: 8px; }

/* ورودی‌ها */
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--muted); opacity: 0.7; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 40px;
  cursor: pointer;
}

/* کلید سوییچ (Toggle) */
.switch { position: relative; display: inline-block; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: 0.3s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--muted);
  top: 3px; inset-inline-start: 4px;
  transition: 0.3s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before {
  transform: translateX(-21px);
  background: #fff;
}
/* در RTL، جابه‌جایی سوییچ برعکس است */
html[dir="rtl"] .switch input:checked + .slider::before { transform: translateX(21px); }

.link-btn {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent); }

/* ============================================================
   ۴) هدر و خوش‌آمدگویی
============================================================ */
.app-header {
  background: var(--header-grad);
  color: var(--header-text);
  border-radius: 0 0 34px 34px;
  padding: calc(18px + env(safe-area-inset-top)) 18px 46px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 25%, transparent);
}
/* هاله‌های تزئینی هدر */
.app-header::before, .app-header::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.35;
  pointer-events: none;
}
.app-header::before {
  width: 220px; height: 220px;
  background: radial-gradient(circle, var(--gold), transparent 70%);
  top: -90px; inset-inline-start: -60px;
}
.app-header::after {
  width: 180px; height: 180px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  bottom: -80px; inset-inline-end: -40px;
}
.header-inner { position: relative; z-index: 1; }

.greeting-row { display: flex; align-items: center; gap: 14px; }

.avatar {
  width: 52px; height: 52px;
  flex: none;
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent-2) 55%, transparent);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.avatar-lg { width: 74px; height: 74px; border-radius: 24px; font-size: 2rem; }

.greeting { font-size: 1.12rem; font-weight: 800; line-height: 1.6; }
.header-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem;
  opacity: 0.88;
}
.clock {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  background: rgba(255, 255, 255, 0.14);
  padding: 1px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.dot-sep { opacity: 0.5; }

/* انتخابگر تم — ۴ دکمه */
.theme-switcher {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px;
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
.theme-btn {
  padding: 8px 4px;
  border-radius: 12px;
  font-size: 1.05rem;
  color: var(--header-text);
  opacity: 0.72;
  transition: 0.25s;
}
.theme-btn:hover { opacity: 1; transform: translateY(-1px); }
.theme-btn.is-active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

/* ============================================================
   ۵) باکس حدیث روز
============================================================ */
.hadith-card {
  position: relative;
  z-index: 2;
  margin: -26px 14px 0;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.hadith-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.hadith-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.2px;
}
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: 0.2s;
}
.icon-btn:hover { transform: rotate(25deg) scale(1.05); }
.icon-btn:active { transform: scale(0.9); }
.hadith-text {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 2.1;
  color: var(--text);
}
.hadith-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.hadith-source {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 12px;
  border-radius: 999px;
}
.hadith-tag {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  padding: 2px 10px;
  border-radius: 999px;
}

/* انیمیشن ورود حدیث */
.hadith-enter { animation: hadithIn 0.5s ease; }
@keyframes hadithIn {
  from { opacity: 0; transform: translateY(10px); filter: blur(3px); }
  to   { opacity: 1; transform: translateY(0);  filter: blur(0); }
}

/* ============================================================
   ۶) تب‌ها و نوار پایین
============================================================ */
.main { padding: 20px 14px 0; }

/* ===== فوتر: کپیرایت و کانال ایتا ===== */
.app-footer {
  text-align: center;
  padding: 26px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.footer-eitaa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 9px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  transition: 0.25s;
}
.footer-eitaa .icon { width: 17px; height: 17px; }
.footer-eitaa b { color: var(--accent); font-weight: 800; }
.footer-eitaa:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.footer-copy {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.85;
}

.tab { animation: tabIn 0.35s ease; }
.tab[hidden] { display: none; }
@keyframes tabIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tab-title { font-size: 1.25rem; font-weight: 900; }
.tab-sub { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* نوار پایین — شناور و شیشه‌ای */
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline: 12px;
  margin-inline: auto;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 456px;
  margin-bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 8px;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.18), var(--shadow-soft);
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 6px;
  border-radius: 16px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  transition: 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn .icon { width: 22px; height: 22px; }
.nav-btn.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.nav-btn.is-active .icon { filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--accent) 50%, transparent)); }

/* ============================================================
   ۷) کارت‌های قیمت بازار
============================================================ */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: cardIn 0.4s ease backwards;
  position: relative;
  overflow: hidden;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.price-card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.price-card .name {
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.price-card .icon-badge {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  background: var(--accent-soft);
}
.price-card .value {
  font-size: 1.18rem;
  font-weight: 900;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: left;
  white-space: nowrap;
}
.price-card .unit {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}
.price-card .delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  width: fit-content;
  direction: ltr;
}
.price-card .delta.up   { background: var(--up-soft);   color: var(--up); }
.price-card .delta.down { background: var(--down-soft); color: var(--down); }
.price-card .delta.flat { background: var(--accent-soft); color: var(--muted); }
.price-card .note {
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.price-card .note .src-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
}
.src-live   { background: var(--down); }
.src-est    { background: var(--gold); }
.src-cache  { background: var(--muted); }
.src-demo   { background: var(--up); }

/* فلش رنگی هنگام تغییر مقدار */
.price-card.flash-up { animation: flashUp 0.8s ease; }
.price-card.flash-down { animation: flashDown 0.8s ease; }
@keyframes flashUp {
  0% { background: var(--up-soft); box-shadow: 0 0 0 3px var(--up-soft); }
  100% { background: var(--surface); }
}
@keyframes flashDown {
  0% { background: var(--down-soft); box-shadow: 0 0 0 3px var(--down-soft); }
  100% { background: var(--surface); }
}

/* حالت «در حال بارگذاری» — چشمک‌زن */
.price-card.loading .value { color: transparent; position: relative; }
.price-card.loading .value::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 14px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--accent) 20%, var(--surface-2)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* بنر وضعیت داده */
.data-status {
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.data-status[hidden] { display: none; }
.data-status.ok   { background: var(--down-soft); color: var(--down); }
.data-status.warn { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.data-status.err  { background: var(--up-soft); color: var(--up); }
.data-status.info { background: var(--accent-soft); color: var(--accent); }

/* راهنمای رنگ تغییرات */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 0.72rem;
  color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-up { background: var(--up); }
.dot-down { background: var(--down); }

/* ============================================================
   ۸) بانک داده قیمت‌ها
============================================================ */
.btn-sm {
  padding: 8px 14px;
  font-size: 0.78rem;
  border-radius: 12px;
  flex: none;
}

.db-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.db-head .card-desc { font-size: 0.78rem; }
.db-head .card-desc b { color: var(--accent); }

.db-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.db-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.db-pill.ok { background: var(--down-soft); color: var(--down); }

.db-last {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 12px;
}
.db-last b { color: var(--text); }

.db-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}
.db-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.db-table th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  padding: 9px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.db-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.db-table tr:last-child td { border-bottom: none; }
.db-table td.num {
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.db-table td.db-src { color: var(--muted); font-weight: 500; }

.db-empty {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 2;
}
.db-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.db-hint { font-size: 0.72rem; color: var(--muted); }

/* ============================================================
   ۹) گزارش‌ساز
============================================================ */
.report-controls { display: flex; flex-direction: column; gap: 12px; }

.report-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.report-actions .btn:first-child { grid-column: 1 / -1; }

.report-paper {
  background: var(--surface-2);
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  padding: 0;
  overflow: hidden;
}
.report-text {
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 2.1;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 18px;
  min-height: 220px;
  max-height: 60vh;
  overflow-y: auto;
}

/* ============================================================
   ۹) پروفایل و امنیت
============================================================ */
.profile-row { display: flex; gap: 16px; align-items: flex-start; }
.profile-fields { flex: 1; }

.sec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

/* انتخاب نوع کلیدواژه */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 12px;
}
.seg-item { position: relative; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 6px;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s;
}
.seg-item input:checked + span {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 12px;
}
.manage-label { font-size: 0.85rem; font-weight: 700; }
.lock-setup .input:last-of-type { margin-bottom: 12px; }
.lock-manage { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
   ۱۰) صفحه قفل (Lock Screen)
============================================================ */
.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background:
    radial-gradient(700px 400px at 50% -5%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
}
.lock-overlay[hidden] { display: none; }

.lock-glow {
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%);
  top: 12%; inset-inline-end: -120px;
  pointer-events: none;
}

.lock-box {
  position: relative;
  width: 100%;
  max-width: 340px;
  text-align: center;
  animation: lockIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes lockIn {
  from { opacity: 0; transform: translateY(26px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lock-logo {
  width: 84px; height: 84px;
  margin: 0 auto 14px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--gold);
  background:
    radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--gold) 30%, transparent), transparent 60%),
    var(--surface);
  border: 2px solid color-mix(in srgb, var(--gold) 55%, transparent);
  box-shadow: var(--shadow), 0 0 34px color-mix(in srgb, var(--gold) 22%, transparent);
}
.lock-title { font-size: 1.3rem; font-weight: 900; margin-bottom: 4px; }
.lock-sub { font-size: 0.82rem; color: var(--muted); margin-bottom: 22px; }

/* نقطه‌های پین */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  min-height: 18px;
  margin-bottom: 20px;
}
.pin-dots .dot-slot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: 0.2s;
}
.pin-dots .dot-slot.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.15);
}
.pin-dots .dot-slot.error { background: var(--up); border-color: var(--up); }

/* کیپد عددی */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 280px;
  margin-inline: auto;
}
.keypad .key {
  height: 62px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  transition: 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.keypad .key:active { transform: scale(0.92); background: var(--accent-soft); }
.keypad .key.key-back { font-size: 1.1rem; color: var(--up); }
.keypad .key.key-biometric { font-size: 1.2rem; }

.lock-error { color: var(--up); font-size: 0.82rem; font-weight: 700; min-height: 20px; margin-top: 14px; }
.lock-cooldown { color: var(--gold); font-size: 0.8rem; font-weight: 700; }
.lock-box .link-btn { display: block; margin: 14px auto 0; }

/* تکان خوردن هنگام خطا */
.shake { animation: shake 0.45s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ============================================================
   ۱۱) Toast و انیمیشن‌ها
============================================================ */
.toast {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom));
  inset-inline: 0;
  margin-inline: auto;
  width: fit-content;
  max-width: calc(100% - 40px);
  z-index: 2000;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }

/* ============================================================
   ۱۲) واکنش‌گرایی و دسترس‌پذیری
============================================================ */
@media (min-width: 640px) {
  .market-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .hadith-card { margin-inline: 0; }
  .main { padding-inline: 0; }
  .app-header { padding-inline: 26px; }
  .report-actions { grid-template-columns: repeat(3, 1fr); }
  .report-actions .btn:first-child { grid-column: auto; }
  .price-card .value { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* اسکرول‌بار ظریف */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }
