/* =====================================================================
 * رصدخانه جنگ — استایل‌ها
 * تم تاریک «Ops Room» + تم روشن با CSS variables
 * ===================================================================== */

/* ---------- ۱. متغیرهای تم ---------- */
:root,
[data-theme="dark"] {
  --bg: #0a0e17;
  --bg-2: #0d1320;
  --surface: rgba(17, 24, 39, 0.72);
  --surface-solid: #111827;
  --surface-2: rgba(255, 255, 255, 0.03);
  --surface-3: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --text-mute: #6b7280;
  --red: #ef4444;
  --orange: #f59e0b;
  --green: #22c55e;
  --blue: #3b82f6;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --pink: #ec4899;
  --accent: var(--blue);
  --grid-dot: rgba(255, 255, 255, 0.045);
  --glow-1: rgba(59, 130, 246, 0.10);
  --glow-2: rgba(239, 68, 68, 0.07);
  --glow-3: rgba(168, 85, 247, 0.06);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --skeleton-a: rgba(255, 255, 255, 0.04);
  --skeleton-b: rgba(255, 255, 255, 0.09);
  --scroll-thumb: rgba(255, 255, 255, 0.12);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.22);
  --input-bg: rgba(255, 255, 255, 0.04);
  --backdrop: rgba(3, 6, 12, 0.6);
  --level: var(--orange);
  --radius: 12px;
  --radius-sm: 8px;
  --hdr-h: 108px;
  --foot-h: 30px;
  --nav-h: 62px;
  --side-w: 35%;
  --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);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eef2f7;
  --bg-2: #e6ebf2;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-2: rgba(15, 23, 42, 0.035);
  --surface-3: rgba(15, 23, 42, 0.06);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-dim: #475569;
  --text-mute: #64748b;
  --red: #dc2626;
  --orange: #d97706;
  --green: #16a34a;
  --blue: #2563eb;
  --purple: #9333ea;
  --grid-dot: rgba(15, 23, 42, 0.07);
  --glow-1: rgba(37, 99, 235, 0.08);
  --glow-2: rgba(220, 38, 38, 0.05);
  --glow-3: rgba(147, 51, 234, 0.05);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.18);
  --skeleton-a: rgba(15, 23, 42, 0.05);
  --skeleton-b: rgba(15, 23, 42, 0.10);
  --scroll-thumb: rgba(15, 23, 42, 0.18);
  --scroll-thumb-hover: rgba(15, 23, 42, 0.3);
  --input-bg: rgba(255, 255, 255, 0.9);
  --backdrop: rgba(15, 23, 42, 0.35);
  color-scheme: light;
}

/* ---------- ۱-الف. توکن‌های سیستم طراحی ---------- */
:root {
  /* فاصله‌ها */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  /* شعاع */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  /* تایپوگرافی (۶ اندازه) */
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 14px; --fs-lg: 16px; --fs-xl: 18px;
  --fw-reg: 400; --fw-med: 600; --fw-bold: 800;
  /* حرکت */
  --dur-1: 150ms; --dur-2: 200ms; --dur-3: 250ms; --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ui-zoom: 1;
}
:root, [data-theme] {
  /* سایه‌ها (۴ سطح) */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.28);
  --sh-2: 0 4px 12px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --sh-3: 0 12px 32px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --sh-4: 0 24px 64px rgba(0, 0, 0, 0.55);
  /* رنگ‌های معنایی */
  --c-danger: var(--red); --c-warn: var(--orange); --c-ok: var(--green); --c-info: var(--blue); --c-intel: var(--purple);
  --accent-ink: #fff;
}
[data-theme="light"], [data-theme="paper"] {
  --sh-1: 0 1px 2px rgba(15, 23, 42, 0.08);
  --sh-2: 0 4px 12px rgba(15, 23, 42, 0.08);
  --sh-3: 0 12px 30px rgba(15, 23, 42, 0.12);
  --sh-4: 0 24px 60px rgba(15, 23, 42, 0.2);
}
/* تم Midnight: سیاه مطلق برای نمایشگر OLED */
[data-theme="midnight"] {
  --bg: #000; --bg-2: #000; --surface: rgba(10, 10, 12, 0.92); --surface-solid: #07070a;
  --surface-2: rgba(255, 255, 255, 0.025); --surface-3: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.07); --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f1f5f9; --text-dim: #a1a1aa; --text-mute: #71717a;
  --red: #ff4d5e; --orange: #ffb020; --green: #2ee27a; --blue: #4d8dff; --purple: #b67cff; --accent: #2ee27a;
  --grid-dot: rgba(255, 255, 255, 0.03); --glow-1: transparent; --glow-2: transparent; --glow-3: transparent;
  --shadow: none; --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.9);
  --skeleton-a: rgba(255, 255, 255, 0.03); --skeleton-b: rgba(255, 255, 255, 0.08);
  --scroll-thumb: rgba(255, 255, 255, 0.14); --scroll-thumb-hover: rgba(255, 255, 255, 0.26);
  --input-bg: rgba(255, 255, 255, 0.03); --backdrop: rgba(0, 0, 0, 0.75);
  color-scheme: dark;
}
/* تم Paper: روشن کم‌کنتراست گرم */
[data-theme="paper"] {
  --bg: #f4efe6; --bg-2: #ede6da; --surface: rgba(250, 246, 239, 0.9); --surface-solid: #faf6ef;
  --surface-2: rgba(80, 60, 30, 0.035); --surface-3: rgba(80, 60, 30, 0.07);
  --border: rgba(80, 60, 30, 0.1); --border-strong: rgba(80, 60, 30, 0.18);
  --text: #3b3226; --text-dim: #6b5d4a; --text-mute: #8e7f69;
  --red: #b4453a; --orange: #b7791f; --green: #4d7c3a; --blue: #3d6b99; --purple: #7a5a99; --accent: #3d6b99;
  --grid-dot: rgba(80, 60, 30, 0.06); --glow-1: rgba(61, 107, 153, 0.05); --glow-2: rgba(180, 69, 58, 0.04); --glow-3: transparent;
  --shadow: 0 6px 18px rgba(80, 60, 30, 0.08); --shadow-lg: 0 20px 50px rgba(80, 60, 30, 0.16);
  --skeleton-a: rgba(80, 60, 30, 0.05); --skeleton-b: rgba(80, 60, 30, 0.1);
  --scroll-thumb: rgba(80, 60, 30, 0.2); --scroll-thumb-hover: rgba(80, 60, 30, 0.32);
  --input-bg: rgba(255, 252, 246, 0.9); --backdrop: rgba(59, 50, 38, 0.3);
  --accent-ink: #fff;
  color-scheme: light;
}
[data-theme="light"] { --accent: var(--blue); }
[data-theme="dark"], :root:not([data-theme]) { --accent: var(--blue); }
/* رنگ تأکیدی انتخابی (مستقل از تم) */
html[data-accent="blue"] { --accent: #3b82f6; }
html[data-accent="cyan"] { --accent: #06b6d4; --accent-ink: #001a1f; }
html[data-accent="green"] { --accent: #22c55e; --accent-ink: #03170a; }
html[data-accent="amber"] { --accent: #f59e0b; --accent-ink: #1a1200; }
html[data-accent="orange"] { --accent: #f97316; --accent-ink: #1f0b00; }
/* کنتراست متن سفید روی دکمه اصلی آبی (WCAG AA ≥ 4.5) */
html:not([data-accent]) .btn.primary, html[data-accent="blue"] .btn.primary { background: #2563eb; border-color: #2563eb; }
html[data-accent="red"] { --accent: #ef4444; }
html[data-accent="purple"] { --accent: #a855f7; }
html[data-accent="pink"] { --accent: #ec4899; }
/* تراکم رابط */
html[data-density="compact"] { --sp-1: 3px; --sp-2: 6px; --sp-3: 9px; --sp-4: 12px; --sp-5: 18px; --sp-6: 24px; }
html[data-density="comfortable"] { --sp-1: 5px; --sp-2: 10px; --sp-3: 15px; --sp-4: 20px; --sp-5: 28px; --sp-6: 38px; }
/* اندازه فونت (۴ سطح) */
html[data-fs="s"] { --fs-xs: 10px; --fs-sm: 11px; --fs-md: 12px; --fs-base: 13px; --fs-lg: 15px; --fs-xl: 17px; --ui-zoom: 0.92; }
html[data-fs="l"] { --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-base: 15px; --fs-lg: 17px; --fs-xl: 20px; --ui-zoom: 1.08; }
html[data-fs="xl"] { --fs-xs: 13px; --fs-sm: 14px; --fs-md: 15px; --fs-base: 16px; --fs-lg: 18px; --fs-xl: 22px; --ui-zoom: 1.16; }

body[data-level="calm"] { --level: var(--green); }
body[data-level="tension"] { --level: var(--orange); }
body[data-level="active"] { --level: var(--red); }

/* ---------- ۲. پایه ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--scroll-thumb) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  font-family: Vazirmatn, "Segoe UI", Tahoma, system-ui, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 600px at 100% 0%, var(--glow-1), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, var(--glow-2), transparent 60%),
    radial-gradient(600px 400px at 0% 0%, var(--glow-3), transparent 60%);
}

[hidden] { display: none !important; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-mute); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }

svg.lucide, .ic { width: 16px; height: 16px; stroke-width: 1.9; flex: none; }

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

.h-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.h-scroll::-webkit-scrollbar { display: none; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- ۳. کامپوننت‌های عمومی ---------- */
.card {
  position: relative;
  background: var(--surface);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  animation: card-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  min-width: 0;
}
.card:hover { border-color: var(--border-strong); }

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

.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 54px;
}
.card-hd.sm { padding: 10px 12px; min-height: 46px; border-bottom: 0; }

.card-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-title h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.2px; white-space: nowrap; }
.card-title h3 { font-size: 15px; font-weight: 800; white-space: nowrap; }

.card-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.ic-chip {
  --c: var(--blue);
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  flex: none;
}
.card-hd.sm .ic-chip { width: 28px; height: 28px; border-radius: 8px; }
.ic-chip.red { --c: var(--red); }
.ic-chip.orange { --c: var(--orange); }
.ic-chip.green { --c: var(--green); }
.ic-chip.blue { --c: var(--blue); }
.ic-chip.purple { --c: var(--purple); }

.count {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.1s, color 0.2s;
}
.btn:hover { background: var(--surface-3); border-color: color-mix(in srgb, var(--blue) 45%, var(--border-strong)); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--blue) 85%, #fff); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }
.btn.success { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.xs { padding: 2px 8px; font-size: 11px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn svg { width: 15px; height: 15px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.1s;
  flex: none;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-strong); text-decoration: none; }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.icon-btn.active { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 40%, transparent); background: color-mix(in srgb, var(--blue) 12%, transparent); }
.icon-btn.warn { color: var(--orange); }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.select, .input, textarea.input {
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  min-width: 0;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.select:focus, .input:focus, textarea.input:focus {
  border-color: color-mix(in srgb, var(--blue) 60%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
}
.select option { background: var(--surface-solid); color: var(--text); }
textarea.input { height: auto; min-height: 90px; padding: 8px 10px; line-height: 1.7; resize: vertical; width: 100%; }
.input.ltr, textarea.input.ltr { direction: ltr; text-align: left; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.search svg { position: absolute; right: 10px; color: var(--text-mute); pointer-events: none; }
.search input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  outline: none;
  font-size: 13px;
}
.search input:focus { border-color: color-mix(in srgb, var(--blue) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }

/* کلید روشن/خاموش */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s, background 0.2s;
}
.switch input:checked + span { background: color-mix(in srgb, var(--green) 35%, transparent); border-color: color-mix(in srgb, var(--green) 60%, transparent); }
.switch input:checked + span::after { transform: translateX(-16px); background: var(--green); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid var(--surface-solid);
  box-shadow: 0 0 0 1px var(--blue);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid var(--surface-solid);
  cursor: pointer;
}

.chips { display: flex; gap: 6px; padding: 0 14px 10px; }
.chip {
  --c: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip.active { color: var(--text); border-color: color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--c) 14%, transparent); }

/* نشانگر زنده */
.live-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--red);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
}

/* اسکلت لودینگ */
.skeleton-row, .skeleton-block, .skeleton-card {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton-row { height: 34px; margin: 6px 0; list-style: none; }
.skeleton-block { height: 120px; margin: 4px; }
.skeleton-card { height: 118px; margin: 10px 12px; border-radius: 10px; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--text-mute);
  text-align: center;
  font-size: 13px;
}
.empty svg { width: 34px; height: 34px; opacity: 0.6; }

/* ---------- ۴. پرچم متحرک ---------- */
.flag {
  --fw: 74px;   /* عرض کادر SVG (پرچم ۴:۷ + حاشیه موج) */
  --fh: 46px;
  --amp: 2.2px;
  --wave-dur: 1.9s;
  position: fixed;
  top: calc(var(--safe-t) + 8px);
  right: calc(var(--safe-r) + 12px);
  width: calc(var(--fw) + 5px);
  height: calc(var(--fh) + 22px);
  z-index: 10000;
  cursor: pointer;
  direction: ltr;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 8px color-mix(in srgb, var(--level) 45%, transparent));
  transition: filter 0.6s ease;
  -webkit-user-select: none;
  user-select: none;
}
body[data-level="calm"] .flag { --wave-dur: 2.6s; --amp: 1.6px; }
body[data-level="active"] .flag { --wave-dur: 1.25s; --amp: 3px; }

.flag-pole {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #4b5563, #e5e7eb 45%, #6b7280);
}
.flag-pole::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -2.5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fde68a, #b45309);
}
.flag-svg {
  position: absolute;
  left: 2px;
  top: 2px;
  width: var(--fw);
  height: var(--fh);
  overflow: visible;
  pointer-events: none;
}
.flag-cloth {
  position: absolute;
  left: 3px;
  top: 3px;
  width: var(--fw);
  height: var(--fh);
}
.flag-cloth > span {
  position: absolute;
  top: 0;
  height: 100%;
  background-image: var(--flag-img);
  background-size: var(--fw) var(--fh);
  background-repeat: no-repeat;
  animation: flag-wave var(--wave-dur) ease-in-out infinite;
  will-change: transform;
}
.flag-cloth > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  animation: flag-shade var(--wave-dur) ease-in-out infinite;
  animation-delay: inherit;
}
@keyframes flag-wave {
  0%, 100% { transform: translateY(calc(var(--a, 0px) * -1)) scaleY(calc(1 - var(--k, 0) * 0.025)); }
  50% { transform: translateY(var(--a, 0px)) scaleY(calc(1 + var(--k, 0) * 0.02)); }
}
@keyframes flag-shade {
  0%, 100% { opacity: calc(var(--k, 0) * 0.02); }
  25% { opacity: calc(var(--k, 0) * 0.26); }
  75% { opacity: 0; }
}
.flag:hover { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 14px color-mix(in srgb, var(--level) 70%, transparent)); }

.flag-static { position: relative; top: auto; right: auto; z-index: 1; margin: 0 auto; --fw: 172px; --fh: 107px; }

.popover {
  position: fixed;
  z-index: 10001;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  animation: pop-in 0.18s ease-out both;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.flag-popover {
  top: calc(var(--safe-t) + 84px);
  right: calc(var(--safe-r) + 12px);
  min-width: 220px;
  text-align: center;
}
.fp-label { font-size: 12px; color: var(--text-mute); }
.fp-clock { font-size: 32px; font-weight: 800; letter-spacing: 1px; line-height: 1.3; }
.fp-date { font-size: 12px; color: var(--text-dim); }
.fp-day {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 800;
  color: var(--level);
  background: color-mix(in srgb, var(--level) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--level) 30%, transparent);
}

/* ---------- ۵. صفحه قفل ---------- */
.lock {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-t) + 20px) 16px calc(var(--safe-b) + 20px);
  overflow-y: auto;
}
.lock::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px 400px at 50% 30%, color-mix(in srgb, var(--level) 10%, transparent), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.012) 3px 4px);
  pointer-events: none;
}
.lock-card {
  position: relative;
  width: min(380px, 100%);
  padding: 34px 26px 26px;
  border-radius: 18px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: card-in 0.6s ease both;
}
.lock-flag { margin-bottom: 18px; }
.lock-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--green); }
.lock-brand h1 { font-size: 24px; font-weight: 800; color: var(--text); }
.lock-brand svg { width: 26px; height: 26px; }
.lock-sub { margin: 6px 0 18px; color: var(--text-dim); font-size: 13px; }
.lock-form { display: grid; gap: 12px; }
.pin-dots { display: flex; justify-content: center; gap: 10px; min-height: 14px; direction: ltr; }
.pin-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  transition: background 0.15s, transform 0.15s;
}
.pin-dots i.on { background: var(--green); border-color: var(--green); transform: scale(1.1); }
.pin-input {
  height: 46px;
  text-align: center;
  letter-spacing: 8px;
  font-size: 20px;
  font-weight: 800;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  outline: none;
  direction: ltr;
}
.pin-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; }
.keypad button {
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 18px;
  font-weight: 600;
  transition: background 0.15s, transform 0.08s;
}
.keypad button:hover { background: var(--surface-3); }
.keypad button:active { transform: scale(0.95); }
.lock-msg { min-height: 22px; margin-top: 12px; font-size: 13px; color: var(--red); font-weight: 600; }
.lock-card.shake { animation: shake 0.4s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* ---------- ۶. هدر ---------- */
.app { position: relative; z-index: 1; min-height: 100%; }

.hdr {
  position: sticky;
  top: 0;
  z-index: 500;
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 104px) 0 calc(var(--safe-l) + 14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--level) 40%, var(--border));
  transition: border-color 0.6s;
}
.hdr::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--level), transparent);
  opacity: 0.8;
  transition: background 0.6s;
}

