/* =============================================================================
   پایپ‌لاین محتوا — سیستم طراحی راست‌به‌چپ (یک فایل، بدون build)
   فونت: Vazirmatn (variable, خودمیزبانی‌شده در fonts/ — بدون وابستگی به CDN
   خارجی، چون fonts.google.com برای کاربران ایرانی همیشه در دسترس/سریع نیست).
   حروفِ لاتینِ این فونت عمداً هم‌خانواده با حروفِ فارسی طراحی شده، پس همان
   یک فونت برای فارسی و انگلیسیِ توی متن هم به کار می‌رود — نیازی به یک
   فونتِ لاتینِ جدا نیست. مجوز: SIL OFL 1.1 (fonts/Vazirmatn-OFL.txt).
   -----------------------------------------------------------------------------
   واژه‌نامهٔ کلاس‌ها (Task 9):

   پوسته و چیدمان
     .frame .readable             قابِ واحدِ صفحه (هدر + همه‌ی صفحه‌ها) و ستونِ خوانای فرم/متن داخلِ آن
     .site-header .site-header__brand .site-nav .site-header__user
     .page-title                 اسلات <h1> صفحه (بلوک page_title در base.html)
     .breadcrumb                 مسیر راهنما (بلوک breadcrumb)
     .messages                   فهرست پیام‌های جنگو
     .banner .banner--warn       بنر هشدار سطح‌صفحه

   بلوک‌ها
     .card                       کارت محتوایی با حاشیه و سایهٔ ملایم
     .stack                      فاصله‌گذاری عمودی بین فرزندان
     .cluster                    ردیف افقی با wrap و gap
     .meta-list                  <dl> کلید/مقدار (متادیتای ران/پروژه/بریف)
     .empty-state                حالت خالی (متن کم‌رنگ داخل کادر نقطه‌چین)
     .muted                      متن کم‌رنگ درون‌خطی (color: var(--muted))
     .conn-meta                  متادیتای نسخه/تاریخِ اتصال وردپرس؛ block و زیر نشان وضعیت

   جدول
     .table-wrap                 پوشش overflow-x برای جدول‌ها
     table                       استایل پایه راه‌راه/واکنش‌گرا

   نشان‌ها (badge) — یک کلاس به ازای هر مقدار وضعیت
     .badge
     Run.Status:      .badge--queued .badge--running .badge--awaiting_decision
                      .badge--failed .badge--done .badge--canceled
     RunPhase.PhaseStatus: .badge--running .badge--ok .badge--failed .badge--pending
     Decision:        .badge--pending .badge--resolved

   دکمه‌ها — سلسله‌مراتب واحد (U5):
     .btn--primary               اقدامِ اصلیِ صفحه (یکی در هر ناحیه)
     .btn                        اقدامِ ثانویه (حاشیه‌دار)
     .btn--ghost                 ناوبری/اقدامِ سوم
     .btn--danger-ghost          اقدامِ مخرب روی صفحه (کم‌وزن، متنِ قرمز) — همیشه با data-confirm
     .btn--danger                فقط دکمه‌ی تأییدِ نهاییِ یک اقدامِ مخرب (دیالوگ تأیید)
     .btn--small                 اندازه‌ی فشرده برای جدول/سایدبار
     .is-busy                    حالت «در حال اجرا…» (data-busy-text / کار فعال)

   رفتارها (static/app.js — بدون <script> درون قالب)
     .app-confirm                دیالوگ تأیید مشترک (data-confirm / hx-confirm)
     .toast-region .toast        بازخورد گذرا
     .loading-state .error-state بارگذاری پنلِ تنبل / شکستِ آن با دکمه‌ی تلاش دوباره

   فرم‌ها
     .form (اختیاری روی <form>)   استایل input/select/textarea/«form.as_p»

   نوار پیشرفت ۸ فازی
     .phase-strip .phase .phase__label .phase__state
     .phase--pending .phase--running .phase--ok .phase--failed .phase--skipped

   فید رویداد
     .event-feed .event .event__msg
     .event--info .event--warn .event--error .event--empty

   کارت تصمیم
     .decision-card .decision-card__kind .decision-card__body
     .decision-card__actions .decision-card__warning

   معماریِ یکپارچه‌ی کار و گزارش (فاز ۱ — فقط صفحه‌ی پیش‌نمایش کامپوننت‌ها)
     .status-widget (+ --compact) __head __icon __label __percent __meta __message __actions
     .progress (+ --indeterminate)   <progress> بومی؛ بدون value = نامعین
     .cost-badge (+ --free --quota --paid)
     .report-header __top __text __title __purpose __action __status __meta __schedule __stale
     .task-button .prereq (+ --met) .prereq-list .snapshot-menu
     .task-card __head __purpose __summary __footer  ·  .task-card-grid
     .report-tile __title __value __label  ·  .report-tile-grid
     .chain .chain__link

   پیش‌نمایش خروجی (هوک‌های Task 5/8)
     .artifact-frame             <iframe> پیش‌نمایش خروجی sandbox
     .preview-body               HTML امن رندرشدهٔ خودمان
     .artifact-image             <img> پیش‌نمایش تصویر
     iframe.report-embed         گزارش هفتگی ایزوله (srcdoc)
   ============================================================================= */

@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-variable.f6d31671339d.woff2") format("woff2-variations"),
       url("fonts/Vazirmatn-variable.f6d31671339d.woff2") format("woff2 supports variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --font-sans: Vazirmatn, Tahoma, "Segoe UI", Arial, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "Courier New", monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --fg: #1a1d21;
  --muted: #5b6470;
  --border: #d9dde3;
  --border-strong: #c2c8d0;

  --primary: #1d4ed8;
  --primary-fg: #ffffff;
  --primary-weak: #e6edff;
  --danger: #b91c1c;
  --danger-fg: #ffffff;
  --danger-weak: #fdecec;
  --success: #15803d;
  --success-weak: #e5f4ea;
  --warning: #92600a;
  --warning-weak: #fbf0dc;
  --info: #1d4ed8;
  --info-weak: #e6edff;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --frame-max: 1440px;     /* the ONE page frame: header + every page (owner rule 2026-09-24) */
  --gutter: var(--space-4); /* 16px side gutter at every width */
  --readable-max: 720px;   /* forms / long prose column inside the frame */
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #14171c;
    --surface: #1c2026;
    --surface-2: #232830;
    --fg: #e6e8eb;
    --muted: #9aa4b1;
    --border: #333a44;
    --border-strong: #434c58;

    --primary: #4f83ff;
    --primary-fg: #0b1220;
    --primary-weak: #1e2b47;
    --danger: #f87171;
    --danger-fg: #1a0d0d;
    --danger-weak: #3a2222;
    --success: #4ade80;
    --success-weak: #1c3327;
    --warning: #fbbf24;
    --warning-weak: #3a3018;
    --info: #4f83ff;
    --info-weak: #1e2b47;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

/* `hidden` always wins over a component's own display (flex/grid) -- the
   idle «در جریان» card relies on it (phase 3). */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--fg);
  background: var(--bg);
  direction: rtl;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  line-height: 1.35;
  margin: 0 0 var(--space-3);
}

p {
  margin: 0 0 var(--space-3);
}

img {
  max-width: 100%;
  height: auto;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
}

/* ---------- پوسته ---------- */

/* The single page frame (owner rule, 2026-09-24): the header and every page
   share one max-width and one side gutter, so neighbouring pages never jump
   between widths. No template chooses its own page width. */
