/* ============================================================
   سامانه تست مصرف دیتا — فاز ۱
   طراحی Mobile First و RTL
   ============================================================ */

:root {
  --bg: #080c18;
  --bg-soft: #0d1426;

  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #e8edf9;
  --muted: #8e9ab8;
  --faint: #626e8c;

  --brand-1: #22d3ee;
  --brand-2: #7c8cf8;
  --brand-3: #c084fc;

  --ok: #34d399;
  --fail: #fb7185;
  --warn: #fbbf24;
  --run: #38bdf8;

  --radius: 18px;
  --radius-sm: 12px;

  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.85);
  --aurora-opacity: 0.22;
  --title-gradient: linear-gradient(120deg, #ffffff 10%, #a5b4fc 55%, #67e8f9 100%);
  --on-accent: #04121a;
  --bg-glow: #131c36;
  --topbar-1: rgba(8, 12, 24, 0.92);
  --topbar-2: rgba(8, 12, 24, 0.72);
  --track: rgba(255, 255, 255, 0.07);
  --warn-text: #fde68a;
  --warn-bg: rgba(251, 191, 36, 0.07);
  --warn-line: rgba(251, 191, 36, 0.26);
}

/* ------------------------------------------------------------
   تم روشن
   سه حالت پشتیبانی می‌شود: انتخاب صریح کاربر، و در نبود آن،
   ترجیح سیستم‌عامل.
   ------------------------------------------------------------ */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #eef1f7;
    --bg-soft: #ffffff;

    --surface: rgba(255, 255, 255, 0.78);
    --surface-2: rgba(15, 23, 42, 0.05);
    --line: rgba(15, 23, 42, 0.1);
    --line-strong: rgba(15, 23, 42, 0.2);

    --text: #101828;
    --muted: #556076;
    --faint: #7b8698;

    --brand-1: #0891b2;
    --brand-2: #4f5fe0;
    --brand-3: #9333ea;

    --ok: #059669;
    --fail: #e11d48;
    --run: #0284c7;

    --shadow: 0 16px 40px -24px rgba(15, 23, 42, 0.45);
    --aurora-opacity: 0.16;
    --title-gradient: linear-gradient(120deg, #0f172a 10%, #4338ca 55%, #0e7490 100%);
    --on-accent: #ffffff;
    --bg-glow: #dbe4f5;
    --topbar-1: rgba(238, 241, 247, 0.94);
    --topbar-2: rgba(238, 241, 247, 0.74);
    --track: rgba(15, 23, 42, 0.09);
    --warn: #b45309;
    --warn-text: #92400e;
    --warn-bg: rgba(217, 119, 6, 0.1);
    --warn-line: rgba(180, 83, 9, 0.35);
  }
}

:root[data-theme='light'] {
  --bg: #eef1f7;
  --bg-soft: #ffffff;

  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: rgba(15, 23, 42, 0.05);
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.2);

  --text: #101828;
  --muted: #556076;
  --faint: #7b8698;

  --brand-1: #0891b2;
  --brand-2: #4f5fe0;
  --brand-3: #9333ea;

  --ok: #059669;
  --fail: #e11d48;
  --run: #0284c7;

  --shadow: 0 16px 40px -24px rgba(15, 23, 42, 0.45);
  --aurora-opacity: 0.16;
  --title-gradient: linear-gradient(120deg, #0f172a 10%, #4338ca 55%, #0e7490 100%);
  --on-accent: #ffffff;
  --bg-glow: #dbe4f5;
  --topbar-1: rgba(238, 241, 247, 0.94);
  --topbar-2: rgba(238, 241, 247, 0.74);
  --track: rgba(15, 23, 42, 0.09);
  --warn: #b45309;
  --warn-text: #92400e;
  --warn-bg: rgba(217, 119, 6, 0.1);
  --warn-line: rgba(180, 83, 9, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ویژگی hidden در HTML با display:none از شیوه‌نامه مرورگر کار می‌کند،
   که ویژگی‌اش از هر کلاسی کمتر است. هر کلاسی که display صریح دارد
   (مثل نوار «تلاش مجدد» با inline-flex) آن را بی‌اثر می‌کرد و عنصر
   همیشه دیده می‌شد. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  /* اعداد در ستون‌های گزارش باید هم‌عرض باشند تا مقایسه چشمی راحت شود */
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

h1, h2, h3, p, ol, ul, figure {
  margin: 0;
}

ol, ul {
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------
   پس‌زمینه متحرک
   ------------------------------------------------------------ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-glow) 0%, transparent 60%),
    var(--bg);
}