.hdr-main {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 52px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-ic {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
  overflow: hidden;
}
.brand-ic::after {
  content: "";
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg, transparent 0 300deg, color-mix(in srgb, var(--green) 35%, transparent) 360deg);
  animation: spin 3.5s linear infinite;
}
.brand-ic svg { width: 20px; height: 20px; position: relative; z-index: 1; }
.brand-txt h1 { font-size: 18px; font-weight: 800; white-space: nowrap; }
.brand-sub { display: block; font-size: 11px; color: var(--text-mute); white-space: nowrap; margin-top: -2px; }

/* تیکر */
.ticker {
  display: flex;
  align-items: center;
  height: 36px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}
.ticker-label {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #b91c1c, var(--red));
  white-space: nowrap;
  flex: none;
}
.ticker-label .live-dot { background: #fff; }
.ticker-label .live-dot::after { border-color: #fff; }
.ticker-viewport { position: relative; flex: 1; overflow: hidden; height: 100%; mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.ticker-track {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
}
.ticker-track.run { animation: ticker var(--ticker-dur, 60s) linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.ticker-item::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--c, var(--text-mute)); flex: none; }
.ticker-item:hover { color: var(--blue); }
.ticker-item .src { font-size: 11px; color: var(--text-mute); font-weight: 400; }

/* ساعت‌ها */
.clocks { display: flex; gap: 4px; max-width: 520px; }
.clock {
  display: grid;
  justify-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  min-width: 62px;
  line-height: 1.3;
}
.clock.home { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: color-mix(in srgb, var(--green) 8%, transparent); }
.clock .c-name { font-size: 10px; color: var(--text-mute); white-space: nowrap; }
.clock .c-time { font-size: 14px; font-weight: 800; }
.clock .c-diff { font-size: 9px; color: var(--text-mute); direction: ltr; }

.hdr-actions { display: flex; gap: 5px; }

.hdr-status {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  font-size: 12px;
  color: var(--text-dim);
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.hdr-status::-webkit-scrollbar { display: none; }
.st-item { display: inline-flex; align-items: center; gap: 5px; }
.st-item svg { width: 13px; height: 13px; color: var(--text-mute); }
.st-item b { color: var(--text); font-weight: 600; }
.st-sep { width: 1px; height: 12px; background: var(--border-strong); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-mute); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
#connState[data-state="live"] .conn-dot { background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 2.4s ease-in-out infinite; }
#connState[data-state="loading"] .conn-dot { background: var(--orange); box-shadow: 0 0 8px var(--orange); animation: blink 0.8s ease-in-out infinite; }
#connState[data-state="error"] .conn-dot { background: var(--red); box-shadow: 0 0 8px var(--red); }
#connState[data-state="live"] { color: var(--green); }
#connState[data-state="loading"] { color: var(--orange); }
#connState[data-state="error"] { color: var(--red); }
@keyframes blink { 50% { opacity: 0.45; } }
.level-chip { color: var(--level); font-weight: 800; }
.level-chip svg { color: var(--level); }

/* ---------- ۷. چیدمان ---------- */
.layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px var(--side-w-user, var(--side-w));
  gap: 0;
  height: calc(100dvh - var(--hdr-h) - var(--foot-h));
  padding: 12px calc(var(--safe-r) + 12px) 12px calc(var(--safe-l) + 12px);
}
.col { min-width: 0; min-height: 0; }
.col-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-left: 4px;
  overscroll-behavior: contain;
}
.col-side { display: flex; flex-direction: column; min-height: 0; }
.view { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.resizer {
  position: relative;
  cursor: col-resize;
  display: grid;
  place-items: center;
  touch-action: none;
}
.resizer span {
  width: 3px;
  height: 46px;
  border-radius: 3px;
  background: var(--border-strong);
  transition: background 0.2s, height 0.2s;
}
.resizer:hover span, .resizer.dragging span { background: var(--blue); height: 80px; }

/* ---------- ۸. رادار ---------- */
.region-bar { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.region-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  transition: all 0.2s;
}
.region-btn:hover { color: var(--text); border-color: color-mix(in srgb, var(--purple) 50%, transparent); }
.region-btn.active { color: #fff; background: var(--purple); border-color: var(--purple); box-shadow: 0 0 14px color-mix(in srgb, var(--purple) 45%, transparent); }

.radar-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.radar-frame {
  position: relative;
  height: clamp(380px, 56vh, 640px);
  background: #05080f;
  overflow: hidden;
  border-left: 1px solid var(--border);
}
.radar-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.radar-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
}
.radar-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--green);
  background: #05080f;
  font-size: 13px;
  transition: opacity 0.5s;
}
.radar-loading.done { opacity: 0; pointer-events: none; }
.radar-sweep {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1px solid rgba(34, 197, 94, 0.4);
  background:
    radial-gradient(circle, transparent 0 30%, rgba(34, 197, 94, 0.2) 30.5% 31%, transparent 31.5% 62%, rgba(34, 197, 94, 0.2) 62.5% 63%, transparent 63.5%),
    conic-gradient(from 0deg, transparent 0 290deg, rgba(34, 197, 94, 0.55) 360deg);
  animation: spin 2.2s linear infinite;
}
.radar-frame:fullscreen, .radar-frame.pseudo-full {
  height: 100%;
  border: 0;
}
.radar-frame.pseudo-full { position: fixed; inset: 0; z-index: 9500; height: 100dvh; }
.radar-exit-full {
  position: absolute;
  top: calc(var(--safe-t) + 12px);
  left: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  display: grid;
  place-items: center;
}