.frame {
  width: 100%;
  max-width: var(--frame-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Forms and long prose sit in a readable column INSIDE the frame, aligned to
   the start (right in RTL) under the page title -- never a different frame. */
.readable {
  max-width: var(--readable-max);
  margin-inline-end: auto;
}

.site-header {
  position: sticky;
  top: 0;
  /* above ordinary page content, but BELOW the mobile drawer (90) and its
     backdrop (85) -- the drawer is a modal-like overlay while open and its
     own close button must be clickable, not fought over with the sticky
     header sitting on top of it (2026-09-17: confirmed live, the header's
     z-index was accidentally higher than the drawer's and ate every click
     near the top of the open drawer). */
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  position: relative; /* anchors .site-nav-panel's absolute top:100% on mobile */
  padding-block: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}


.site-header__brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
}

.site-header__brand:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}

.site-nav a {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--fg);
  background: var(--surface-2);
  text-decoration: none;
}

.site-header__user {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-header__user form {
  margin: 0;
}


/* ---------- منوهای کشویی ناوبری ---------- */

.nav-dropdown {
  position: relative;
}

.nav-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-dropdown__trigger:hover {
  color: var(--fg);
  background: var(--surface-2);
}

.nav-dropdown__trigger::after {
  content: "▾";
  font-size: 10px;
}

.nav-dropdown__trigger--account {
  color: var(--fg);
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 50;
}

.nav-dropdown__menu--end {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

.nav-dropdown__menu.is-open {
  display: block;
}

/* :not(.site-nav-panel) matters: .site-nav-panel also carries the
   .nav-dropdown__menu class (to reuse the same open/close JS), but its
   <a> children are the real top-level nav links (داشبورد/پروژه‌ها/...),
   not small-dropdown-menu items -- without this exclusion they used to
   get width:100% of .site-nav-panel and each wrap onto its own full-width
   row, breaking the desktop header (2026-09-17). */
.nav-dropdown__menu:not(.site-nav-panel) a,
.nav-dropdown__logout {
  display: block;
  width: 100%;
  text-align: start;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-weight: 500;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

.nav-dropdown__menu:not(.site-nav-panel) a:hover,
.nav-dropdown__logout:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.nav-dropdown__menu form {
  margin: 0;
}

/* ---------- راهنمای شناور (tooltip) ----------
   Reusable anywhere: wrap a trigger + a .tip__content in .tip. Desktop:
   hovering the trigger (or anything else inside .tip) reveals it, pure
   CSS. Touch has no reliable hover, so .tip__icon (hidden on desktop) is
   also a real tap target using the same open/close JS as every other
   dropdown/drawer on the page (.tip__content also carries
   .nav-dropdown__menu so it participates in that shared mechanism). */

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-sans);
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

/* .tip__content is a bare positioning anchor only -- position:absolute
   elements in this browser do not correctly compute their own height for
   wrapped bidi (mixed Persian/Latin) text: every width/min-width/max-width
   combination tried still froze the box at one line's height while the
   text silently overflowed, invisible (light tooltip text over the page's
   own light background) below it (2026-09-17, confirmed by directly
   comparing position:absolute vs position:relative on the identical
   element: relative wrapped correctly, absolute never did). The real,
   sized, padded, wrapping bubble is .tip__bubble, a NORMAL-FLOW child of
   this absolutely-positioned anchor -- normal-flow layout inside an
   absolute parent wraps correctly, sidestepping the bug entirely. */
.tip__content {
  display: none;
  position: absolute;
  top: auto; /* cancel .nav-dropdown__menu's own `top: calc(100% + 4px)` --
    .tip__content carries that class only for the shared JS open/close
    mechanism, but both rules apply since they set different properties;
    with top and bottom both non-auto the box's height is FORCED to fill
    the gap between them, which for a short .tip trigger collapses to
    ~0 and clips the tooltip to a sliver (2026-09-17, confirmed via
    getComputedStyle: contentTop was "calc(100% + 4px)" though this rule
    never set one). */
  bottom: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 70;
}

.tip:hover .tip__content {
  display: block;
}

.tip__bubble {
  display: block;
  min-width: 200px;
  max-width: 240px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  text-align: start;
  white-space: normal;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}


.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- منوی موبایل (همبرگر) ----------
   Desktop: the hamburger button is hidden and .site-nav-panel is just
   normal always-visible inline nav content (the .nav-dropdown__menu base
   rule below is overridden by this more specific selector). Mobile: the
   panel becomes a toggleable dropdown using the exact same
   data-dropdown-toggle mechanism as every other nav dropdown, so opening
   e.g. اجراها *inside* it doesn't close the whole panel. */

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  padding: 0;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  margin-inline: auto;
  background: var(--fg);
  border-radius: 1px;
}

.nav-dropdown__menu.site-nav-panel {
  display: flex;
  position: static;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}

@media (max-width: 720px) {
  .nav-hamburger {
    display: flex;
  }
  .nav-dropdown__menu.site-nav-panel {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: var(--space-3);
    z-index: 60;
  }
  .nav-dropdown__menu.site-nav-panel.is-open {
    display: flex;
  }
  .site-nav-panel .site-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .site-nav-panel .site-header__user {
    margin-inline-start: 0;
  }
  .site-nav-panel .nav-dropdown__menu:not(.site-nav-panel) {
    position: static;
    box-shadow: none;
    border: none;
    padding-inline-start: var(--space-3);
  }
}

/* ---------- چیدمانِ صفحه ----------
   #page-frame is always `.app-shell.frame`: the page frame for every page.
   .app-main fills the frame. */

.app-shell {
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  padding-block: var(--space-5) var(--space-6);
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--fg);
}

.page-title {
  font-size: 1.6rem;
  margin-bottom: var(--space-5);
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.messages li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--info);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* `.messages li` above sets the info look; the level classes must out-rank it (7.39.1: they did not, so an error looked like info) */
.messages .message--success { border-inline-start-color: var(--success); background: var(--success-weak); }
.messages .message--warning { border-inline-start-color: var(--warning); background: var(--warning-weak); }
.messages .message--error { border-inline-start-color: var(--danger); background: var(--danger-weak); }

.message__close {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0 var(--space-1);
  font-size: 1.1rem;
  line-height: 1.4;
  color: var(--muted);
}

/* بنر هشدار سطح‌صفحه (مثلاً سند پرامپت بازبینی‌نشده) */
.banner {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: var(--space-5);
}

.banner--warn {
  border: 1px solid var(--warning);
  border-inline-start: 4px solid var(--warning);
  background: var(--warning-weak);
}

.banner--warn a {
  color: var(--warning);
  font-weight: 700;
}

.banner--danger {
  border: 1px solid var(--danger);
  border-inline-start: 4px solid var(--danger);
  background: var(--danger-weak);
  color: var(--fg);
}

.banner--info {
  border: 1px solid var(--info);
  border-inline-start: 4px solid var(--info);
  background: var(--info-weak);
}

/* ---------- بلوک‌ها ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
}

.card > :last-child {
  margin-bottom: 0;
}

.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}

section {
  margin-bottom: var(--space-5);
}

.stack > * + * {
  margin-top: var(--space-3);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

/* A <form> wrapping a single button is a normal flex item of the row --
   never its own block with a bottom margin. (A <form> must never sit inside
   a <p class="cluster">: the parser closes the <p> at the <form>, leaving an
   empty row and each form on its own line; use <div class="cluster">.) */
.cluster > form {
  margin: 0;
}

.meta-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-4);
  margin: 0;
}

.meta-list dt {
  color: var(--muted);
  font-weight: 600;
}

.meta-list dd {
  margin: 0;
  word-break: break-word;
}