.aurora__blob {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--aurora-opacity);
  will-change: transform;
}

.aurora__blob--1 {
  background: var(--brand-1);
  top: -25vmax;
  inset-inline-end: -20vmax;
  animation: drift1 26s ease-in-out infinite alternate;
}

.aurora__blob--2 {
  background: var(--brand-3);
  bottom: -30vmax;
  inset-inline-start: -20vmax;
  animation: drift2 32s ease-in-out infinite alternate;
}

.aurora__blob--3 {
  background: var(--brand-2);
  top: 30%;
  inset-inline-start: 20%;
  opacity: 0.14;
  animation: drift3 38s ease-in-out infinite alternate;
}

@keyframes drift1 { to { transform: translate3d(-8vmax, 10vmax, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(10vmax, -8vmax, 0) scale(1.1); } }
@keyframes drift3 { to { transform: translate3d(-6vmax, -12vmax, 0) scale(0.9); } }

@media (prefers-reduced-motion: reduce) {
  .aurora__blob { animation: none; }
}

/* ------------------------------------------------------------
   نوار بالا
   ------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, var(--topbar-1), var(--topbar-2));
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.topbar__inner {
  max-width: 940px;
  margin: 0 auto;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand__mark {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 8px 22px -8px var(--brand-1);
}

.brand__mark svg { width: 21px; height: 21px; }

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand__text strong {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__text small {
  font-size: 14.7px;
  color: var(--muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__session {
  /* شناسه آزمون نباید عرض ثابت بگیرد وگرنه روی صفحه باریک
     نام سامانه را از کادر بیرون می‌راند */
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.topbar__session .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.topbar__tools {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* ------------------------------------------------------------
   دکمه تغییر تم
   ------------------------------------------------------------ */
.iconbtn {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: color 0.18s, border-color 0.18s, transform 0.18s;
}

.iconbtn:hover { color: var(--text); border-color: var(--line-strong); }
.iconbtn:active { transform: scale(0.93); }
.iconbtn svg { width: 18px; height: 18px; }

/* در تم تیره ماه دیده می‌شود و در تم روشن خورشید */
.iconbtn__sun { display: none; }
:root[data-theme='light'] .iconbtn__moon { display: none; }
:root[data-theme='light'] .iconbtn__sun { display: block; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .iconbtn__moon { display: none; }
  :root:not([data-theme='dark']) .iconbtn__sun { display: block; }
}

/* ------------------------------------------------------------
   چیدمان صفحه
   ------------------------------------------------------------ */
.page {
  max-width: 940px;
  margin: 0 auto;
  padding: 22px 18px calc(48px + env(safe-area-inset-bottom));
}

.view { display: none; }
.view--active {
  display: grid;
  gap: 16px;
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------
   سرتیتر
   ------------------------------------------------------------ */
.hero { text-align: center; padding: 14px 4px 2px; }

.hero__title {
  font-size: clamp(21px, 5.4vw, 29px);
  font-weight: 800;
  letter-spacing: -0.01em;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  margin-top: 9px;
  color: var(--muted);
  font-size: 17.9px;
  max-width: 46ch;
  margin-inline: auto;
}

.hero--done .hero__seal {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #05271c;
  background: linear-gradient(135deg, #6ee7b7, var(--ok));
  box-shadow: 0 14px 36px -12px var(--ok);
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero--done .hero__seal svg { width: 30px; height: 30px; }

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ------------------------------------------------------------
   کارت
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  box-shadow: var(--shadow);
}

.card--flush { padding: 17px 0 6px; }
.card--flush .card__title { padding-inline: 17px; }

.card__title {
  font-size: 16.6px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin-bottom: 13px;
}

.card__note {
  font-size: 16px;
  color: var(--faint);
  margin: -7px 0 13px;
  line-height: 1.7;
}

/* ------------------------------------------------------------
   انتخابگرها
   ------------------------------------------------------------ */
.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice--triple { grid-template-columns: repeat(3, 1fr); }

.choice__item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 12px;
  text-align: start;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.choice__item:hover { border-color: var(--line-strong); }
.choice__item:active { transform: scale(0.985); }

.choice__item.is-selected {
  border-color: transparent;
  background:
    linear-gradient(var(--bg-soft), var(--bg-soft)) padding-box,
    linear-gradient(135deg, var(--brand-1), var(--brand-3)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 10px 26px -14px var(--brand-2);
}

.choice__label { font-size: 17.9px; font-weight: 600; }
.choice__hint { font-size: 14.7px; color: var(--faint); }
.choice__item.is-selected .choice__hint { color: var(--muted); }

/* ------------------------------------------------------------
   خلاصه پیکربندی
   ------------------------------------------------------------ */
.summary {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 5px 16px;
}

.summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  font-size: 16.6px;
  border-bottom: 1px solid var(--line);
}

.summary__row:last-child { border-bottom: 0; }
.summary__row span { color: var(--muted); flex: none; }
.summary__row strong { font-weight: 600; text-align: end; }

/* ------------------------------------------------------------
   اعلان
   ------------------------------------------------------------ */
.notice {
  display: flex;
  gap: 11px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  font-size: 16.4px;
  line-height: 1.7;
  border: 1px solid;
}

.notice svg { width: 19px; height: 19px; flex: none; margin-top: 3px; }
.notice strong { display: block; font-weight: 700; }

.notice--warn {
  color: var(--warn-text);
  background: var(--warn-bg);
  border-color: var(--warn-line);
}

/* ------------------------------------------------------------
   دکمه
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 22px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 17px;
  font-weight: 700;
  transition: transform 0.16s, box-shadow 0.16s, opacity 0.16s;
}

.btn svg { width: 19px; height: 19px; }
.btn--block { width: 100%; }
.btn:active { transform: translateY(1px) scale(0.994); }

.btn--primary {
  color: var(--on-accent);
  background: linear-gradient(120deg, var(--brand-1), var(--brand-2) 60%, var(--brand-3));
  box-shadow: 0 16px 34px -16px var(--brand-2);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
  font-weight: 600;
}

.btn--ghost:hover { border-color: var(--line-strong); color: var(--text); }

.btn[disabled] { opacity: 0.5; pointer-events: none; }

.fineprint {
  text-align: center;
  font-size: 15.4px;
  color: var(--faint);
  line-height: 1.8;
  padding: 0 10px;
}

/* ------------------------------------------------------------
   سر صفحه اجرا — حلقه پیشرفت
   ------------------------------------------------------------ */
.runhead { text-align: center; padding: 6px 0 2px; }

.runhead__meter {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto 16px;
}

.ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring__track {
  fill: none;
  stroke: var(--track);
  stroke-width: 8;
}

.ring__value {
  fill: none;
  stroke: var(--brand-1);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 0 9px rgba(34, 211, 238, 0.55));
}

.runhead__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 2px;
}

.runhead__pct {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.runhead__steps { font-size: 15.4px; color: var(--muted); }

.runhead__title {
  font-size: 20px;
  font-weight: 700;
}

.runhead__detail {
  margin-top: 5px;
  font-size: 16.6px;
  color: var(--muted);
}

.retry {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
}

.retry__spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--warn-line);
  border-top-color: var(--warn-text);
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   آمار زنده
   ------------------------------------------------------------ */
.live {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.live__item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  text-align: center;
}

.live__label {
  display: block;
  font-size: 14.1px;
  color: var(--muted);
  margin-bottom: 3px;
}

.live__value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.live__value em {
  font-style: normal;
  font-size: 13.4px;
  font-weight: 500;
  color: var(--faint);
  margin-inline-start: 2px;
}

/* ------------------------------------------------------------
   نوار پیشرفت مرحله
   ------------------------------------------------------------ */
.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.bar__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-3));
  transition: width 0.35s ease;
}