.flight-intel { display: flex; flex-direction: column; min-height: 0; max-height: clamp(380px, 56vh, 640px); }
.fi-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.fi-title { display: flex; align-items: center; gap: 7px; color: var(--purple); }
.fi-title b { color: var(--text); font-weight: 800; font-size: 14px; }
.fi-stats { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: end; }
.fi-total { display: grid; line-height: 1.2; }
.fi-total .lbl { font-size: 11px; color: var(--text-mute); }
.fi-total .big { font-size: 30px; font-weight: 800; color: var(--text); }
.fi-bars { display: flex; align-items: flex-end; gap: 2px; height: 48px; direction: ltr; min-width: 0; overflow: hidden; }
.fi-bars i {
  flex: 1 1 0;
  min-width: 0;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(to top, color-mix(in srgb, var(--purple) 40%, transparent), var(--purple));
  opacity: 0.85;
  transition: height 0.5s ease;
}
.fi-bars i.empty { background: var(--surface-3); }
.fi-sub { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 4px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.fi-list { flex: 1; overflow-y: auto; padding: 0 8px 6px; min-height: 120px; }
.fi-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 7px 8px;
  margin: 4px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  animation: card-in 0.35s ease both;
}
.fi-row.mil { border-color: color-mix(in srgb, var(--purple) 35%, transparent); background: color-mix(in srgb, var(--purple) 7%, transparent); }
.fi-row.alert { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: color-mix(in srgb, var(--red) 12%, transparent); }
.fi-row .cs { font-weight: 800; font-size: 13px; direction: ltr; text-align: right; }
.fi-row .meta { color: var(--text-mute); grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
.fi-row .meta span { display: inline-flex; align-items: center; gap: 3px; }
.fi-row .hdg { display: inline-block; width: 12px; height: 12px; }
.fi-row a { font-size: 11px; display: inline-flex; align-items: center; gap: 3px; }
.fi-tag { font-size: 10px; font-weight: 800; padding: 0 6px; border-radius: 4px; color: var(--purple); background: color-mix(in srgb, var(--purple) 15%, transparent); }
.fi-row.alert .fi-tag { color: var(--red); background: color-mix(in srgb, var(--red) 15%, transparent); }
.fi-foot { padding: 6px 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-mute); }
.fi-foot.err { color: var(--red); }

.quick-links { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border); }
.quick-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.quick-links a:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.quick-links svg { width: 14px; height: 14px; }

/* ---------- ۹. ویجت‌ها ---------- */
.widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.widget { display: flex; flex-direction: column; min-height: 190px; min-width: 0; }
.widget > * { min-width: 0; }
.widget.wide { grid-column: 1 / -1; min-height: 0; }
.legend { display: flex; gap: 10px; font-size: 11px; color: var(--text-dim); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-left: 5px; vertical-align: middle; }
.lg.war::before { background: var(--red); }
.lg.deal::before { background: var(--green); }
.pulse-wrap { position: relative; flex: 1; padding: 0 10px 10px; min-height: 130px; overflow: hidden; }
.pulse-wrap canvas { width: 100%; height: 100%; display: block; }

.word-cloud {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 4px 10px;
  padding: 4px 12px 12px;
}
.word-cloud button {
  border: 0;
  background: none;
  padding: 0 2px;
  line-height: 1.3;
  color: var(--c, var(--text-dim));
  font-weight: 800;
  transition: transform 0.15s, color 0.15s;
  animation: card-in 0.4s ease both;
}
.word-cloud button:hover { transform: scale(1.08); color: var(--text); }

.threat { display: grid; gap: 10px; padding: 2px 12px 12px; }
.threat-meter { position: relative; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--orange), var(--red)); direction: ltr; }
.threat-meter i {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 3px solid var(--text);
  transform: translate(-50%, -50%);
  transition: left 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.threat-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.threat-levels button {
  --c: var(--text-dim);
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
  color: var(--c);
}
.threat-levels button svg { width: 18px; height: 18px; }
.threat-levels button.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); box-shadow: 0 0 16px color-mix(in srgb, var(--c) 25%, transparent); }
.threat-levels [data-level="calm"] { --c: var(--green); }
.threat-levels [data-level="tension"] { --c: var(--orange); }
.threat-levels [data-level="active"] { --c: var(--red); }
.threat-suggest { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.threat-suggest b { color: var(--text); }

.counters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 2px 12px 12px; flex: 1; }
.counter {
  --c: var(--blue);
  display: grid;
  align-content: center;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, transparent), transparent);
}
.counter b { font-size: 24px; font-weight: 800; line-height: 1.2; color: var(--c); }
.counter span { font-size: 11px; color: var(--text-dim); }

.prices { display: grid; gap: 6px; padding: 2px 12px 12px; }
.price {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.price .p-ic { color: var(--c, var(--orange)); display: grid; }
.price .p-name { font-size: 12px; font-weight: 600; }
.price .p-sub { display: block; font-size: 10px; color: var(--text-mute); font-weight: 400; }
.price .p-val { font-size: 15px; font-weight: 800; direction: ltr; text-align: left; }
.price .p-chg { display: block; font-size: 10px; font-weight: 600; }
.price .up { color: var(--green); }
.price .down { color: var(--red); }

.verified-list { list-style: none; margin: 0; padding: 0 12px 12px; display: grid; gap: 6px; counter-reset: v; }
.verified-list li.v-item {
  counter-increment: v;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  animation: card-in 0.4s ease both;
}
.verified-list li.v-item:hover { border-color: var(--border-strong); background: var(--surface-3); }
.verified-list li.v-item::before {
  content: counter(v, persian);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-weight: 800;
  font-size: 13px;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}
.v-item .v-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-item .v-meta { font-size: 11px; color: var(--text-mute); }

/* ---------- ۱۰. اخبار ---------- */
.news-card-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.fetch-progress { font-size: 11px; color: var(--text-mute); }

.tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 10px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mute);
  white-space: nowrap;
  transition: color 0.2s;
}
.tab b {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-3);
  color: var(--text-dim);
}
.tab::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--tc, var(--blue));
  transform: scaleX(0);
  transition: transform 0.25s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { transform: scaleX(1); }
.tab[data-tab="war"] { --tc: var(--red); }
.tab[data-tab="deal"] { --tc: var(--green); }
.tab[data-tab="critical"] { --tc: var(--orange); }
.tab[data-tab="starred"] { --tc: #eab308; }
.tab.active b { background: color-mix(in srgb, var(--tc, var(--blue)) 20%, transparent); color: var(--tc, var(--blue)); }

.news-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.news-toolbar > *, .toolbar-row > * { min-width: 0; }
.select { max-width: 100%; text-overflow: ellipsis; }
.news-toolbar.collapsed .toolbar-row { display: none; }
.toolbar-row { display: flex; gap: 6px; }
.toolbar-row .select { flex: 1; }
.toolbar { display: flex; gap: 8px; padding: 10px 14px; flex-wrap: wrap; }

.ptr {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  font-size: 12px;
  color: var(--text-dim);
  transition: height 0.2s;
}
.ptr.pulling { transition: none; }
.ptr.ready { color: var(--green); }
.ptr.ready svg { transform: rotate(180deg); }
.ptr svg { transition: transform 0.2s; }

.news-list { flex: 1; overflow-y: auto; padding: 4px 0 12px; overscroll-behavior: contain; }
.news-group-hd {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.news-group-hd .count { margin-inline-start: auto; }

.news-item {
  --cc: var(--text-mute);
  position: relative;
  margin: 8px 10px;
  padding: 10px 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  animation: card-in 0.4s ease both;
  content-visibility: auto;
  contain-intrinsic-size: 0 130px;
}
.news-item:hover { border-color: var(--border-strong); background: var(--surface-3); }
.news-item.cat-war { --cc: var(--red); }
.news-item.cat-deal { --cc: var(--green); }
.news-item.cat-critical { --cc: var(--orange); }
.news-item.recent { border-right: 3px solid var(--cc); box-shadow: -10px 0 30px -18px var(--cc) inset; }
.news-item.recent:not(.cat-war):not(.cat-deal):not(.cat-critical) { --cc: var(--blue); }
.news-item.verified-now { animation: card-in 0.4s ease both, verified-flash 2.4s ease 0.2s 2; }
@keyframes verified-flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 45%, transparent), 0 0 24px color-mix(in srgb, var(--green) 40%, transparent); }
}

.ni-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-mute); margin-bottom: 4px; }
.src-badge {
  --g: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px 0 8px;
  height: 20px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--g);
  background: color-mix(in srgb, var(--g) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--g) 25%, transparent);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
}