@media (max-width: 560px) {
  .meta-list {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .meta-list dd {
    margin-bottom: var(--space-2);
  }
}

.empty-state {
  padding: var(--space-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
}

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

.small {
  font-size: 0.85rem;
}

/* A URL/path/code-ish value inside Persian prose: isolated LTR run. */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Lazy panel placeholder -- visually distinct from an empty state, so
   "loading" never looks like "there is nothing here". */
.loading-state {
  padding: var(--space-4);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.loading-state::before,
.is-busy::before {
  content: "";
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -0.12em;
  margin-inline-end: 0.4em;
  animation: spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-state::before,
  .is-busy::before {
    animation: none;
  }
}

.error-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-weak);
  color: var(--fg);
  margin-bottom: var(--space-5);
}

.form-errors,
.form-errors ul.errorlist {
  color: var(--danger);
  font-weight: 600;
}

.form-errors {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--danger-weak);
  margin-bottom: var(--space-3);
}

/* «منطقه‌ی خطر» -- destructive actions live at the bottom of a settings
   page, never next to navigation (U5). */
.danger-zone {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  background: var(--surface);
}

.danger-zone h2 {
  color: var(--danger);
  font-size: 1.05rem;
}

/* متادیتای اتصال وردپرس — بیرونِ pill نشان، در سطر خودش زیر آن */
.conn-meta {
  display: block;
  margin-top: var(--space-1);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- جدول ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
  /* Scroll-edge shadows: the "local" layers cover the shadows while the
     table sits at that edge, so a shadow only shows where more columns are
     hidden -- a CSS-only hint that the table scrolls sideways (U9). */
  background:
    linear-gradient(to left, var(--surface) 30%, transparent) right center / 24px 100% no-repeat local,
    linear-gradient(to right, var(--surface) 30%, transparent) left center / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.18), transparent) right center / 10px 100% no-repeat scroll,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.18), transparent) left center / 10px 100% no-repeat scroll,
    var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead th {
  text-align: start;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

th, td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: var(--surface-2);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.num {
  white-space: nowrap;
}

/* Sortable column header (server-side sort -- a plain link). */
th a.sort-link {
  color: inherit;
}

th a.sort-link[aria-sort] {
  color: var(--fg);
}

/* ---------- جدول‌های پشته‌ای در موبایل (U9) ----------
   Opt-in: <table class="table--stack"> + data-label="..." on every <td>.
   Under 720px each row becomes a small card with "label: value" lines
   instead of a squeezed table that scrolls off-screen. */
@media (max-width: 720px) {
  table.table--stack thead {
    display: none;
  }
  table.table--stack,
  table.table--stack tbody,
  table.table--stack tr,
  table.table--stack td {
    display: block;
    width: 100%;
  }
  table.table--stack tr {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
  }
  table.table--stack tbody tr:last-child {
    border-bottom: 0;
  }
  table.table--stack td {
    border: 0;
    padding: 2px 0;
    display: flex;
    gap: var(--space-2);
  }
  /* A long LTR URL is one unbreakable word: without these the flex item keeps
     its content width and spills past the card's edge at 390px. */
  table.table--stack td > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  /* a cell with several lines/badges wraps them in one .cell-stack so the flex row sees one item */
  table.table--stack td > .cell-stack {
    flex: 1 1 0;
  }
  table.table--stack td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 7.5rem;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
  }
  .col-optional {
    display: none;
  }
}

/* ---------- نشان‌ها ---------- */

.badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--muted);
}

.badge--queued { background: var(--info-weak); color: var(--info); }
.badge--running { background: var(--info-weak); color: var(--info); }
.badge--awaiting_decision { background: var(--warning-weak); color: var(--warning); }
.badge--failed { background: var(--danger-weak); color: var(--danger); }
.badge--done { background: var(--success-weak); color: var(--success); }
.badge--canceled { background: var(--surface-2); color: var(--muted); }
.badge--ok { background: var(--success-weak); color: var(--success); }
.badge--pending { background: var(--warning-weak); color: var(--warning); }
.badge--resolved { background: var(--success-weak); color: var(--success); }
.badge--muted { background: var(--surface-2); color: var(--muted); }
.badge--warn { background: var(--warning-weak); color: var(--warning); }
.badge--info { background: var(--info-weak); color: var(--info); }
.badge--money { background: var(--warning-weak); color: var(--warning); border-color: var(--warning); }
.badge--cost { background: var(--warning-weak); color: var(--warning); font-weight: 600; font-size: 0.72rem; }
/* Task.Status / Outcome / VerificationStatus -- same token pairs as
   everything else, so dark mode works (done/resolved/pending above). */
.badge--new { background: var(--info-weak); color: var(--info); }
.badge--in_progress { background: var(--info-weak); color: var(--info); }
.badge--dismissed, .badge--acknowledged { background: var(--surface-2); color: var(--muted); }
.badge--snoozed { background: var(--info-weak, var(--surface-2)); color: var(--info, var(--muted)); }
.badge--improved,
.badge--confirmed { background: var(--success-weak); color: var(--success); }
.badge--unchanged,
.badge--not_confirmed { background: var(--warning-weak); color: var(--warning); }
.badge--worsened { background: var(--danger-weak); color: var(--danger); }
.badge--small { font-size: 0.72rem; padding: 0 0.45rem; font-weight: 600; }

/* ---------- دکمه‌ها ---------- */

.btn,
button {
  font: inherit;
  font-weight: 600;
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  line-height: 1.5;
  text-decoration: none;
}

.btn:hover,
button:hover {
  border-color: var(--muted);
  text-decoration: none;
}

.btn:disabled,
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.is-busy:disabled {
  opacity: 0.8;
  cursor: progress;
}

.btn--small {
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* htmx puts this class on whichever element issued a request (the link,
   button, form, or select itself, by default) for as long as it's in
   flight -- without this rule an hx-get click gives the user zero feedback
   that anything happened until the swap lands, which reads as "broken" on
   a slow request rather than "loading" (2026-09-16). */
/* Only elements the user actually clicked/submitted get this feedback --
   never containers. Polling roots (#progress, the site-jobs panels, the
   server monitor) issue their own requests every few seconds, and the old
   global `.htmx-request { pointer-events:none }` faded and froze each whole
   panel -- and, for the SSE refresh, the entire <body> -- on every tick, so
   clicks on its cancel buttons were dropped at random (2026-09-24). */
a.htmx-request,
button.htmx-request,
select.htmx-request,
input.htmx-request,
form.htmx-request [type="submit"],
form.htmx-request button:not([type="button"]) {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}

/* ---------- تب‌بار ----------
   Was copy-pasted per-page as .gsc-tabbar (gsc_analysis.html, gsc_signals.html)
   and reinvented again as .anchor-memory .btn.active -- one of those copies
   referenced an undefined --accent variable, making its active tab
   invisible (2026-09-16). One shared definition means a broken token can't
   hide in a page-local <style> block again, and every new tabbed panel gets
   the correct look by using this class instead of writing its own. */

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tabbar a {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  color: var(--fg);
}

@media (max-width: 720px) {
  .tabbar a {
    min-height: 36px;
  }
}

/* Per-project navigation (U5): one row of tabs under the page title on every
   project page, replacing buttons scattered across the page and sidebar. */
.project-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--space-1);
  margin: calc(-1 * var(--space-3)) 0 var(--space-5);
  border-bottom: 1px solid var(--border);
}

.project-nav__item {
  position: relative;
  display: flex;
  align-items: stretch;
}