/* ------------------------------------------------------------
   نمایشگر ویدئو
   ------------------------------------------------------------ */
.stage {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  aspect-ratio: 16 / 9;
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stage__badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 14.7px;
  font-weight: 700;
  color: var(--on-accent);
  background: linear-gradient(120deg, var(--brand-1), var(--brand-2));
}

/* ------------------------------------------------------------
   دکمه صدا
   ویدئو بی‌صدا شروع می‌شود چون مرورگرهای موبایل پخش خودکارِ
   صدادار را اجازه نمی‌دهند؛ این دکمه صدا را با لمس کاربر باز می‌کند.
   ------------------------------------------------------------ */
.stage__sound {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.18s, transform 0.18s;
}

.stage__sound:hover { background: rgba(0, 0, 0, 0.68); }
.stage__sound:active { transform: scale(0.92); }
.stage__sound svg { width: 19px; height: 19px; }

.stage__sound .stage__sound-on { display: none; }
.stage__sound[aria-pressed='true'] .stage__sound-off { display: none; }
.stage__sound[aria-pressed='true'] .stage__sound-on { display: block; }

/* ------------------------------------------------------------
   فهرست مراحل
   ------------------------------------------------------------ */
.steps {
  display: grid;
  /* بدون این، متن بلندِ nowrap داخل ردیف‌ها ستون را پهن‌تر از
     کادر می‌کرد و فهرست از پنل بیرون می‌زد */
  grid-template-columns: minmax(0, 1fr);
}