/* ترجمه فارسی زیر تیتر/خلاصه اصلی */
.ni-tr, .ni-sum-tr, .nd-tr {
  margin-top: 3px;
  padding-right: 7px;
  border-right: 2px solid color-mix(in srgb, var(--blue) 45%, transparent);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.ni-sum-tr { font-size: 12px; color: var(--text-mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nd-tr { font-size: 14px; margin: 6px 0 12px; }
.nd-tr.sum { white-space: pre-line; font-size: 13.5px; line-height: 2; }
.tr-wait { color: var(--text-mute); font-size: 11px; animation: blink 1.2s ease-in-out infinite; }
.tr-fail { color: var(--text-mute); font-size: 11px; }
.tr-label { display: inline-block; font-size: 10px; font-weight: 800; color: var(--blue); margin-left: 4px; }
.src-badge svg.cflag { width: 16px; height: 11px; border-radius: 2px; flex: none; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.3); }
.ni-new {
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: var(--blue);
  animation: blink 1.6s ease-in-out infinite;
}
.ni-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}
.ni-confirmed svg { width: 11px; height: 11px; }
.ni-verified-now {
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  animation: pop-in 0.4s ease both, blink 1.2s ease-in-out 0.4s 4;
}

.ni-body { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.ni-title { font-size: 14px; font-weight: 600; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.ni-title.ltr-text { direction: ltr; text-align: left; }
.ni-sum {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.ni-sum.ltr-text { direction: ltr; text-align: left; }

.cred {
  --p: 50;
  --c: var(--orange);
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  flex: none;
  margin-bottom: 12px;
  cursor: pointer;
}
.cred svg { position: absolute; inset: 0; width: 46px; height: 46px; transform: rotate(-90deg); }
.cred circle { fill: none; stroke-width: 4; }
.cred .trk { stroke: var(--surface-3); }
.cred .val { stroke: var(--c); stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c) 60%, transparent)); }
.cred b { position: relative; font-size: 12px; font-weight: 800; color: var(--c); line-height: 1; }
.cred small { position: absolute; bottom: -13px; font-size: 9px; font-weight: 600; color: var(--c); white-space: nowrap; }
.cred:hover b { transform: scale(1.1); }
.cred.low { --c: var(--red); }
.cred.mid { --c: var(--orange); }
.cred.high { --c: var(--green); }

.ni-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tag {
  --c: var(--text-mute);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  height: 20px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.tag svg { width: 11px; height: 11px; }
.tag.war { --c: var(--red); }
.tag.deal { --c: var(--green); }
.tag.critical { --c: var(--orange); }
.tag.src { --c: var(--blue); }
.ni-actions { display: flex; gap: 2px; margin-inline-start: auto; }
.ni-actions button, .ni-actions a {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 0;
  background: none;
  color: var(--text-mute);
  transition: color 0.2s, background 0.2s;
}
.ni-actions button:hover, .ni-actions a:hover { color: var(--text); background: var(--surface-3); }
.ni-actions svg { width: 15px; height: 15px; }
.ni-actions .starred { color: #eab308; }
.ni-actions .starred svg { fill: #eab308; }

.load-more { display: flex; justify-content: center; padding: 10px; }

/* پنل کشویی (drawer) */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 0.2s ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 8100;
  width: min(520px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border-right: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
  animation: drawer-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.drawer-settings { width: min(640px, 100vw); }
@keyframes drawer-in {
  from { transform: translateX(-100%); }
  to { transform: none; }
}
.drawer-hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }

.nd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--text-mute); margin-bottom: 10px; }
.nd-title { font-size: 19px; font-weight: 800; line-height: 1.6; margin-bottom: 12px; }
.nd-img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--border); }
.nd-sum { font-size: 14px; line-height: 2; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.nd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.nd-section { margin-top: 18px; }
.nd-section h4 { font-size: 14px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.nd-cred { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.similar { display: grid; gap: 6px; }
.similar a, .similar button.sim {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  text-align: right;
}
.similar a:hover, .similar button.sim:hover { border-color: var(--border-strong); text-decoration: none; }
.similar small { color: var(--text-mute); font-size: 11px; }

/* جدول منابع تأییدکننده */
.src-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.src-table th, .src-table td { padding: 6px 6px; border-bottom: 1px solid var(--border); text-align: right; }
.src-table th { color: var(--text-mute); font-weight: 600; }
.explain { display: grid; gap: 4px; margin-top: 12px; font-size: 12px; }
.explain div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 8px; border-radius: 6px; background: var(--surface-2); }
.explain .plus { color: var(--green); font-weight: 800; }
.explain .minus { color: var(--red); font-weight: 800; }
.explain .total { background: color-mix(in srgb, var(--blue) 10%, transparent); font-weight: 800; }
.table-wrap { overflow-x: auto; }

/* ---------- ۱۱. نقشه ---------- */
.map-wrap { position: relative; }
.map { height: clamp(380px, 58vh, 680px); background: #0b1220; z-index: 1; }
[data-theme="light"] .map { background: #dfe6ee; }
.map-pick-hint {
  position: absolute;
  top: 12px;
  right: 50%;
  transform: translateX(50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--blue);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.replay { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.replay input { flex: 1; direction: ltr; }
.replay-label { font-size: 12px; color: var(--text-dim); min-width: 130px; text-align: left; white-space: nowrap; }

.leaflet-container { font-family: Vazirmatn, Tahoma, sans-serif; direction: ltr; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface-solid);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.leaflet-popup-content { direction: rtl; text-align: right; margin: 12px 14px; font-size: 13px; line-height: 1.7; min-width: 200px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-mute); }
.leaflet-control-layers, .leaflet-bar a {
  background: var(--surface-solid) !important;
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
}
.leaflet-control-layers { border-radius: 10px !important; box-shadow: var(--shadow) !important; direction: rtl; text-align: right; }
.leaflet-control-layers-expanded { padding: 8px 12px; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface-solid) 75%, transparent) !important; color: var(--text-mute) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--text-dim) !important; }

.ev-marker {
  --c: var(--red);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--c);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), 0 0 14px color-mix(in srgb, var(--c) 60%, transparent);
}
.ev-marker > * { transform: rotate(45deg); color: #fff; width: 15px; height: 15px; }
.base-marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #1e293b;
  color: #93c5fd;
  border: 1px solid #60a5fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.base-marker > * { width: 14px; height: 14px; }
.cluster-marker {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.95) 0 45%, rgba(239, 68, 68, 0.35) 46% 100%);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.5);
}
.popup-ev h4 { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.popup-ev .pe-meta { font-size: 11px; color: var(--text-mute); margin-bottom: 6px; }
.popup-ev .pe-desc { font-size: 12px; margin-bottom: 8px; white-space: pre-line; }
.popup-ev .pe-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- ۱۲. خط زمانی ---------- */
.timeline { position: relative; padding: 6px 14px 20px; }
.tl-day { position: relative; margin-bottom: 8px; }
.tl-day-hd {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.tl-day-hd span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
.tl-day-hd small { font-weight: 400; color: var(--text-mute); direction: ltr; }
.tl-items { position: relative; }
.tl-items::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 50%;
  width: 2px;
  transform: translateX(50%);
  background: linear-gradient(to bottom, var(--border-strong), var(--border));
}
.tl-item {
  --c: var(--blue);
  position: relative;
  width: 50%;
  padding: 6px 22px 6px 0;
  margin-right: 50%;
  animation: card-in 0.4s ease both;
}
.tl-item:nth-child(even) { margin-right: 0; padding: 6px 0 6px 22px; }
.tl-item::before {
  content: "";
  position: absolute;
  top: 18px;
  right: -7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid var(--surface-solid);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent), 0 0 12px var(--c);
  z-index: 2;
}
.tl-item:nth-child(even)::before { right: auto; left: -5px; }
.tl-box {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-top: 2px solid var(--c);
  background: var(--surface-2);
}
.tl-box .tl-time { font-size: 11px; color: var(--text-mute); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-box h4 { font-size: 13.5px; font-weight: 600; margin: 2px 0; overflow-wrap: anywhere; }
.tl-box p { font-size: 12px; color: var(--text-dim); overflow-wrap: anywhere; white-space: pre-line; }
.tl-box .tl-actions { display: flex; gap: 4px; margin-top: 4px; }

/* ---------- ۱۳. تنظیمات ---------- */
.settings-tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.settings-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mute);
  white-space: nowrap;
}
.settings-tabs button:hover { color: var(--text); background: var(--surface-2); }
.settings-tabs button.active { color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.settings-tabs svg { width: 15px; height: 15px; }

.set-section { margin-bottom: 20px; }
.set-section > h4 { font-size: 14px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; color: var(--text); }
.set-section > h4 svg { color: var(--blue); }
.set-hint { font-size: 12px; color: var(--text-mute); margin: 4px 0 8px; line-height: 1.8; }
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 9px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.set-row > label:first-child, .set-row > .lbl { font-size: 13px; font-weight: 600; flex: 1; min-width: 140px; }
.set-row small { display: block; font-size: 11px; font-weight: 400; color: var(--text-mute); }
.set-row .ctrl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--text-dim); }
.field .input, .field .select { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.src-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-bottom: 6px;
}
.src-row.err { border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.src-row .s-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-mute); }
.src-row .s-dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.src-row .s-dot.err { background: var(--red); box-shadow: 0 0 6px var(--red); }
.src-row .s-dot.loading { background: var(--orange); animation: blink 0.8s infinite; }
.src-row .s-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.src-row .s-name small { font-weight: 400; color: var(--text-mute); }
.src-row .s-info { grid-column: 2 / -1; font-size: 11px; color: var(--text-mute); overflow-wrap: anywhere; }
.src-row .s-info.err { color: var(--red); }
.src-row .s-actions { display: flex; gap: 4px; align-items: center; }
.src-row .s-edit { grid-column: 1 / -1; display: grid; gap: 6px; padding-top: 6px; }
.src-group-hd { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 13px; font-weight: 800; }
.src-group-hd i { width: 10px; height: 10px; border-radius: 3px; background: var(--g); }

/* ---------- ۱۴. مودال، اعلان، نوار به‌روزرسانی ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 16px);
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease both;
}
.modal-card {
  width: min(520px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.22s ease both;
}
.modal.wide .modal-card { width: min(760px, 100%); }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-hd h3 { font-size: 16px; font-weight: 800; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
.modal-actions:empty { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }

.toasts {
  position: fixed;
  z-index: 9800;
  left: 16px;
  bottom: calc(var(--foot-h) + 16px + var(--safe-b));
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  --c: var(--blue);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-right: 3px solid var(--c);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.toast.out { animation: toast-out 0.25s ease both; }
.toast > svg { color: var(--c); margin-top: 3px; }
.toast b { display: block; font-weight: 800; }
.toast.error { --c: var(--red); }
.toast.success { --c: var(--green); }
.toast.warn { --c: var(--orange); }
.toast button { border: 0; background: none; color: var(--text-mute); padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-20px); } }

.update-bar {
  position: fixed;
  z-index: 9900;
  top: calc(var(--safe-t) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--blue);
  box-shadow: var(--shadow-lg), 0 0 20px color-mix(in srgb, var(--blue) 30%, transparent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  animation: pop-in 0.3s ease both;
}
.update-bar svg { color: var(--blue); }

/* QR */
.qr-box { display: grid; place-items: center; gap: 10px; }
.qr-box canvas { width: min(320px, 100%); height: auto; image-rendering: pixelated; background: #fff; border-radius: 10px; padding: 8px; }

.ios-guide { display: grid; gap: 10px; }
.ios-step { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.ios-step .n { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }

/* ---------- ۱۵. نوار وضعیت پایین و ناوبری موبایل ---------- */
.statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--foot-h);
  padding: 0 calc(var(--safe-r) + 14px) 0 calc(var(--safe-l) + 14px);
  font-size: 11px;
  color: var(--text-mute);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
}
.sb-item { display: inline-flex; align-items: center; gap: 5px; }
.sb-item svg { width: 12px; height: 12px; }
.sb-spacer { flex: 1; }
.sb-progress { display: inline-block; width: 60px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.sb-progress span { display: block; height: 100%; width: 0; background: var(--blue); transition: width 0.3s; }
#sbNet.off { color: var(--red); }

.bottom-nav { display: none; }

/* ---------- ۱۶. واکنش‌گرایی ---------- */
@media (max-width: 1400px) {
  .clocks { max-width: 360px; }
}

@media (max-width: 1180px) {
  .hdr-main { grid-template-columns: auto minmax(120px, 1fr) auto; }
  .clocks { grid-column: 1 / -1; grid-row: 2; max-width: none; padding-bottom: 4px; }
  .radar-grid { grid-template-columns: minmax(0, 1fr) 260px; }
}

/* تبلت */
@media (max-width: 1023px) {
  :root { --side-w: 44%; }
  .resizer { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr) var(--side-w); gap: 10px; }
  .radar-grid { grid-template-columns: 1fr; }
  .radar-frame { border-left: 0; border-bottom: 1px solid var(--border); height: 46vh; }
  .flight-intel { max-height: 420px; }
  .hide-tablet { display: none !important; }
  .widgets { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* موبایل */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .flag { --fw: 54px; --fh: 34px; top: calc(var(--safe-t) + 6px); right: calc(var(--safe-r) + 8px); }
  .flag-static { --fw: 132px; --fh: 82px; }
  .flag-popover { top: calc(var(--safe-t) + 60px); }

  body { background-attachment: scroll; }
  .hdr { padding: calc(var(--safe-t) + 6px) calc(var(--safe-r) + 72px) 0 calc(var(--safe-l) + 10px); }
  .hdr-main { grid-template-columns: 1fr auto; gap: 8px; min-height: 44px; }
  .brand-ic { width: 32px; height: 32px; }
  .brand-txt h1 { font-size: 16px; }
  .brand-sub { display: none; }
  .ticker { grid-column: 1 / -1; grid-row: 2; height: 32px; }
  .clocks { grid-column: 1 / -1; grid-row: 3; }
  .clock { min-width: 56px; padding: 1px 6px; }
  .clock .c-time { font-size: 12px; }
  .hdr-actions { gap: 3px; }
  .hdr-actions .icon-btn { width: 32px; height: 32px; }
  .hdr-status { gap: 8px; font-size: 11px; height: 28px; }

  .layout {
    display: block;
    height: auto;
    padding: 10px calc(var(--safe-r) + 10px) calc(var(--nav-h) + var(--safe-b) + 14px) calc(var(--safe-l) + 10px);
  }
  .col-main { overflow: visible; padding: 0; gap: 10px; }
  .col-side { min-height: 0; }
  .view { display: none; }
  body[data-tab="news"] .view-news,
  body[data-tab="radar"] .view-radar,
  body[data-tab="map"] .view-map,
  body[data-tab="timeline"] .view-timeline { display: flex; animation: card-in 0.3s ease both; }
  .news-card-wrap { overflow: visible; }
  .news-list { overflow: visible; }
  .news-group-hd { top: var(--hdr-h); }
  .card-title h2 { font-size: 16px; }
  .card-hd { padding: 10px 12px; }
  .card-tools .btn span { display: none; }

  .radar-frame { height: 58vh; }
  .flight-intel { max-height: none; }
  .fi-list { max-height: 360px; }
  .widgets { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .radar-grid { grid-template-columns: minmax(0, 1fr); }
  .map { height: calc(100dvh - var(--hdr-h) - var(--nav-h) - 150px); min-height: 340px; }

  .tl-items::before { right: 7px; transform: none; }
  .tl-item, .tl-item:nth-child(even) { width: 100%; margin: 0; padding: 6px 26px 6px 0; }
  .tl-item::before, .tl-item:nth-child(even)::before { right: 2px; left: auto; }

  .statusbar { display: none; }
  .toasts { bottom: calc(var(--nav-h) + var(--safe-b) + 12px); left: 10px; right: 10px; width: auto; }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8050;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--nav-h) + var(--safe-b));
    padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
    background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-strong);
  }
  .bottom-nav button {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    border: 0;
    background: none;
    color: var(--text-mute);
    font-size: 10.5px;
    font-weight: 600;
  }
  .bottom-nav button svg { width: 21px; height: 21px; transition: transform 0.2s; }
  .bottom-nav button.active { color: var(--blue); }
  .bottom-nav button.active svg { transform: translateY(-2px); }
  .bottom-nav button.active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--blue);
    box-shadow: 0 0 10px var(--blue);
  }

  .drawer { width: 100vw; border: 0; }
  .drawer-settings { bottom: calc(var(--nav-h) + var(--safe-b)); padding-bottom: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .update-bar { width: calc(100vw - 24px); justify-content: space-between; white-space: normal; }
  .modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; border-radius: 16px 16px 0 0; max-height: 90dvh; padding-bottom: var(--safe-b); }
  .src-badge { max-width: 140px; }
}