.project-nav__item > a {
  padding: var(--space-2) var(--space-3);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.project-nav__item > a:hover {
  color: var(--fg);
  text-decoration: none;
}

.project-nav__item > a[aria-current="page"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Tabs that have a drop-down: the caret sits flush against the tab link. */
.project-nav__item--menu > a {
  padding-inline-end: var(--space-1);
}

.project-nav__caret {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding-block: 0;
  padding-inline-start: var(--space-1);
  padding-inline-end: var(--space-2);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font: inherit;
}

.project-nav__caret::after {
  content: "▾";
  font-size: 10px;
}

.project-nav__caret:hover,
.project-nav__item--menu:hover > a,
.project-nav__item--menu.is-open .project-nav__caret {
  color: var(--fg);
}

.project-nav__item:has(> a[aria-current="page"]) > .project-nav__caret {
  border-bottom-color: var(--primary);
}

.project-nav__menu {
  display: none;
  position: absolute;
  top: calc(100% + 1px);
  inset-inline-start: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}

.project-nav__menu.is-open {
  display: block;
}

/* Invisible bridge so a diagonal mouse move from the tab into the menu
   never crosses a hover gap. */
.project-nav__menu::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: -8px;
  height: 8px;
}

.project-nav__menu a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
}

.project-nav__menu a:hover,
.project-nav__menu a:focus-visible {
  background: var(--surface-2);
  text-decoration: none;
}

.project-nav__menu a.is-current {
  color: var(--primary);
  font-weight: 700;
  background: var(--surface-2);
}

.project-nav__item > a:focus-visible,
.project-nav__caret:focus-visible,
.project-nav__menu a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.tabbar a.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  font-weight: 700;
}

/* ---------- نوار بارگذاری سراسری ---------- */

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  transform-origin: right; /* RTL page: the bar grows from the right edge */
  transform: scaleX(0);
  opacity: 0;
  z-index: 9999;
}

.loading-bar.is-active {
  opacity: 1;
  transform: scaleX(0.7);
  transition: transform 8s cubic-bezier(0.1, 0.6, 0.2, 1), opacity 0.2s ease;
}

.loading-bar.is-done {
  transform: scaleX(1);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.4s ease 0.15s;
}

/* ---------- مودال سراسری ---------- */

.app-modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 640px;
  width: 90%;
  max-height: 80vh;
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
}

.app-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.app-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.app-modal__header h3 {
  margin: 0;
  font-size: 15px;
  word-break: break-all;
}

.app-modal__close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}

.app-modal__body {
  padding: 16px;
  max-height: calc(80vh - 50px);
  overflow-y: auto;
}

.app-modal__body ol,
.app-modal__body ul {
  margin: 0;
  padding-inline-start: 1.6em;
}

.app-modal__body ul {
  list-style: none;
  padding-inline-start: 0;
}

.app-modal__body li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

.app-modal__body li:last-child {
  border-bottom: none;
}

.app-modal__body li input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
}

/* Marking an item (2026-09-17) gives immediate visual feedback without any
   JS -- :has() is native, checked-state-driven styling. */
.app-modal__body li:has(input:checked) {
  opacity: 0.55;
  text-decoration: line-through;
}

.app-confirm {
  max-width: 460px;
}

.app-confirm #app-confirm-message {
  white-space: pre-line;
}

.app-confirm__actions {
  margin-top: var(--space-4);
}

/* ---------- اعلان گذرا (toast) ---------- */

.toast-region {
  position: fixed;
  bottom: var(--space-4);
  inset-inline-end: var(--space-4);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(360px, calc(100vw - 2 * var(--space-4)));
}

.toast {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  transition: opacity 0.4s ease;
}

.toast--error { background: var(--danger); color: var(--danger-fg); }
.toast--warn { background: var(--warning); color: var(--bg); }
.toast.is-leaving { opacity: 0; }

.referrer-regions {
  display: block;
  font-size: 0.85em;
  line-height: 1.5;
}

/* A button that reads as a link -- for a table cell that needs to be
   clickable (open the shared modal, say) without looking like a <button>. */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.link-btn:hover {
  filter: brightness(0.85);
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

.btn--primary:hover {
  filter: brightness(0.94);
  border-color: var(--primary);
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-fg);
}

.btn--danger:hover {
  filter: brightness(0.94);
  border-color: var(--danger);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn--danger-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--danger);
}

.btn--danger-ghost:hover {
  border-color: var(--danger);
  background: var(--danger-weak);
}