.steps__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 17px;
  border-top: 1px solid var(--line);
  transition: background 0.2s;
  min-width: 0;
}

.steps__item:first-child { border-top: 0; }
.steps__item.is-running { background: rgba(56, 189, 248, 0.06); }

.steps__icon {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14.1px;
  font-weight: 700;
  border: 1.5px solid var(--line-strong);
  color: var(--faint);
}

.steps__item.is-success .steps__icon {
  border-color: transparent;
  background: rgba(52, 211, 153, 0.16);
  color: var(--ok);
}

.steps__item.is-failed .steps__icon {
  border-color: transparent;
  background: rgba(251, 113, 133, 0.16);
  color: var(--fail);
}

.steps__item.is-skipped .steps__icon {
  border-style: dashed;
}

.steps__item.is-running .steps__icon {
  border-color: var(--run);
  color: var(--run);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
}

.steps__body { flex: 1; min-width: 0; }

.steps__name {
  font-size: 17.3px;
  font-weight: 600;
  display: block;
}

.steps__meta {
  font-size: 14.7px;
  color: var(--faint);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.steps__tag {
  flex: none;
  font-size: 13.4px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.steps__item.is-success .steps__tag { color: var(--ok); background: rgba(52, 211, 153, 0.12); }
.steps__item.is-failed .steps__tag { color: var(--fail); background: rgba(251, 113, 133, 0.12); }
.steps__item.is-running .steps__tag { color: var(--run); background: rgba(56, 189, 248, 0.12); }

/* ------------------------------------------------------------
   جدول گزارش
   ------------------------------------------------------------ */
.tablewrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16.6px;
  min-width: 380px;
}

.table th,
.table td {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  text-align: start;
  white-space: nowrap;
}

.table thead th {
  border-top: 0;
  font-size: 14.7px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
}

.table td:not(:first-child),
.table th:not(:first-child) { text-align: end; }

.table td:first-child { color: var(--muted); }

.table .num { font-weight: 700; }
.table .better { color: var(--ok); }

/* ------------------------------------------------------------
   اقدامات پایانی
   ------------------------------------------------------------ */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ------------------------------------------------------------
   نمایشگرهای بزرگ‌تر
   ------------------------------------------------------------ */
@media (min-width: 700px) {
  body { font-size: 19.8px; }

  .page { padding: 30px 24px 60px; }

  .view--active { gap: 18px; }

  .card { padding: 21px; }
  .card--flush { padding: 21px 0 8px; }
  .card--flush .card__title { padding-inline: 21px; }

  .steps__item { padding: 12px 21px; }

  .runhead__meter { width: 190px; height: 190px; }
  .runhead__pct { font-size: 42px; }
}

/* ============================================================
   شبکه داشبورد گزارش
   ============================================================ */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.kpi {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 14px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.kpi::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--kpi-accent, var(--brand-1));
}