@media (max-width: 380px) {
  .hdr-status .st-item span:not(#connText) { display: none; }
}

/* ---------- ۱۷. افزوده‌ها: نام منبع، پایگاه‌ها، جستجوی نقشه ---------- */
.src-badge .sb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }

.base-marker {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #fff;
  background: color-mix(in srgb, var(--c, #60a5fa) 34%, #0b1220);
  border: 1.5px solid var(--c, #60a5fa);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 10px color-mix(in srgb, var(--c, #60a5fa) 40%, transparent);
}
.base-marker.t-chokepoint, .base-marker.t-region { border-radius: 50%; }
.base-marker.t-nuclear { border-style: dashed; }
.lc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
.leaflet-control-layers-overlays label { padding: 2px 0; font-size: 12px; }
.popup-base .pb-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 6px 0; font-size: 12px; }
.popup-base .pb-grid span { color: var(--text-mute); }
.popup-base .pb-grid b { font-weight: 600; }

.base-search { position: relative; }
.search.sm input { height: 30px; font-size: 12px; width: 170px; }
.base-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 800;
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.base-results button {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 6px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: right;
  font-size: 12px;
}
.base-results button:hover { background: var(--surface-3); }
.base-results small { grid-column: 2; color: var(--text-mute); text-align: left; }
/* رویدادهای زنده */
.live-events { border-bottom: 1px solid var(--border); background: linear-gradient(180deg, color-mix(in srgb, var(--red) 7%, transparent), transparent); }
.le-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.le-head .count { margin-inline-start: auto; }
.le-live { position: relative; width: 12px; height: 12px; }
.radar-ping { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: 5px; vertical-align: middle; }
.radar-ping::before, .radar-ping::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--red); animation: mv-ping 2s ease-out infinite; }
.radar-ping::after { animation-delay: 1s; }
.le-live:not(.on) .radar-ping { background: var(--text-mute); }
.le-live:not(.on) .radar-ping::before, .le-live:not(.on) .radar-ping::after { display: none; }
.le-list { display: grid; gap: 8px; padding: 0 10px 10px; max-height: 46vh; overflow-y: auto; }
.le-card { border: 1px solid var(--border); border-right: 3px solid var(--orange); border-radius: 10px; background: var(--surface-2); padding: 8px 10px; animation: card-in 0.4s ease both; }
.le-card.critical { border-right-color: var(--red); }
.le-card.ongoing.critical { box-shadow: inset 0 0 24px -12px var(--red); }
.le-card.ended { opacity: 0.78; border-right-color: var(--text-mute); }
.le-hd { display: flex; align-items: center; gap: 8px; }
.le-status { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 800; color: var(--red); white-space: nowrap; }
.le-card.ended .le-status { color: var(--text-mute); }
.le-title { flex: 1; font-size: 13.5px; font-weight: 800; min-width: 0; }
.le-score { font-size: 12px; font-weight: 800; }
.le-score.high { color: var(--green); } .le-score.mid { color: var(--orange); } .le-score.low { color: var(--red); }
.le-body { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; margin-top: 6px; }
.le-mini { position: relative; width: 120px; height: 86px; border-radius: 8px; border: 1px solid var(--border-strong); background-color: #0b1220; background-repeat: no-repeat; cursor: pointer; overflow: hidden; }
.le-mini.empty { background: repeating-linear-gradient(45deg, var(--surface-3) 0 6px, transparent 6px 12px); cursor: default; }
.le-dot { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); }
.le-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--red); animation: mv-ping 1.6s ease-out infinite; }
.le-meta { font-size: 11.5px; color: var(--text-dim); display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.le-meta svg { width: 12px; height: 12px; }
.le-stats { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0; font-size: 11.5px; }
.le-stat { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-dim); }
.le-stat b { color: var(--text); }
.le-stat.killed b { color: var(--red); } .le-stat.wounded b { color: var(--orange); } .le-stat.missiles b, .le-stat.drones b { color: var(--purple); }
.le-stat svg { width: 12px; height: 12px; }
.le-headline { font-size: 12px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.le-news { margin-top: 6px; font-size: 12px; }
.le-news summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.le-news button { display: grid; width: 100%; text-align: right; gap: 1px; margin-top: 4px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; background: none; font-size: 12px; }
.le-news button small { color: var(--text-mute); font-size: 10.5px; }

/* هشدار تمام‌صفحه */
.alert-overlay { position: fixed; inset: 0; z-index: 9950; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 40%, rgba(127, 29, 29, 0.55), rgba(3, 6, 12, 0.92)); animation: ao-flash 1.2s ease-in-out 3; }
@keyframes ao-flash { 50% { background-color: rgba(239, 68, 68, 0.18); } }
.ao-scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.03) 3px 4px); }
.ao-scan::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 120px; background: linear-gradient(180deg, transparent, rgba(239, 68, 68, 0.18), transparent); transform: translateY(-120px); will-change: transform; animation: ao-sweep 2.4s linear infinite; }
@keyframes ao-sweep { from { transform: translateY(-120px); } to { transform: translateY(100vh); } }
.ao-card { position: relative; width: min(620px, 100%); padding: 22px; border-radius: 14px; background: rgba(10, 14, 23, 0.94); color: #f3f4f6; border: 1px solid #ef4444; box-shadow: 0 0 60px rgba(239, 68, 68, 0.45); animation: pop-in 0.3s ease both; }
.ao-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: #fca5a5; flex-wrap: wrap; }
.ao-blink { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; letter-spacing: 0.5px; animation: blink 0.8s steps(2) infinite; }
.ao-card h2 { font-size: 26px; font-weight: 800; margin: 10px 0 6px; text-shadow: 0 0 18px rgba(239, 68, 68, 0.7); }
.ao-meta { font-size: 13px; color: #d1d5db; }
.ao-headline { margin-top: 6px; font-size: 14px; color: #fff; }
.ao-card .le-stat { background: rgba(255, 255, 255, 0.08); color: #e5e7eb; }
.ao-card .le-stat b { color: #fff; }
.ao-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ao-actions .btn { color: #e5e7eb; }
.ao-actions .btn.primary { background: #ef4444; border-color: #ef4444; color: #fff; }

/* نوار ابزار نقشه و لایه تحرکات */
.map-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-dim); }
.mt-label, .mt-stat { display: inline-flex; align-items: center; gap: 5px; }
.mt-stat b { color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface-2); padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.seg button + button { border-right: 1px solid var(--border-strong); }
.seg button.active { background: color-mix(in srgb, var(--orange) 22%, transparent); color: var(--text); }

.mv-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: var(--c);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 70%, transparent);
}
.mv-marker > svg { width: 15px; height: 15px; }
.mv-marker.approx { opacity: 0.7; border-style: dashed; }
.mv-marker.confirmed { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.45), 0 0 14px var(--c); }
.mv-marker.recent::before, .mv-marker.recent::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--c);
  animation: mv-ping 1.8s ease-out infinite;
  pointer-events: none;
}
.mv-marker.recent::after { animation-delay: 0.9s; }
@keyframes mv-ping { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(2.8); opacity: 0; } }
.mv-arc { animation: mv-dash 1.2s linear infinite; }
@keyframes mv-dash { to { stroke-dashoffset: -28; } }
.mv-arrow { width: 0; height: 0; border-left: 13px solid var(--c); border-top: 7px solid transparent; border-bottom: 7px solid transparent; filter: drop-shadow(0 0 3px var(--c)); }
.fl-marker { display: grid; place-items: center; width: 22px; height: 22px; color: #c084fc; filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.9)); }
.fl-marker span { display: grid; place-items: center; }
.fl-marker svg { width: 18px; height: 18px; fill: currentColor; }
.fl-marker.alert { color: #ef4444; filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.9)); }
.fl-marker.nocs { color: #fbbf24; }

@media (max-width: 767px) {
  .search.sm input { width: 130px; }
  .base-results { right: auto; left: 0; width: min(280px, 90vw); }
}

/* ---------- ۱۸. سبک اتاق فرماندهی سینمایی ---------- */
.mono, .num, .clock .c-time, .fp-clock, .fi-row .cs, .price .p-val, .replay-label, .sb-utc {
  font-family: "JetBrains Mono", Vazirmatn, ui-monospace, "Cascadia Mono", monospace;
}
.num { letter-spacing: -0.2px; }

/* تم‌های Amber و Ice */
[data-theme="amber"] {
  --bg: #0b0802; --bg-2: #120d04; --surface: rgba(24, 17, 6, 0.8); --surface-solid: #17110a;
  --surface-2: rgba(255, 176, 0, 0.035); --surface-3: rgba(255, 176, 0, 0.075);
  --border: rgba(255, 176, 0, 0.11); --border-strong: rgba(255, 176, 0, 0.24);
  --text: #ffcf70; --text-dim: #d9a441; --text-mute: #9c7430;
  --red: #ff5b3a; --orange: #ffb000; --green: #d7e05a; --blue: #ffc24d; --purple: #ff9f43; --accent: #ffb000;
  --grid-dot: rgba(255, 176, 0, 0.07); --glow-1: rgba(255, 176, 0, 0.1); --glow-2: rgba(255, 91, 58, 0.07); --glow-3: rgba(255, 176, 0, 0.05);
  --skeleton-a: rgba(255, 176, 0, 0.05); --skeleton-b: rgba(255, 176, 0, 0.12);
  --scroll-thumb: rgba(255, 176, 0, 0.22); --scroll-thumb-hover: rgba(255, 176, 0, 0.38); --input-bg: rgba(255, 176, 0, 0.05);
  color-scheme: dark;
}
[data-theme="ice"] {
  --bg: #050b12; --bg-2: #07111b; --surface: rgba(8, 22, 34, 0.8); --surface-solid: #0a1a28;
  --surface-2: rgba(125, 211, 252, 0.035); --surface-3: rgba(125, 211, 252, 0.075);
  --border: rgba(125, 211, 252, 0.11); --border-strong: rgba(125, 211, 252, 0.24);
  --text: #e0f2fe; --text-dim: #93c5fd; --text-mute: #5b8db3;
  --red: #fb7185; --orange: #fbbf24; --green: #5eead4; --blue: #38bdf8; --purple: #a5b4fc; --accent: #38bdf8;
  --grid-dot: rgba(125, 211, 252, 0.07); --glow-1: rgba(56, 189, 248, 0.12); --glow-2: rgba(94, 234, 212, 0.06); --glow-3: rgba(165, 180, 252, 0.06);
  --skeleton-a: rgba(125, 211, 252, 0.05); --skeleton-b: rgba(125, 211, 252, 0.12);
  --scroll-thumb: rgba(125, 211, 252, 0.22); --scroll-thumb-hover: rgba(125, 211, 252, 0.38); --input-bg: rgba(125, 211, 252, 0.05);
  color-scheme: dark;
}
[data-theme="amber"] .leaflet-tile-pane { filter: sepia(1) saturate(2.2) hue-rotate(-8deg) brightness(0.85); }
[data-theme="ice"] .leaflet-tile-pane { filter: sepia(0.6) saturate(2) hue-rotate(160deg) brightness(0.95); }
[data-theme="amber"] .le-mini, [data-theme="ice"] .le-mini { filter: sepia(0.8) saturate(1.6); }

/* پس‌زمینه: شبکه هگزاگونال متحرک، scanline و نویز */
.bg-fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-hex {
  position: absolute;
  inset: -80px;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34.64' height='60' viewBox='0 0 34.64 60'%3E%3Cpath d='M17.32 0L34.64 10V30L17.32 40L0 30V10ZM17.32 40V60' fill='none' stroke='%2394a3b8' stroke-opacity='0.07' stroke-width='0.8'/%3E%3C/svg%3E");
  background-size: 34.64px 60px;
  animation: hex-drift 80s linear infinite;
  will-change: transform;
}
@keyframes hex-drift { to { transform: translate3d(34.64px, 60px, 0); } }
.bg-fx::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 3px);
}
.bg-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="light"] .bg-fx::before { display: none; }
[data-theme="light"] .bg-fx::after { opacity: 0.03; }
[data-theme="amber"] .bg-hex { filter: sepia(1) saturate(3) hue-rotate(-10deg); }
[data-theme="ice"] .bg-hex { filter: sepia(1) saturate(2) hue-rotate(170deg); }