/* ---------- فرم‌ها ---------- */

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="file"]),
select,
textarea {
  font: inherit;
  width: 100%;
  max-width: 32rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

label {
  font-weight: 600;
}

form p {
  margin: 0 0 var(--space-4);
}

form p label {
  display: block;
  margin-bottom: var(--space-1);
}

.helptext,
.form .helptext {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

ul.errorlist {
  list-style: none;
  padding: 0;
  margin: var(--space-1) 0;
  color: var(--danger);
  font-size: 0.88rem;
}

form .cluster {
  margin-top: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.field textarea {
  width: 100%;
  font-family: inherit;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 var(--space-4);
  align-items: start;
}

.field-grid .field input,
.field-grid .field select {
  max-width: none;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
}

legend {
  font-weight: 700;
  padding: 0 var(--space-2);
}

/* A nested block inside a card (e.g. the last style analysis). */
.subcard {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

/* ---------- نوار پیشرفت فازها ---------- */

/* 8 equal columns on desktop, 4x2 on narrow screens -- the old flex-wrap left
   «انتشار» alone on a second row at 1040px, reading as a special step (U6). */
.phase-strip {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--space-2);
}

@media (max-width: 900px) {
  .phase-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .phase-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.phase__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 0.75rem;
  margin-inline-end: 0.3em;
  vertical-align: 0.05em;
}

.phase--ok .phase__icon { background: var(--success); border-color: var(--success); color: var(--surface); }
.phase--failed .phase__icon { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.phase--running .phase__icon {
  border-color: var(--info);
  border-inline-end-color: transparent;
  animation: spin 0.9s linear infinite;
}

.phase {
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border-top: 3px solid var(--border-strong);
}

.phase__label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
}

.phase__state {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.phase--pending { border-top-color: var(--border-strong); }
.phase--running { border-top-color: var(--info); background: var(--info-weak); }
.phase--ok { border-top-color: var(--success); }
.phase--failed { border-top-color: var(--danger); background: var(--danger-weak); }
.phase--running .phase__state { color: var(--info); }
.phase--ok .phase__state { color: var(--success); }
.phase--failed .phase__state { color: var(--danger); }
.phase--skipped { border-top-color: var(--border); opacity: .6; }
.phase--skipped .phase__state { color: var(--muted); }

/* ---------- فید رویداد ---------- */

.event-feed {
  list-style: none;
  padding: var(--space-2);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.9rem;
  max-height: 22rem;
  overflow-y: auto;
}

/* Mono only for the timestamp -- the mono stack has no Persian glyphs, so a
   mono message fell back to another font mid-line (U7). */
.event time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.event-feed[data-filter="warn"] .event:not(.event--warn):not(.event--error),
.event-feed[data-filter="error"] .event:not(.event--error) {
  display: none;
}

.event {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-1) var(--space-2);
  border-inline-start: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.event + .event {
  margin-top: 2px;
}

.event time {
  color: var(--muted);
  white-space: nowrap;
}

.event__msg {
  word-break: break-word;
}

.event--info { border-inline-start-color: var(--info); }
.event--warn { border-inline-start-color: var(--warning); background: var(--warning-weak); }
.event--error { border-inline-start-color: var(--danger); background: var(--danger-weak); }
.event--empty {
  border-inline-start-color: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
}

/* ---------- سرتیتر کارت + چیپ‌های فیلتر ---------- */

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}

.card__head > h2 {
  margin: 0;
}

.chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.chip {
  padding: 0.1rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--muted);
}

.chip[aria-pressed="true"] {
  background: var(--primary-weak);
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- صفحه‌ی ران ---------- */

.run-summary__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}

.quality-summary { margin-block-start: var(--space-3); color: var(--fg); }
.quality-summary__line { margin: 0; }
.quality-summary__list { margin: var(--space-2) 0 0; padding-inline-start: var(--space-4); }
.quality-summary__optional summary { cursor: pointer; color: var(--muted); }
.quality-summary[data-state="proceeded"] .quality-summary__line strong { color: var(--warning); }

.run-error {
  margin-top: var(--space-3);
}

.run-error summary {
  cursor: pointer;
  color: var(--danger);
  font-weight: 700;
}

.run-actions {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* Job/run logs: mostly English + URLs, so LTR, but each LINE picks its own
   direction (unicode-bidi: plaintext) so a Persian line still reads RTL (F7). */
.log-output {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: start;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow: auto;
  margin: 0;
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.page-subtitle {
  margin: calc(-1 * var(--space-4)) 0 var(--space-5);
  color: var(--muted);
}

.page-actions {
  margin-bottom: var(--space-4);
}

/* Horizontal filter/search row above a table (was .gsc-filter, copied twice). */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.filter-bar input[type="text"],
.filter-bar input[type="search"],
.filter-bar select {
  width: auto;
  flex: 0 1 16rem;
  min-width: 10rem;
}

.filter-bar label {
  font-weight: 500;
}

/* dossiers (page & keyword) */
.reason-chips { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.dossier-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.trend-chart { display: block; width: 100%; height: 80px; color: var(--primary); }
.trend-chart polyline { fill: none; stroke: currentColor; stroke-width: 2; vector-effect: non-scaling-stroke; }
.trend-chart circle { fill: currentColor; }
.trend-chart .serp-point { fill: var(--warning); }
.trend-block figcaption { font-size: .85em; color: var(--muted); display: flex; justify-content: space-between; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.timeline .timeline__meta { color: var(--muted); font-size: .85em; }
.timeline li p { overflow-wrap: anywhere; }
.dossier-link { font-size: .85em; margin-inline-start: var(--space-1); white-space: nowrap; }

/* smart-task list (فهرست وظایف) */
.impact-badge--high { background: var(--danger-weak); color: var(--danger); }
.impact-badge--medium { background: var(--warning-weak); color: var(--warning); }
.impact-badge--low { background: var(--surface-2); color: var(--muted); }
.task-row__title { font-weight: 600; overflow-wrap: anywhere; }
.task-cell { min-width: 0; flex: 1 1 auto; }
.gsc-summary { margin-bottom: var(--space-4); }
.kw-pick { display: inline-flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; }
.kw-bulk__rows { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-3); }
.kw-bulk__row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 7rem auto auto; gap: var(--space-2); align-items: end; padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.kw-bulk__cell { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.kw-bulk__cell--track { flex-direction: row; align-items: center; gap: var(--space-2); min-height: 2.25rem; white-space: nowrap; }
.kw-bulk__label { font-size: 0.875rem; color: var(--muted); }
.kw-bulk__error { grid-column: 1 / -1; margin: 0; }
.kw-bulk__actions { display: flex; gap: var(--space-2); justify-content: space-between; }
@media (max-width: 720px) {
  .kw-bulk__row { grid-template-columns: 1fr 1fr; }
  .kw-bulk__cell--text, .kw-bulk__cell--url { grid-column: 1 / -1; }
  .kw-bulk__cell--track, .kw-bulk__remove { min-height: 2.25rem; }
}
.kw-add-bar { display: flex; justify-content: flex-end; margin-bottom: var(--space-2); }

.field--inline label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.help-list {
  list-style: none;
  padding: 0;
  margin: var(--space-1) 0 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- کارت تصمیم ---------- */

.decision-card {
  border: 1px solid var(--warning);
  border-inline-start: 4px solid var(--warning);
  border-radius: var(--radius);
  background: var(--warning-weak);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
}

.decision-card h2 {
  margin-top: 0;
}

.decision-card__kind {
  font-weight: 700;
  color: var(--warning);
}

.decision-card__warning {
  font-weight: 700;
  color: var(--danger);
}

.decision-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.decision-card__actions form {
  margin: 0;
}

.decision-card__list {
  margin: 0;
  padding-inline-start: var(--space-4);
}

.decision-card__note {
  padding: var(--space-2) var(--space-3);
  border-inline-start: 3px solid var(--warning);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.decision-card__bulk {
  margin-top: var(--space-4);
}

.decision-card__bulk summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.anchor-review__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.anchor-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.anchor-item--money {
  border-color: var(--warning);
}

.anchor-item__main {
  flex: 1 1 22rem;
  min-width: 0;
}

.anchor-item__main p {
  margin-bottom: var(--space-1);
  word-break: break-word;
}

.anchor-item__choice {
  display: flex;
  gap: var(--space-3);
  border: 0;
  margin: 0;
  padding: 0;
}

.anchor-item__choice label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
}

/* The replacement-link field opens only when «رد» is chosen (7.33.1). Browsers without :has() always show it. */
.anchor-item__correct {
  display: none;
  flex: 1 1 100%;
  flex-direction: column;
  gap: var(--space-1);
}

.anchor-item__correct input {
  width: 100%;
}

.anchor-item:has(input[value="reject"]:checked) .anchor-item__correct {
  display: flex;
}

@supports not selector(:has(*)) {
  .anchor-item__correct {
    display: flex;
  }
}

/* ---------- پیش‌نمایش خروجی ---------- */

.artifact-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.preview-body {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
}

.preview-body pre {
  white-space: pre-wrap;
  word-break: break-word;
}

.artifact-image {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.artifact-path {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  word-break: break-all;
}

/* Non-blog page preview (runs/_commerce_preview.html) */
.commerce-preview__frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* گزارش هفتگی لینک داخلی در iframe ایزوله رندر می‌شود تا استایل ناحیه‌ای‌اش به بقیه صفحه نشت نکند */
iframe.report-embed {
  width: 100%;
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- بریف ---------- */

.brief-outline,
.brief-faq {
  padding-inline-start: var(--space-4);
}

.brief-reasoning,
.brief-outline-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.brief-outline-notes,
.brief-outline-keywords {
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- جدول‌های سرچ کنسول (قبلاً <style> درون gsc_signals/gsc_analysis) ---------- */

tr.reviewed {
  opacity: 0.55;
}

.corr-badge {
  color: var(--danger);
  font-size: 0.78rem;
  white-space: nowrap;
}

.page-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  word-break: break-word;
}

.review-form,
.status-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
  margin: 0;
}

.review-form input[type="text"] {
  width: 13rem;
}

.status-form input[type="text"] {
  width: 8rem;
}

.status-form select {
  width: auto;
}

.metric-line {
  display: block;
}

.text-pos { color: var(--success); }
.text-neg { color: var(--danger); }

.gsc-window {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
}

input.input--narrow {
  width: 8rem;
}

.gsc-summary {
  margin-bottom: var(--space-4);
}

/* overflow-wrap:break-word (NOT `anywhere`) keeps short Persian words from
   being squeezed one letter per line while still breaking a real long token. */
td.wrap {
  max-width: 380px;
  white-space: normal;
  overflow-wrap: break-word;
}

.page-note {
  font-size: 0.78rem;
  line-height: 1.5;
  display: inline-block;
  max-width: 260px;
}

.gsc-group {
  margin-bottom: var(--space-5);
}

.gsc-group__heading {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}

.gsc-group__heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.gsc-group__count,
.gsc-group__desc {
  color: var(--muted);
  font-size: 0.8rem;
}

.gsc-group__desc {
  margin: 0 0 var(--space-2);
}

table.table--wide {
  min-width: 900px;
}

/* ---------- مانیتورینگ سرور (قبلاً <style> درون server_monitor) ---------- */

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.monitor-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}

.monitor-stat h3 {
  margin: 0 0 var(--space-2);
  font-size: 0.92rem;
  color: var(--muted);
}

.monitor-stat .value {
  font-size: 1.4rem;
  font-weight: 700;
}

.monitor-stat .sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: var(--space-1);
}

/* Track is --border, not --surface-2: the stat card itself is --surface-2,
   so the empty part of every bar used to be invisible (F16). */
.monitor-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  margin-top: var(--space-2);
  overflow: hidden;
}

.monitor-bar__fill { height: 100%; background: var(--primary); }
.monitor-bar__fill.warn { background: var(--warning); }
.monitor-bar__fill.crit { background: var(--danger); }

.monitor-history-item {
  margin-bottom: var(--space-5);
}

.monitor-history-item h4 {
  margin: 0 0 var(--space-2);
  font-size: 0.95rem;
}

.monitor-chart {
  width: 100%;
  height: 110px;
  display: block;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.monitor-chart polyline {
  stroke: var(--primary);
}

.monitor-history-summary {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

.monitor-history-summary strong { color: var(--fg); }
.monitor-history-summary .over-threshold { color: var(--warning); font-weight: 700; }

/* ---------- داشبورد (U17) ---------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.kpi {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  color: var(--fg);
  box-shadow: var(--shadow);
}

.kpi:hover {
  text-decoration: none;
  border-color: var(--primary);
}

.kpi__value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
}

.kpi__label {
  color: var(--muted);
  font-size: 0.88rem;
}

.kpi--alert .kpi__value { color: var(--danger); }
.kpi--warn .kpi__value { color: var(--warning); }

.item-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.item-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.item-list > li:last-child {
  border-bottom: 0;
}

/* ---------- صفحه‌بندی ---------- */

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.pagination span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- معماریِ یکپارچه: ویجتِ وضعیت و نوار پیشرفت (فاز ۱) ---------- */

.status-widget {
  display: grid;
  gap: var(--space-1);
}

.status-widget__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.status-widget__icon {
  min-width: 1.6rem;
  justify-content: center;
}

.status-widget__label {
  font-weight: 600;
}

.status-widget__percent {
  color: var(--muted);
}

.status-widget__meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.status-widget__message {
  margin: 0;
  font-size: 0.9rem;
}

.status-widget__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.status-widget__actions form {
  margin: 0;
}

.status-widget--compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.status-widget--compact .progress {
  width: 6rem;
}

.progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 0.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--primary);
  overflow: hidden;
}

.progress::-webkit-progress-bar {
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}

.progress::-webkit-progress-value {
  background: var(--primary);
  border-radius: var(--radius-pill);
}

.progress::-moz-progress-bar {
  background: var(--primary);
  border-radius: var(--radius-pill);
}

.progress--indeterminate,
.progress--indeterminate::-webkit-progress-bar {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--primary-weak) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: progress-slide 1.4s linear infinite;
}

@keyframes progress-slide {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .progress--indeterminate,
  .progress--indeterminate::-webkit-progress-bar {
    animation: none;
  }
}

/* ---------- معماریِ یکپارچه: سربرگ، کارت، کاشی، هزینه، پیش‌نیاز، زنجیره (فاز ۱) ---------- */

.cost-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.cost-badge--free { background: var(--surface-2); color: var(--muted); }
.cost-badge--quota { background: var(--warning-weak); color: var(--warning); }
.cost-badge--paid { background: var(--warning-weak); color: var(--warning); border-color: var(--warning); font-weight: 700; }

.report-header {
  display: grid;
  gap: var(--space-3);
}

.report-header__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
}

.report-header__title {
  margin: 0;
  font-size: 1.35rem;
}

.report-header__purpose {
  margin: var(--space-1) 0 0;
  color: var(--muted);
}

.report-header__action {
  display: grid;
  justify-items: end;
  gap: var(--space-1);
}

.report-header__status {
  display: grid;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.report-header__meta,
.report-header__schedule {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.report-header__stale {
  margin: 0;
  font-size: 0.9rem;
  color: var(--warning);
}

.task-button {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.prereq-list {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.prereq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--warning-weak);
  color: var(--warning);
  font-size: 0.9rem;
}

.prereq--met {
  background: var(--success-weak);
  color: var(--success);
}

.snapshot-menu summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 0.85rem;
}

.snapshot-menu ul {
  margin: var(--space-2) 0 0;
  padding-inline-start: var(--space-4);
  font-size: 0.85rem;
  color: var(--muted);
}

.task-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.task-card {
  display: grid;
  align-content: start;
  gap: var(--space-3);
}

.task-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.task-card__head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.task-card__purpose {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.task-card__summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-card__summary strong {
  font-size: 1.25rem;
}

.task-card__footer {
  display: grid;
  gap: var(--space-2);
}

.task-card__stale {
  margin: 0;
  color: var(--warning);
  font-size: 0.88rem;
}

.task-button--inline {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
}

.task-button--inline .field {
  width: 100%;
}

.report-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}

.report-tile {
  display: grid;
  gap: var(--space-1);
  color: inherit;
  text-decoration: none;
}

.report-tile:hover,
.report-tile:focus-visible {
  border-color: var(--primary);
}

.report-tile__title { font-weight: 600; }
.report-tile__value { font-size: 1.5rem; }
.report-tile__label { font-size: 0.85rem; color: var(--muted); }

.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.chain__link + .chain__link::before {
  content: "←";
  margin-inline-end: var(--space-2);
  color: var(--muted);
}

@media (max-width: 560px) {
  .report-header__action {
    justify-items: stretch;
    width: 100%;
  }

  .report-header__action .task-button .btn--primary {
    flex: 1 1 100%;
    justify-content: center;
  }

  .report-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chain {
    flex-direction: column;
    align-items: flex-start;
  }

  .chain__link + .chain__link::before {
    content: "↓";
  }
}

/* ---------- صفحه‌ی گزارش (فاز ۲) ---------- */

.empty-state--success {
  color: var(--success);
  border-color: var(--success);
}

.report-delta {
  margin: calc(-1 * var(--space-3)) 0 var(--space-4);
  color: var(--muted);
  font-size: 0.88rem;
}

.report-header__age {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .project-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .project-nav__item {
    flex: 0 0 auto;
  }

  .project-nav__item > a {
    white-space: nowrap;
  }

  /* overflow-x would clip an absolute menu, so on phones the open menu is a
     full-width panel pinned just below the tab row (top set by app.js). */
  .project-nav__menu {
    position: fixed;
    top: var(--pnav-top, 120px);
    inset-inline: var(--gutter);
    min-width: 0;
    max-height: 60vh;
    overflow-y: auto;
  }

  .project-nav__menu::before {
    display: none;
  }

  .project-nav__menu a {
    padding: 10px 12px;
    white-space: normal;
  }
}

.row-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.app-confirm__fields {
  margin-block: var(--space-3);
}

.confirm-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.confirm-fields legend {
  font-weight: 600;
  padding-inline: var(--space-1);
}

.report-window {
  margin: 0 0 var(--space-3);
  font-size: 0.9rem;
}

/* ---------- نمای کلیِ پروژه (فاز ۳) ---------- */

.page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.overview {
  display: grid;
  gap: var(--space-4);
}

.overview-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding-block: var(--space-2);
}

.overview-item__title {
  font-weight: 600;
}

@media (max-width: 560px) {
  .page-title-row .btn {
    flex: 1 1 100%;
    justify-content: center;
    text-align: center;
    /* the project nav below pulls itself up (negative margin-top) */
    margin-bottom: var(--space-4);
  }
}

/* ---------- ناوبری و دسترس‌پذیری (۵.۱.۰) ---------- */

/* «پرش به محتوا»: بیرون از صفحه تا وقتی فوکوس بگیرد. */
.skip-link {
  position: absolute;
  inset-inline-start: var(--space-3);
  top: -4rem;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: var(--space-2);
  text-decoration: none;
}

/* مقصدِ پرش فقط برای فوکوسِ برنامه‌نویسی است؛ حلقه‌ی دورِ کلِ صفحه نمی‌خواهد. */
#main-content:focus {
  outline: none;
}

/* حلقه‌ی فوکوسِ یکدست برای هر چیزِ فوکوس‌پذیر (کیبورد). */
summary:focus-visible,
[tabindex]:focus-visible,
.tabbar a:focus-visible,
.chip:focus-visible,
.nav-dropdown__trigger:focus-visible,
.nav-hamburger:focus-visible,
.sibling-nav a:focus-visible,
.breadcrumb a:focus-visible,
.site-header__brand:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* بخشِ «مدیریت» در منوی کاربر. */
.nav-dropdown__group {
  padding-bottom: var(--space-1);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
}

.nav-dropdown__heading {
  display: block;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

/* سوئیچرِ هم‌خانواده‌ها: صفحه‌های کنارِ صفحه‌ی فعلی داخلِ همان تب. */
.sibling-nav {
  margin: calc(-1 * var(--space-3)) 0 var(--space-5);
}

.sibling-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.sibling-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.15rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.sibling-nav a:hover {
  color: var(--fg);
  text-decoration: none;
}

.sibling-nav a.is-current {
  background: var(--primary-weak);
  border-color: var(--primary);
  color: var(--primary);
}

@media (max-width: 720px) {
  /* ردیفِ تب‌ها و سوئیچر: اسکرولِ افقی با سایه‌ی لبه‌ها (بدونِ ماسک تا منوی بازِ fixed بریده نشود). */
  .project-nav,
  .sibling-nav__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    background:
      linear-gradient(to right, var(--bg), var(--bg)) left center / 32px 100% no-repeat local,
      linear-gradient(to left, var(--bg), var(--bg)) right center / 32px 100% no-repeat local,
      linear-gradient(to right, var(--border-strong), transparent) left center / 14px 100% no-repeat scroll,
      linear-gradient(to left, var(--border-strong), transparent) right center / 14px 100% no-repeat scroll;
  }

  .project-nav::-webkit-scrollbar,
  .sibling-nav__list::-webkit-scrollbar {
    display: none;
  }

  .sibling-nav li {
    flex: 0 0 auto;
  }

  /* هدف‌های لمسی ≥ ۳۲px (۳۶ تا ۴۴ برای کنترل‌های اصلی). */
  .project-nav__item > a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  .project-nav__caret {
    min-width: 36px;
    min-height: 40px;
  }

  .sibling-nav a {
    min-height: 36px;
  }

  .site-header__brand,
  .nav-dropdown__trigger,
  .site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
  }

  .nav-dropdown__menu:not(.site-nav-panel) a,
  .nav-dropdown__logout {
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  .breadcrumb a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
  }

  .btn,
  table .btn,
  td .btn {
    min-height: 36px;
  }

  .btn--small,
  table .btn--small {
    min-height: 32px;
  }

  .chain__link a,
  .task-card__footer a,
  .card__head > a,
  .banner a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 1.2rem;
    height: 1.2rem;
  }

  /* منوی کاربر در پنلِ موبایل بسته‌نشده می‌ماند: همه‌ی آیتم‌ها از اولین باز شدنِ پنل دیده می‌شوند. */
  .site-nav-panel .nav-dropdown--account > .nav-dropdown__menu {
    display: block;
  }

  .site-nav-panel .nav-dropdown--account > .nav-dropdown__trigger::after {
    display: none;
  }
}