.kpi__label {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 2px;
}

.kpi__value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  display: block;
}

.kpi__value em {
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-inline-start: 4px;
}

.kpi__sub {
  display: block;
  font-size: 12.5px;
  color: var(--faint);
  margin-top: 2px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 15px 0 12px;
  min-width: 0;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 12px;
}

.panel__title {
  font-size: 15.5px;
  font-weight: 700;
}

.panel__unit {
  font-size: 12.5px;
  color: var(--faint);
  direction: ltr;
}

.panel__body {
  padding: 0 12px;
  color: var(--text);
  min-width: 0;
  overflow-x: auto;
}

.panel__body--center {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.panel__note {
  padding: 10px 16px 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--faint);
}

.panel .steps__item:first-child { border-top: 0; }

/* عدد بزرگ مرکزی */
.bignum { text-align: center; }

.bignum strong {
  display: block;
  font-size: clamp(32px, 9vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: linear-gradient(120deg, var(--brand-1), var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bignum span {
  font-size: 13px;
  color: var(--muted);
}

.donuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.donut {
  flex: 1 1 160px;
  max-width: 210px;
  text-align: center;
}

.donut__caption {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

.donut__empty {
  display: grid;
  place-items: center;
  min-height: 150px;
  font-size: 13px;
  color: var(--faint);
}

/* راهنمای رنگ‌ها */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 16px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.legend__key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend__swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: none;
}

@media (min-width: 700px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }

  .grid { grid-template-columns: 2fr 1fr; }

  .panel--wide { grid-column: span 1; }
  .panel--full { grid-column: 1 / -1; }

  .panel { padding: 18px 0 14px; }
  .panel__head { padding: 0 20px 14px; }
  .panel__body { padding: 0 16px; }
  .panel__note, .legend { padding-inline: 20px; }
}

/* ============================================================
   جهت اعداد و واحدها
   ============================================================
   در متن راست‌به‌چپ، ترکیب «عدد + واحد لاتین» باید یک جزیره
   چپ‌به‌راست باشد، وگرنه واحد به سمت اشتباه عدد پرتاب می‌شود.
   isolate جلوی اثرگذاری این جزیره روی چیدمان بقیه متن را می‌گیرد. */
.live__value,
.bignum,
.kpi__value,
.table .num {
  direction: ltr;
  unicode-bidi: isolate;
}

.live__value,
.bignum,
.kpi__value { text-align: center; }

.table .num { text-align: end; }

/* واحد همیشه پس از عدد می‌آید */
.live__value em,
.kpi__value em {
  margin-inline-start: 4px;
  margin-inline-end: 0;
}

/* ------------------------------------------------------------
   جدول کوچک سربار شبکه
   ------------------------------------------------------------ */
.overhead {
  width: 100%;
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.overhead__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
}

.overhead__row span { color: var(--muted); }

.overhead__row strong {
  font-weight: 700;
  direction: ltr;
  unicode-bidi: isolate;
}