/* براکت‌های HUD گوشه کارت‌ها */
.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 2;
  pointer-events: none;
  border-radius: var(--radius);
  --hud: color-mix(in srgb, var(--accent, var(--blue)) 80%, transparent);
  background:
    linear-gradient(var(--hud), var(--hud)) left top / 16px 2px no-repeat,
    linear-gradient(var(--hud), var(--hud)) left top / 2px 16px no-repeat,
    linear-gradient(var(--hud), var(--hud)) right top / 16px 2px no-repeat,
    linear-gradient(var(--hud), var(--hud)) right top / 2px 16px no-repeat,
    linear-gradient(var(--hud), var(--hud)) left bottom / 16px 2px no-repeat,
    linear-gradient(var(--hud), var(--hud)) left bottom / 2px 16px no-repeat,
    linear-gradient(var(--hud), var(--hud)) right bottom / 16px 2px no-repeat,
    linear-gradient(var(--hud), var(--hud)) right bottom / 2px 16px no-repeat;
  opacity: 0.35;
  transition: opacity 0.3s;
}
.card:hover::after { opacity: 0.95; }

/* تیتر با تایپ‌رایتر و درخشش نئونی */
.card-title h2, .brand-txt h1, .lock-brand h1 { text-shadow: 0 0 14px color-mix(in srgb, var(--accent, var(--blue)) 45%, transparent); }
.tw { animation: tw-reveal 1.1s steps(22, end) both; }
@keyframes tw-reveal { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }

/* خط اسکن گاه‌به‌گاه روی رادار */
/* فقط transform متحرک است (بدون تغییر top و چیدمان مجدد) */
.radar-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, transparent calc(100% - 60px), color-mix(in srgb, var(--green) 16%, transparent) calc(100% - 12px), color-mix(in srgb, var(--green) 60%, transparent) calc(100% - 2px), transparent);
  transform: translateY(-100%);
  will-change: transform;
  animation: radar-scan 12s linear infinite;
}
@keyframes radar-scan {
  0% { transform: translateY(-100%); opacity: 0; }
  2% { opacity: 1; }
  28% { transform: translateY(60px); opacity: 1; }
  28.1%, 100% { transform: translateY(60px); opacity: 0; }
}

/* نشانگر زنده با پالس دولایه رادار */
.live-dot::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--red);
  animation: pulse 2s ease-out 1s infinite;
}
.ticker-label .live-dot::before { border-color: #fff; }

/* شمارنده با چرخش ارقام */
.roll-num { display: inline-flex; direction: ltr; unicode-bidi: isolate; }
.roll-d { display: inline-block; height: 1.2em; line-height: 1.2em; overflow: hidden; vertical-align: bottom; }
.roll-s { display: flex; flex-direction: column; transition: transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.roll-s span, .roll-sep { display: block; height: 1.2em; line-height: 1.2em; }
.counter b, .fi-total .big { line-height: 1.2; }

/* انتقال glitch بین تب‌ها */
body .view.glitch-in { animation: glitch-in 0.42s steps(1, end) both; }
@keyframes glitch-in {
  0% { clip-path: inset(0 0 82% 0); transform: translateX(-7px); filter: hue-rotate(50deg) saturate(1.6); opacity: 0.6; }
  14% { clip-path: inset(38% 0 32% 0); transform: translateX(6px); }
  28% { clip-path: inset(8% 0 62% 0); transform: translateX(-3px); filter: none; }
  42% { clip-path: inset(66% 0 6% 0); transform: translateX(2px); opacity: 1; }
  56%, 100% { clip-path: inset(0 0 0 0); transform: none; filter: none; }
}

/* boot sequence */
.boot { position: fixed; inset: 0; z-index: 12000; display: grid; place-items: center; padding: 20px; background: #03060b; color: #22c55e; cursor: pointer; transition: opacity 0.3s; }
.boot.out { opacity: 0; }
.boot::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(34, 197, 94, 0.05) 0 1px, transparent 1px 3px); pointer-events: none; }
.boot-box { position: relative; width: min(560px, 100%); }
.boot-title { font-size: 15px; font-weight: 700; letter-spacing: 2px; direction: ltr; text-align: left; text-shadow: 0 0 10px rgba(34, 197, 94, 0.7); }
.boot-ver { opacity: 0.6; font-size: 11px; }
.boot-log { margin: 14px 0; min-height: 190px; font-size: 12.5px; line-height: 1.9; color: #86efac; }
.boot-log div { animation: fade-in 0.15s ease both; }
.bl-ts { color: #15803d; direction: ltr; unicode-bidi: isolate; }
.boot-bar { height: 3px; background: rgba(34, 197, 94, 0.15); border-radius: 3px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: #22c55e; box-shadow: 0 0 10px #22c55e; transition: width 0.2s; }
.boot-skip { margin-top: 10px; font-size: 11px; color: #4d7c5b; }

/* نوار وضعیت لغزان */
.sb-utc { color: var(--text); font-weight: 700; }
.sb-marquee {
  flex: 1;
  min-width: 80px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.sb-track { display: inline-flex; white-space: nowrap; animation: sb-marq 55s linear infinite; }
.sb-copy { padding-left: 70px; color: var(--text-dim); }
@keyframes sb-marq { from { transform: translateX(0); } to { transform: translateX(50%); } }

/* نمایش دیواری */
body.wall .hdr, body.wall .statusbar, body.wall .bottom-nav, body.wall .resizer { display: none !important; }
body.wall .layout { display: block; height: 100dvh; padding: 0; }
body.wall .col-main { height: 100dvh; overflow: hidden; padding: 0; }
body.wall .view { display: none !important; }
body.wall[data-wall="radar"] .view-radar,
body.wall[data-wall="map"] .view-map,
body.wall[data-wall="news"] .view-news { display: flex !important; height: 100dvh; }
body.wall[data-wall="radar"] .widgets { display: none; }
body.wall .card { border-radius: 0; }
body.wall .radar-card, body.wall .map-card, body.wall .news-card-wrap { height: 100dvh; }
body.wall .radar-frame, body.wall .flight-intel { height: calc(100dvh - 160px); max-height: none; }
body.wall .map { height: calc(100dvh - 190px); }
body.wall .col-side { height: 100dvh; }
body.wall .card-grip, body.wall .card-collapse { display: none; }
.wall-hud { position: fixed; z-index: 9600; bottom: calc(var(--safe-b) + 14px); left: 14px; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; font-size: 12px; background: color-mix(in srgb, var(--surface-solid) 88%, transparent); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }

/* کارت‌های جمع‌شونده و قابل جابه‌جایی */
.card.collapsed > :not(.card-hd) { display: none !important; }
.card.collapsed { min-height: 0 !important; }
.card.collapsed .card-hd { border-bottom: 0; }
.card-collapse svg { transition: transform 0.25s; }
.card.collapsed .card-collapse svg { transform: rotate(180deg); }
.card-grip { cursor: grab; touch-action: none; }
.card-grip:active { cursor: grabbing; }
.dragging { opacity: 0.6; outline: 2px dashed var(--accent, var(--blue)); outline-offset: 3px; border-radius: var(--radius); }
.view-radar .radar-card .card-grip, .view-map .card-grip, .view-timeline .card-grip { color: var(--text-mute); }

/* کاهش انیمیشن از تنظیمات */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
.reduce-motion .bg-hex, .reduce-motion .radar-frame::before { animation: none !important; display: none; }
.reduce-motion .ticker-track.run { animation-duration: var(--ticker-dur, 60s) !important; animation-iteration-count: infinite !important; }
.reduce-motion .sb-track { animation-duration: 55s !important; animation-iteration-count: infinite !important; }

@media (max-width: 767px) {
  .bg-hex { animation: none; }
  .card-grip { display: none; }
  .view-radar .widgets .card-grip { display: inline-grid; }
  .boot-log { font-size: 11.5px; }
  .card::after { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-hex, .radar-frame::before { animation: none !important; }
  .sb-track { animation: sb-marq 55s linear infinite !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .flag-cloth > span { animation: none !important; }
  .ticker-track.run { animation: ticker var(--ticker-dur, 60s) linear infinite !important; }
}

@media print {
  .flag, .hdr, .statusbar, .bottom-nav { display: none; }
}

/* =====================================================================
 * ۱۹. سیستم طراحی یکپارچه و صیقل بصری (نسخه ۳.۱)
 * همه کامپوننت‌ها از توکن‌های فاصله/شعاع/سایه/تایپوگرافی استفاده می‌کنند
 * ===================================================================== */

/* --- آیکون‌های اختصاصی --- */
svg.wi { width: 16px; height: 16px; flex: none; overflow: visible; }
svg.wi.filled, .active > svg.wi, .tab.active svg.wi, .bottom-nav button.active svg.wi { --ico-fill: color-mix(in srgb, currentColor 22%, transparent); }
svg.wflag { width: 16px; height: 11px; border-radius: 2px; flex: none; }
.wi-anim .wa-sweep { transform-origin: 12px 12px; animation: wa-spin 2.6s linear infinite; }
.wi-anim .wa-blip { animation: wa-blip 2.6s ease-in-out infinite; }
.wi-anim .wa-ring { transform-origin: 12px 12px; animation: wa-ring 2s ease-out infinite; }
.wi-anim .wa-d2 { animation-delay: 1s; }
.wi-siren .wa-rays { animation: blink 0.9s steps(2, jump-none) infinite; }
.wi-siren .wa-dome { fill: color-mix(in srgb, currentColor 25%, transparent); }
.wi-fire .wa-flame { transform-origin: 12px 21px; animation: wa-flicker 1.4s ease-in-out infinite; fill: color-mix(in srgb, currentColor 18%, transparent); }
.wi-fire .wa-smoke { animation: wa-smoke 2.2s ease-out infinite; opacity: 0; }
@keyframes wa-spin { to { transform: rotate(360deg); } }
@keyframes wa-blip { 0%, 60%, 100% { opacity: 0.2; } 70% { opacity: 1; } }
@keyframes wa-ring { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes wa-flicker { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(0.96, 1.05); } 60% { transform: scale(1.03, 0.97); } }
@keyframes wa-smoke { 0% { opacity: 0; transform: translateY(2px); } 30% { opacity: 0.7; } 100% { opacity: 0; transform: translateY(-4px); } }

/* --- کارت --- */
.card {
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-3) var(--ease), transform var(--dur-3) var(--ease), background var(--dur-2);
}
.widget:hover, .le-card:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.card-hd { gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); min-height: 56px; }
.card-hd.sm { padding: var(--sp-2) var(--sp-3); min-height: 50px; }
.card-title { gap: var(--sp-3); }
.card-titles { display: grid; min-width: 0; line-height: 1.25; }
.card-kicker {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.6px; color: var(--text-mute); direction: ltr; text-align: right;
  text-transform: uppercase; white-space: nowrap; opacity: 0.85;
}
.card-kicker::before { content: ""; display: inline-block; width: 14px; height: 1px; margin-inline-end: 6px; vertical-align: middle; background: currentColor; opacity: 0.6; }
.card-desc { font-size: var(--fs-xs); font-weight: var(--fw-reg); color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title h2 { font-size: var(--fs-xl); }
.card-title h3 { font-size: var(--fs-base); }
.card-hd.sm .card-desc { display: none; }
.ic-chip { width: 34px; height: 34px; border-radius: var(--r-sm); box-shadow: 0 0 18px -6px var(--c), inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent); }
.card-hd.sm .ic-chip { width: 30px; height: 30px; }
.ic-chip svg { width: 18px; height: 18px; }
.card-tools .cc-set, .card-tools .cc-focus, .card-tools .cc-refresh { opacity: 0.55; transition: opacity var(--dur-2); }
.card-hd:hover .cc-set, .card-hd:hover .cc-focus, .card-hd:hover .cc-refresh { opacity: 1; }
.count { border-radius: var(--r-pill); font-size: var(--fs-xs); padding: 1px var(--sp-2); }

/* --- دکمه‌ها و ورودی‌ها --- */
.btn { gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm); font-size: var(--fs-md); transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2), transform var(--dur-1), box-shadow var(--dur-2); }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); box-shadow: var(--sh-1); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -8px var(--accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, #fff); }
.btn.sm { padding: calc(var(--sp-1) + 1px) var(--sp-3); font-size: var(--fs-sm); }
.btn.xs { padding: 2px var(--sp-2); font-size: var(--fs-xs); border-radius: var(--r-xs); }
.icon-btn { border-radius: var(--r-sm); transition: color var(--dur-2), background var(--dur-2), border-color var(--dur-2), transform var(--dur-1); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.icon-btn.flip svg { transform: rotate(180deg); }
.select, .input, textarea.input, .search input { border-radius: var(--r-sm); font-size: var(--fs-md); }
.select:focus, .input:focus, textarea.input:focus, .search input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
:focus-visible { outline-color: var(--accent); }
a { color: var(--accent); }
input[type="range"]::-webkit-slider-thumb { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { background: var(--accent); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }

/* سوئیچ به سبک iOS */
.switch { width: 44px; height: 26px; }
.switch span { border: 0; background: color-mix(in srgb, var(--text-mute) 35%, transparent); box-shadow: inset 0 0 0 1px var(--border-strong); transition: background var(--dur-3) var(--ease); }
.switch span::after { top: 3px; right: 3px; width: 20px; height: 20px; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35); transition: transform var(--dur-3) var(--ease); }
.switch input:checked + span { background: var(--c-ok); box-shadow: none; border: 0; }
.switch input:checked + span::after { transform: translateX(-18px); background: #fff; }
.switch:active span::after { width: 24px; }
.switch input:checked:active + span::after { transform: translateX(-14px); }

/* --- برچسب‌ها و تراشه‌ها --- */
.chip { padding: 3px var(--sp-3); border-radius: var(--r-pill); font-size: var(--fs-sm); transition: all var(--dur-2); }
.tag { gap: 5px; padding: 0 var(--sp-2); height: 21px; border-radius: var(--r-xs); font-size: var(--fs-xs); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); }
.tag svg { width: 12px; height: 12px; }

/* --- حالت خالی --- */
.empty {
  position: relative; gap: var(--sp-2); padding: var(--sp-6) var(--sp-4); font-size: var(--fs-md); line-height: 1.8; isolation: isolate;
}
.empty::before {
  content: ""; position: absolute; left: 50%; top: calc(var(--sp-6) - 22px); width: 116px; height: 116px; transform: translateX(-50%); z-index: -1; opacity: 0.5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 116 116' fill='none' stroke='%2394a3b8' stroke-opacity='.35'%3E%3Ccircle cx='58' cy='58' r='56' stroke-dasharray='2 5'/%3E%3Ccircle cx='58' cy='58' r='38'/%3E%3Ccircle cx='58' cy='58' r='20' stroke-dasharray='3 4'/%3E%3Cpath d='M58 0v116M0 58h116' stroke-opacity='.15'/%3E%3C/svg%3E") center / contain no-repeat;
}
.empty > svg:first-child { width: 40px; height: 40px; padding: 9px; box-sizing: content-box; opacity: 0.9; color: var(--accent); border-radius: 50%; background: color-mix(in srgb, var(--accent) 10%, var(--surface-solid)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), 0 8px 24px -10px var(--accent); }
.empty b { color: var(--text-dim); font-size: var(--fs-base); }
.empty span { max-width: 320px; }

/* --- اسکلت لودینگ هم‌شکل محتوا --- */
.skeleton-card {
  position: relative; height: 128px; margin: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; animation: none;
}
.skeleton-card::before {
  content: ""; position: absolute; inset: 14px 16px;
  background:
    radial-gradient(circle at 10px 10px, var(--skeleton-b) 9px, transparent 10px) right top / 20px 20px no-repeat,
    linear-gradient(var(--skeleton-b), var(--skeleton-b)) right 28px top 4px / 34% 11px no-repeat,
    linear-gradient(var(--skeleton-a), var(--skeleton-a)) right 0 top 34px / 78% 14px no-repeat,
    linear-gradient(var(--skeleton-a), var(--skeleton-a)) right 0 top 56px / 62% 11px no-repeat,
    radial-gradient(circle, transparent 15px, var(--skeleton-b) 16px 19px, transparent 20px) left top 24px / 44px 44px no-repeat,
    linear-gradient(var(--skeleton-a), var(--skeleton-a)) right 0 bottom 0 / 22% 16px no-repeat,
    linear-gradient(var(--skeleton-a), var(--skeleton-a)) right 26% bottom 0 / 16% 16px no-repeat;
}
.skeleton-card::after, .skeleton-row::after, .skeleton-block::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent);
  animation: sk-sweep 1.5s ease-in-out infinite;
}
.skeleton-row { position: relative; overflow: hidden; animation: none; background: var(--surface-2); border: 1px solid var(--border); height: 40px; border-radius: var(--r-sm); }
.skeleton-row::before { content: ""; position: absolute; inset: 10px 12px; background: radial-gradient(circle at 10px 10px, var(--skeleton-b) 8px, transparent 9px) right center / 20px 20px no-repeat, linear-gradient(var(--skeleton-a), var(--skeleton-a)) right 30px center / 55% 10px no-repeat, linear-gradient(var(--skeleton-a), var(--skeleton-a)) left center / 18% 10px no-repeat; }
.skeleton-block { position: relative; overflow: hidden; animation: none; background: linear-gradient(to top, var(--skeleton-b) 0 2px, transparent 2px), repeating-linear-gradient(90deg, transparent 0 10%, var(--skeleton-a) 10% 16%); border-radius: var(--r-sm); }
@keyframes sk-sweep { to { transform: translateX(100%); } }

/* --- اعلان‌ها با نوار زمان --- */
.toast { position: relative; overflow: hidden; gap: var(--sp-3); padding: var(--sp-3) var(--sp-3) calc(var(--sp-3) + 2px); border-radius: var(--r-md); box-shadow: var(--sh-4); border-right-width: 1px; }
.toast-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.toast-ic svg { width: 17px; height: 17px; }
.toast-txt { min-width: 0; line-height: 1.6; }
.toast-bar { position: absolute; right: 0; left: 0; bottom: 0; height: 3px; background: var(--c); transform-origin: right; animation: toast-bar linear both; opacity: 0.85; }
.toast.paused .toast-bar { animation-play-state: paused; }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* --- هدر --- */
.brand-ic { width: 40px; height: 40px; border-radius: var(--r-md); box-shadow: 0 0 22px -6px var(--green), inset 0 0 12px color-mix(in srgb, var(--green) 20%, transparent); }
.brand-ic::after { display: none; }
.brand-ic svg.wi { width: 26px; height: 26px; }
.brand-txt h1 {
  font-size: var(--fs-xl); letter-spacing: 0.2px;
  background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--green) 55%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--green) 35%, transparent));
}
[data-theme="light"] .brand-txt h1, [data-theme="paper"] .brand-txt h1 { filter: none; }
.brand-sub { font-family: "JetBrains Mono", Vazirmatn, monospace; font-size: 10px; letter-spacing: 0.5px; }
.clocks { gap: 0; }
.clock { border-radius: 0; border: 0; background: none; padding: 2px var(--sp-3); min-width: 64px; position: relative; }
.clock + .clock::before { content: ""; position: absolute; right: 0; top: 18%; bottom: 18%; border-right: 2px dotted var(--border-strong); }
.clock.home { background: none; }
.clock.home .c-time { color: var(--green); text-shadow: 0 0 10px color-mix(in srgb, var(--green) 45%, transparent); }
.clock .c-time { letter-spacing: 0.5px; }
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: fixed; z-index: 9990; transform: translate(0, 28px); padding: 4px var(--sp-2);
  border-radius: var(--r-sm); background: var(--surface-solid); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: var(--sh-3); font-size: var(--fs-xs); white-space: nowrap; pointer-events: none; animation: fade-in var(--dur-2) ease both;
}
/* جلوگیری از اسکرول افقی صفحه در موبایل (RTL) */
@media (max-width: 767px) { html { overflow-x: clip; } }