/* متنِ کد در کارت‌ها (مثل راهنمای وردپرس) در عرضِ موبایل از لبه‌ی کارت بیرون نزند. */
code {
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow-x: auto;
}

/* ---------- فهرستِ وظایفِ سبک (۵.۲.۰) ----------
   One markup, two layouts: a compact one-line grid row on desktop, a two-line card
   (title + a row of badges) at <=720px. Quick status verbs live in .row-menu. */

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-list__head,
.task-item {
  display: grid;
  grid-template-columns: minmax(0, 3fr) 9.5rem 6rem minmax(0, 2fr) 6.5rem 7rem 2.5rem;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-1);
  border-bottom: 1px solid var(--border);
}

.task-list__head {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.task-item > * {
  min-width: 0;
}

.task-item__target {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item__text {
  overflow-wrap: anywhere;
}

.task-item__assignee {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row__title {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* ریزمنوی افشاگر (بدونِ JS برای باز/بسته‌شدن؛ app.js فقط بیرون‌کلیک و Esc را می‌بندد) */
.row-menu {
  position: relative;
  display: inline-block;
}

.row-menu > summary {
  list-style: none;
  cursor: pointer;
}

.row-menu > summary::-webkit-details-marker {
  display: none;
}

.row-menu__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font-size: 1.1rem;
  line-height: 1;
}

.row-menu__toggle:hover,
.row-menu[open] > .row-menu__toggle {
  background: var(--surface-2);
}

.row-menu > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.row-menu__panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 10rem;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.row-menu__item {
  margin: 0;
}

.row-menu__verb {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--fg);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.row-menu__verb:hover,
.row-menu__verb:focus-visible {
  background: var(--surface-2);
}

.row-menu__verb--danger {
  color: var(--danger);
}

.page-actions .row-menu__panel .task-button {
  padding: 4px 6px;
}

@media (max-width: 720px) {
  .task-list__head {
    display: none;
  }

  .task-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    padding: var(--space-2) var(--space-1);
  }

  .task-row__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
  }

  /* the filter bar as a two-column grid instead of one field per line */
  .filter-bar--compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    align-items: end;
  }

  .filter-bar--compact label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
  }

  .filter-bar--compact select,
  .filter-bar--compact input[type="search"] {
    width: 100%;
    max-width: none;
    min-width: 0;
    flex: none;
  }

  .filter-bar--compact input[type="search"] {
    grid-column: 1 / -1;
  }

  /* the card's second line: source / impact / status (+ assignee) as one wrapping row;
     the menu toggle stays at the end of the title line */
  .task-item__title { order: 1; flex: 1 1 calc(100% - 3.5rem); }
  .task-item__menu { order: 2; margin-inline-start: auto; }
  .task-item__source,
  .task-item__impact,
  .task-item__status,
  .task-item__assignee { order: 3; }

  .task-item__target,
  .task-item__assignee {
    display: none;
  }

  .task-item__source .badge {
    max-width: 7.5rem;
  }

  .row-menu__toggle {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* فرمِ عمودیِ جزئیاتِ تسک: هر فیلد یک ردیف، یک دکمه‌ی اصلی. */
.task-form .field {
  margin-bottom: var(--space-3);
}

.task-form + .task-form {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.task-form select,
.task-form textarea,
.task-form input[type="date"] {
  display: block;
  width: 100%;
  max-width: 24rem;
}

/* جدولِ پهن که در موبایل داخلِ .table-wrap اسکرول افقیِ خودش را دارد: سلول‌ها نمی‌شکنند (۵.۳.۰). */
@media (max-width: 720px) {
  .table--nowrap th,
  .table--nowrap td {
    white-space: nowrap;
  }

  .table--nowrap td.wrap {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ---------- سخت‌سازیِ کوچک (۵.۳.۱) ---------- */

/* خطِ سومِ کارتِ موبایلِ فهرستِ وظایف: «هدف · مسئول»؛ در دسکتاپ ستون‌های خودش را دارد. */
.task-item__meta {
  display: none;
}

@media (max-width: 720px) {
  .task-item__meta {
    display: block;
    order: 4;
    flex: 1 1 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
  }

  /* «کارهای تکمیلی» و آیتم‌های منویش ≥ ۳۶px */
  .page-actions .row-menu > summary,
  .row-menu__item .btn,
  .row-menu__item .btn--small {
    min-height: 36px;
  }

  /* چک‌باکس/رادیو: سطحِ لمس از طریقِ label بزرگ می‌شود، خودِ کنترل همان اندازه می‌ماند. */
  label:has(> input[type="checkbox"]),
  label:has(> input[type="radio"]) {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 32px;
    padding-block: 6px;
  }
}

/* ---------- پروژه‌ها و داشبورد (۵.۴.۰) ---------- */

/* بلوک‌های سندِ پرامپت: بخش‌های جمع‌شونده + فهرستِ لنگرِ سریع. */
.block-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.block-toc__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  font-size: 0.85rem;
}

.block-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.block-section > summary {
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
  min-height: 36px;
}

.block-section > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.block-section > .field {
  padding: 0 var(--space-3) var(--space-3);
}

.block-section textarea {
  max-width: none;
}

.prompt-doc-bar {
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

/* بخش‌های فرمِ تنظیماتِ پروژه (fieldset + لنگر). */
.form-sections-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 0.9rem;
}

fieldset.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
  min-width: 0;
}

fieldset.form-section > legend {
  padding-inline: var(--space-2);
  font-weight: 700;
  font-size: 1.05rem;
}

/* جدولِ فعالیت‌ها: ستون‌های هم‌تراز با پهنای معقول (۵.۴.۰) */
.table--fixed {
  table-layout: fixed;
  width: 100%;
}

.table--fixed th.col-date,
.table--fixed td.col-date { width: 9.5rem; }
.table--fixed th.col-actor,
.table--fixed td.col-actor { width: 9rem; }
.table--fixed td { overflow-wrap: anywhere; vertical-align: top; }

@media (max-width: 720px) {
  .table--fixed { table-layout: auto; }
}


/* ---- اکانت و دسترسی (۶.۰.۰) ---- */
.member__head { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.member__head h2 { margin: 0; }
.member__head p { margin: 0.15rem 0 0; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.segmented > form { margin: 0; }
.invite-link { display: block; padding: 0.6rem 0.75rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; word-break: break-all; user-select: all; }
@media (max-width: 720px) {
  .segmented .btn { min-height: 36px; }
}

/* 6.3.0: «درخواست تسک برای انتخاب‌شده‌ها» above a list with row checkboxes */
.bulk-bar {
  display: flex;
  gap: var(--space-3);
  margin-block: var(--space-3);
}

/* Image thumbnails in task pages (6.7.0): fixed size, a broken image keeps a tidy box with its alt text. */
.thumb {
  display: inline-block;
  width: 80px;
  height: 80px;
  object-fit: cover;
  vertical-align: middle;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
  overflow: hidden;
}
.thumb-link { display: inline-block; text-decoration: none; }
.thumb-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
@media (max-width: 720px) {
  .thumb { width: 64px; height: 64px; }
}

/* -----------------------------------------------------------------------------
   Jalali date picker (7.4.1) -- popup opened by app.js for input[data-jdate].
   Positioned by JS (absolute, clamped to the viewport); dir="rtl" is set on the
   element itself because the input it belongs to is dir="ltr".
   ----------------------------------------------------------------------------- */
.jdp {
  position: absolute;
  z-index: 80;
  width: min(19rem, calc(100vw - 2 * var(--space-2)));
  padding: var(--space-3);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.jdp__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.jdp__title {
  font-weight: 600;
}

.jdp__nav {
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.jdp__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.jdp__dow {
  padding: var(--space-1) 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.jdp__day {
  min-height: 2.25rem;
  padding: 0;
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.jdp__day:hover,
.jdp__nav:hover {
  background: var(--primary-weak);
}

.jdp__day.is-today {
  border-color: var(--primary);
}

.jdp__day.is-selected {
  color: var(--primary-fg);
  background: var(--primary);
}

.jdp__day:focus-visible,
.jdp__nav:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.jdp__foot {
  display: flex;
  justify-content: flex-start;
  margin-top: var(--space-2);
}

/* decision bar of a noindex group task (7.9.0) */
.decide-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.decide-bar input[type="text"] { flex: 1 1 16rem; min-width: 10rem; }
.decide-bar .check { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 500; }

/* wireframes (layout analysis): plain rows, Persian text wraps by itself */
.wf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3, 12px); align-items: start; }
.wf-figure { margin: 0; min-width: 0; }
.wf-figure figcaption { font-weight: 600; margin-bottom: 0.25rem; }
.wf { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 34rem; overflow: auto;
      border: 1px solid var(--border, #d5dae3); border-radius: var(--radius, 6px); background: var(--surface, #fff); }
.wf--mobile { max-width: 20rem; }
.wf-block { flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 10px;
            border: 1px solid var(--border, #b8c0cc); border-radius: 6px; background: var(--surface-2, #f1f4f9); }
.wf-block--in { background: var(--primary-soft, #e4ecff); border-color: var(--primary, #1d4ed8); }
.wf-block--s { min-height: 2.25rem; }
.wf-block--m { min-height: 4rem; }
.wf-block--l { min-height: 6.5rem; }
.wf-label { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.wf-note { color: var(--muted, #5b6472); font-size: 0.8rem; overflow-wrap: anywhere; }
.wf-fold { list-style: none; text-align: center; font-size: 0.75rem; color: var(--danger, #b42318);
           border-top: 2px dashed var(--danger, #b42318); padding-top: 2px; }
.wf-shot { width: 100%; max-width: 20rem; height: auto; border: 1px solid var(--border, #d5dae3); border-radius: var(--radius, 6px); }

/* image converter (7.13.0): the result row just produced */
.item-list > li.is-highlight { outline: 2px solid var(--primary, var(--accent, currentColor)); outline-offset: 4px; border-radius: var(--radius, 6px); }

/* periodic reports (7.23.0): the report body shared by the app page; the PDF has its own print stylesheet */
.preport__head h1 { font-size: 1.15rem; margin: 0 0 var(--space-1); }
.preport__head p { margin: 0 0 var(--space-4); color: var(--muted); }
.preport__sec { margin-bottom: var(--space-5); overflow-x: auto; }
.preport__sec h2 { font-size: 1.05rem; margin: 0 0 var(--space-2); padding-bottom: var(--space-1); border-bottom: 1px solid var(--border); }
.preport__sec h3 { font-size: 0.95rem; margin: var(--space-3) 0 var(--space-1); }
.preport__sec table { width: 100%; border-collapse: collapse; margin: var(--space-2) 0; }
.preport__sec th, .preport__sec td { border: 1px solid var(--border); padding: var(--space-1) var(--space-2); text-align: right; }
.preport__sec th { background: var(--surface-2); }
.preport__warn { background: var(--warning-weak); color: var(--warning); padding: var(--space-2) var(--space-3); border-radius: var(--radius); }
.preport__analysis { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------------------
   «بازسازی تصویر» و «شخصیت‌های برند» (7.39.x)
   --------------------------------------------------------------------------- */
.regen-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-end: var(--space-2);
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  vertical-align: -0.15em;
  animation: regen-spin 0.9s linear infinite;
}
@keyframes regen-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .regen-spinner { animation: none; } }
.regen-progress { width: 100%; height: 0.9rem; }
.regen-compare { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4); }
.regen-compare figure { margin: 0; max-width: 46%; min-width: 260px; }
.regen-compare img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.pre-wrap { white-space: pre-wrap; }
.field--dim { opacity: 0.85; }
.character-list__item { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.character-thumb { object-fit: contain; border-radius: var(--radius-sm); background: #fff; }