/* --- کارت خبر --- */
.news-item {
  margin: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4) var(--sp-2) var(--sp-3); padding-right: calc(var(--sp-4) + 3px);
  border-radius: var(--r-md); animation: none; overflow: hidden;
  transition: border-color var(--dur-2), background var(--dur-2), transform var(--dur-3) var(--ease), box-shadow var(--dur-3);
}
.news-item::before { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 3px; background: var(--cc); opacity: 0.55; transition: opacity var(--dur-2), width var(--dur-2); }
.news-item.recent::before, .news-item:hover::before { opacity: 1; width: 4px; }
.news-item.recent { border-right: 1px solid var(--border); box-shadow: -18px 0 36px -26px var(--cc) inset; }
.news-item.cat-crisis { --cc: #eab308; }
.news-item.cat-cyber { --cc: var(--cyan); }
.news-item:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.news-item.ni-enter { animation: ni-enter 0.45s var(--ease) both; }
@keyframes ni-enter { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.src-av {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  font-size: 11px; font-weight: 800; line-height: 1; color: var(--g);
  background: color-mix(in srgb, var(--g) 16%, var(--surface-solid)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--g) 40%, transparent);
  font-family: "JetBrains Mono", Vazirmatn, sans-serif;
}
.cred .val { animation: ring-fill 1s var(--ease) both; }
@keyframes ring-fill { from { stroke-dashoffset: 119.4; } }
.ni-title { font-size: var(--fs-base); }
.ni-sum { font-size: var(--fs-sm); }
.ni-actions button, .ni-actions a { border-radius: var(--r-sm); }

/* --- پنل تنظیمات با منوی کناری --- */
.set-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.set-side { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); border-left: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 60%, transparent); overflow-y: auto; }
.set-search { flex: none; }
.set-search input { width: 100%; }
.set-layout .settings-tabs { flex-direction: column; gap: 2px; padding: 0; border: 0; overflow: visible; }
.set-layout .settings-tabs button { justify-content: flex-start; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); font-size: var(--fs-md); position: relative; }
.set-layout .settings-tabs button svg { width: 17px; height: 17px; }
.set-layout .settings-tabs button.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: transparent; }
.set-layout .settings-tabs button.active::before { content: ""; position: absolute; right: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.set-layout .drawer-body { padding: var(--sp-4); }
.drawer-settings { width: min(820px, 100vw); }
.set-section > h4 { font-size: var(--fs-base); gap: var(--sp-2); }
.set-section > h4 svg { color: var(--accent); }
.set-row { padding: var(--sp-3) var(--sp-3); border-radius: var(--r-md); gap: var(--sp-3); transition: background var(--dur-2), border-color var(--dur-2); }
.set-row:hover { border-color: var(--border-strong); }
.set-row.flash { animation: row-flash 1.6s ease 2; }
@keyframes row-flash { 50% { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); } }
.opt-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--surface-3); border: 1px solid var(--border); flex-wrap: wrap; }
.opt-seg button { border: 0; background: none; color: var(--text-dim); font-size: var(--fs-sm); font-weight: var(--fw-med); padding: 4px var(--sp-3); border-radius: 6px; transition: background var(--dur-2), color var(--dur-2); }
.opt-seg button.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--sh-1), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.opt-seg.sm button { padding: 2px var(--sp-2); font-size: var(--fs-xs); }
.card-opt.off label { opacity: 0.5; text-decoration: line-through; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.theme-card { position: relative; display: grid; gap: 6px; padding: var(--sp-2); border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); text-align: right; cursor: pointer; transition: transform var(--dur-2), box-shadow var(--dur-2), border-color var(--dur-2); }
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.tc-mock { display: grid; grid-template-rows: 14px 1fr; height: 78px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.tc-hdr { display: flex; gap: 3px; align-items: center; padding: 0 5px; background: var(--surface-solid); border-bottom: 1px solid var(--border); }
.tc-hdr i { width: 16px; height: 4px; border-radius: 2px; background: var(--surface-3); }
.tc-hdr i:first-child { width: 22px; background: var(--accent); }
.tc-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 4px; padding: 5px; }
.tc-card { display: grid; align-content: start; gap: 3px; padding: 4px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); }
.tc-card b { height: 5px; width: 60%; border-radius: 2px; background: var(--red); }
.tc-card b.alt { background: var(--green); }
.tc-card em { height: 3px; border-radius: 2px; background: var(--text-mute); opacity: 0.5; }
.tc-name { font-size: var(--fs-xs); font-weight: var(--fw-med); }
.tc-check { position: absolute; top: 6px; left: 6px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.tc-check svg { width: 13px; height: 13px; stroke-width: 2.5; }
.accent-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.accent-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface-solid); background: var(--c); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; transition: transform var(--dur-2), box-shadow var(--dur-2); }
.accent-dot:hover { transform: scale(1.12); }
.accent-dot.active { box-shadow: 0 0 0 2px var(--text), 0 0 14px var(--c); }
.map-style-grid, .layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--sp-2); }
.ms-card, .lay-card { display: grid; gap: 5px; padding: 6px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); font-size: var(--fs-xs); cursor: pointer; transition: border-color var(--dur-2), transform var(--dur-2); }
.ms-card:hover, .lay-card:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--border-strong); }
.ms-card.active, .lay-card.active { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent); }
.lay-card:disabled { opacity: 0.45; cursor: not-allowed; }
.ms-thumb { height: 46px; border-radius: 6px; background: #1f2937; }
.ms-auto .ms-thumb { background: linear-gradient(135deg, #1f2937 50%, #e5e7eb 50%); }
.ms-dark .ms-thumb { background: radial-gradient(circle at 30% 40%, #374151 0 20%, transparent 21%), #111827; }
.ms-light .ms-thumb { background: radial-gradient(circle at 30% 40%, #d1d5db 0 20%, transparent 21%), #f3f4f6; }
.ms-satellite .ms-thumb { background: radial-gradient(circle at 35% 45%, #6b5b3a 0 25%, transparent 26%), radial-gradient(circle at 70% 60%, #3f6212 0 18%, transparent 19%), #1e3a5f; }
.ms-topo .ms-thumb { background: repeating-radial-gradient(circle at 40% 50%, #d6c9a8 0 4px, #c9b98f 4px 6px), #d6c9a8; }
.ms-minimal .ms-thumb { background: repeating-linear-gradient(0deg, transparent 0 9px, #334155 9px 10px), repeating-linear-gradient(90deg, transparent 0 9px, #334155 9px 10px), #0b1220; }
.lay-thumb { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; gap: 3px; height: 46px; padding: 4px; border-radius: 6px; background: var(--surface-3); }
.lay-thumb i, .lay-thumb b { border-radius: 2px; background: var(--text-mute); opacity: 0.35; }
.lay-thumb b { grid-column: 2; grid-row: 1 / 4; background: var(--accent); opacity: 0.7; }
.lay-thumb i { grid-column: 1; }
.lay-news .lay-thumb { grid-template-columns: 1fr 1.3fr; }
.lay-map .lay-thumb i:first-child { background: var(--red); opacity: 0.7; grid-row: 1 / 3; }
.lay-radar .lay-thumb i:first-child { background: var(--purple); opacity: 0.7; grid-row: 1 / 3; }
.lay-map .lay-thumb, .lay-radar .lay-thumb { grid-template-columns: 1.6fr 1fr; }
.city-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.city-chips .chip b { font-size: 10px; margin-inline-end: 2px; color: var(--accent); }
.city-chips .chip.active { --c: var(--accent); }

/* --- مارکرهای نقشه --- */
.base-marker {
  position: relative; width: 28px; height: 28px; border-radius: 9px; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c, #60a5fa) 45%, #0b1220), color-mix(in srgb, var(--c, #60a5fa) 22%, #05080f));
  border: 1.5px solid var(--c, #60a5fa);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55), 0 0 12px color-mix(in srgb, var(--c, #60a5fa) 45%, transparent);
  transition: transform var(--dur-2) var(--ease);
}
.base-marker::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg); background: var(--c, #60a5fa); border-radius: 1px; z-index: -1; box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); }
.base-marker > svg, .base-marker > .wi { width: 17px; height: 17px; --ico-fill: color-mix(in srgb, #fff 18%, transparent); }
.leaflet-marker-icon:hover .base-marker { transform: translateY(-2px) scale(1.12); }
.base-marker.t-chokepoint, .base-marker.t-region { border-radius: 50%; }
.base-marker.t-chokepoint::after, .base-marker.t-region::after { display: none; }
.ev-marker { box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), 0 0 16px color-mix(in srgb, var(--c) 60%, transparent); }
.ev-marker::after { content: ""; position: absolute; inset: -5px; border-radius: 50% 50% 50% 0; border: 2px solid var(--c); opacity: 0; animation: ev-ping 2.4s ease-out infinite; }
@keyframes ev-ping { 0% { opacity: 0.8; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.7); } }
.ac-marker { width: 24px; height: 24px; }
.ac-marker svg.wi { width: 20px; height: 20px; fill: none; color: #cbd5e1; --ico-fill: currentColor; stroke: #0b1220; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)); }
.ac-marker.ac-mil svg.wi { color: #c084fc; filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.9)); }
.ac-marker.ac-tanker svg.wi { color: #fbbf24; filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.9)); }
.ac-marker.ac-recon svg.wi { color: #22d3ee; filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.9)); }
.ship-marker.wship { position: relative; width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--c) 18%, rgba(5, 8, 15, 0.75)); box-shadow: 0 0 0 1.5px var(--c), 0 2px 6px rgba(0, 0, 0, 0.5); }
.ship-marker.wship svg.wi { width: 18px; height: 18px; color: var(--c); --ico-fill: currentColor; fill: none; stroke: none; }
.ship-hdg { position: absolute; inset: -5px; border-radius: 50%; pointer-events: none; }
.ship-hdg::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-bottom: 6px solid var(--c); border-top: 0; }
.ship-marker.wship.hot { animation: none; }
.ship-marker.wship.hot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--c); animation: mv-ping 1.6s ease-out infinite; }

/* --- حالت فوکوس --- */
/* پوشش پشت کارت فوکوس داخل همان لایه .app (که z-index خودش را دارد) */
body.focus-mode .app::before { content: ""; position: fixed; inset: 0; z-index: 8990; background: var(--backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in var(--dur-2) ease both; }
body.focus-mode .app { z-index: 8800; }
.card.focused {
  position: fixed !important; inset: calc(var(--safe-t) + 12px) 12px calc(var(--safe-b) + 12px); z-index: 9000; margin: 0;
  display: flex; flex-direction: column; overflow: auto; box-shadow: var(--sh-4); animation: focus-in var(--dur-3) var(--ease) both;
}
.card.focused .map { height: calc(100dvh - 210px); }
.card.focused .radar-frame { height: calc(100dvh - 180px); }
.card.focused .news-list, .card.focused .timeline { overflow-y: auto; }
body.focus-mode .card.focused .cc-focus { color: var(--accent); opacity: 1; }
@keyframes focus-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
body.shooting .card, body.shooting .news-item { animation: none !important; transform: none !important; }

/* --- اندازه و نمایش کارت‌ها --- */
.card-hidden { display: none !important; }
.widget.size-s { min-height: 130px; }
.widget.size-l { grid-column: span 2; min-height: 280px; }
#mapCard.size-s .map { height: clamp(260px, 36vh, 420px); }
#mapCard.size-l .map { height: clamp(520px, 78vh, 980px); }
#radarCard.size-s .radar-frame { height: 300px; }
#radarCard.size-l .radar-frame { height: min(78vh, 900px); }
#timelineCard.size-s .timeline { max-height: 320px; overflow-y: auto; }

/* --- اندازه فونت در بخش‌های متنی (بدون تأثیر روی نقشه‌ها) --- */
.news-list, .widgets, .drawer-body, .modal-body, .timeline, .fi-list, .tabs, .news-toolbar, .ops-body, #opsBody { zoom: var(--ui-zoom); }

/* --- ناوبری موبایل --- */
@media (max-width: 767px) {
  .bottom-nav { --bn-n: 6; }
  .bottom-nav button { min-height: 44px; font-size: var(--fs-xs); }
  .bottom-nav button svg { width: 22px; height: 22px; }
  .bottom-nav button.active { color: var(--accent); }
  .bottom-nav button.active::before { display: none; }
  .bn-ind {
    position: absolute; top: 0; right: 0; width: calc(100% / var(--bn-n)); height: 3px; pointer-events: none;
    transform: translateX(calc(var(--bn-i, 0) * -100%)); transition: transform var(--dur-3) var(--ease); will-change: transform;
  }
  .bn-ind::before { content: ""; position: absolute; left: 50%; top: 0; width: 34px; height: 3px; transform: translateX(-50%); border-radius: 0 0 3px 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
  .icon-btn, .btn { min-height: 40px; }
  .icon-btn { min-width: 40px; }
  .hdr-actions .icon-btn { width: 40px; height: 40px; }
  .icon-btn.sm, .btn.sm, .btn.xs { min-height: 34px; }
  .ni-actions button, .ni-actions a { width: 40px; height: 40px; }
  .news-item { margin: var(--sp-2) 0; }
  .layout { padding-right: calc(var(--safe-r) + var(--sp-3)); padding-left: calc(var(--safe-l) + var(--sp-3)); }
  .set-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .set-side { border-left: 0; border-bottom: 1px solid var(--border); padding: var(--sp-2) var(--sp-3); }
  .set-layout .settings-tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .set-layout .settings-tabs button.active::before { right: 10px; left: 10px; top: auto; bottom: -3px; width: auto; height: 3px; }
  .widget.size-l { grid-column: auto; }
  .card.focused { inset: calc(var(--safe-t) + 6px) 6px calc(var(--safe-b) + 6px); }
  .widget:hover, .news-item:hover { transform: none; }
  /* هدر موبایل: یک ردیف دکمه با اسکرول افقی */
  .hdr-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: calc(100vw - 236px); padding-block: 2px; }
  .hdr-actions::-webkit-scrollbar { display: none; }
  .hdr-actions .icon-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  /* حداقل ناحیه لمس ۴۴px (به‌جز کنترل‌های داخل پنجره‌های کوچک مانیتور و تصویرها) */
  .icon-btn, .btn, .btn.sm, .btn.xs, .select, .tab, input[type="search"], input[type="text"] { min-height: 44px; }
  .icon-btn { min-width: 44px; }
  .ni-actions button, .ni-actions a { width: 44px; height: 44px; }
  .tv-hd .icon-btn.sm, .shot .icon-btn { min-width: 0; min-height: 0; }
  /* پرچم ثابت گوشه بالا-راست روی عنوان کشوها نیفتد */
  .drawer-hd { padding-right: calc(var(--safe-r, 0px) + 72px); }
  .brand-txt h1 { font-size: var(--fs-lg); }
  /* هدر کارت‌ها در موبایل: فشرده و بدون دکمه‌های کم‌کاربرد */
  .card-hd { flex-wrap: wrap; row-gap: var(--sp-2); }
  .card-kicker { font-size: 8.5px; letter-spacing: 1.2px; }
  .card-tools .cc-focus, .card-tools .cc-set { display: none; }
  .card-desc { white-space: normal; }
  /* پنل تنظیمات */
  .set-layout, .set-side, .set-layout > .drawer-body { min-width: 0; }
  .set-layout .drawer-body { overflow-x: hidden; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-style-grid, .layout-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ptr { color: var(--accent); }
  .ptr .ptr-radar { width: 22px; height: 22px; }
  .ptr:not(.pulling):not(.ready) .ptr-radar .wa-sweep { animation-duration: 1s; }
  .ptr.pulling .ptr-radar .wa-sweep { animation-play-state: paused; }
  .ptr.ready .ptr-radar { transform: scale(1.15); color: var(--green); }
}

/* --- کاهش حرکت --- */
.reduce-motion .wi-anim *, .reduce-motion .news-item, .reduce-motion .card, .reduce-motion .bn-ind { animation: none !important; transition: none !important; }
.reduce-motion .widget:hover, .reduce-motion .news-item:hover, .reduce-motion .theme-card:hover { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .wi-anim *, .ev-marker::after, .ship-marker.wship.hot::after { animation: none !important; }
  .widget:hover, .news-item:hover, .theme-card:hover, .ms-card:hover, .lay-card:hover { transform: none; }
}
