/* SAMT POINT — پایه، کامپوننت‌ها و صفحات اپ مشتری
 * فقط توکن‌های معنایی tokens.css را می‌خواند. RTL، فونت لوکال، بدون وابستگی.
 *
 *   ۱. پایه            ۴. صفحه‌ی ورود (gate)
 *   ۲. عناصر برند      ۵. داشبورد (home)
 *   ۳. کامپوننت‌ها     ۶. نمایشگر (viewer)      ۷. حرکت، چاپ
 */

/* ================================================================== *
 * ۱. پایه
 * ================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* پس‌زمینه فقط روی html: پس‌زمینه‌ی خودِ body روی لایه‌های z-index منفی
   (سایه‌ی پایین صفحه، نمودار تزئینی) کشیده می‌شود و پنهانشان می‌کند. */
html { background: var(--bg); }

html,
body {
  margin: 0;
  padding: 0;
  color: var(--text-2);
  font-family: var(--font-fa);
  font-size: 16px;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* سایه‌ی ملایم پایین صفحه، مثل صفحات کاتالوگ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 52%, var(--bg-shade) 100%);
  pointer-events: none;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--text-1);
  font-weight: 800;
  line-height: var(--lh-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 700; }

p { margin: 0; }

a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); }

b, strong { font-weight: 700; color: var(--text-1); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

::selection { background: var(--accent-ring); color: var(--text-1); }

:focus-visible {
  outline: 2px solid var(--accent-graphic);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

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

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted { color: var(--text-3); font-size: var(--fs-sm); }

/* ================================================================== *
 * ۲. عناصر برند
 * ================================================================== */

/* کیکر لاتین — آبی، حروف بزرگ، فاصله‌دار؛ امضای بصری کاتالوگ.
   خودش همیشه چپ‌به‌راست است؛ در صفحه‌ی فارسی به لبه‌ی راست می‌چسبد، در انگلیسی به چپ. */
.kicker {
  margin: 0;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--fs-kicker);
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: var(--track-kicker);
  text-transform: uppercase;
  color: var(--accent);
}
html[dir="rtl"] .kicker {
  text-align: right;
  /* فاصله‌ی حروفِ بعد از آخرین حرف، لبه‌ی راست را عقب می‌اندازد */
  margin-right: calc(var(--track-kicker) * -1);
}

.kicker-muted { color: var(--text-faint); }

/* عدد و کد با Michroma — همیشه ارقام لاتین، مثل شماره‌ی صفحات کاتالوگ */
.readout,
.mono {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  direction: ltr;
  color: var(--text-1);
  text-decoration: none;
  flex: none;
}
.brand:hover { color: var(--text-1); }

.brand-mark { width: 26px; height: 26px; flex: none; color: var(--text-1); }
.brand-mark .pt { fill: var(--accent-graphic); }

.brand-word {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  letter-spacing: var(--track-word);
  line-height: 1;
  white-space: nowrap;
}
.brand-word i {
  font-style: normal;
  color: var(--text-3);
  margin-inline-start: 0.5em;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--topbar-h);
  padding-inline: var(--gutter);
}

.brand-desc {
  padding-inline-start: var(--s-4);
  border-inline-start: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.5;
  white-space: nowrap;
}

/* توجه: عنصری که direction: ltr دارد، ویژگی‌های منطقی‌اش هم چپ‌به‌راست حساب
   می‌شود. پس «هل دادن به انتهای نوار» کارِ این ظرف است که جهت صفحه را به ارث می‌برد،
   نه کارِ خودِ .page-index. */
.topbar-end {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-inline-start: auto;
}

/* کلید زبان — هم‌شکلِ کلید تم در راهنمای طراحی */
.lang-switch {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  direction: ltr;
}
.lang-switch a {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  color: var(--text-3);
  font-family: var(--font-display);
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-decoration: none;
  transition: background var(--dur-1), color var(--dur-1);
}
.lang-switch a:hover { color: var(--text-1); }
.lang-switch a[aria-current] { background: var(--primary-bg); color: var(--primary-fg); }

.page-index {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-display);
  font-size: var(--fs-kicker);
  letter-spacing: var(--track-kicker);
  color: var(--text-faint);
  white-space: nowrap;
}

/* پانویس صفحه — خط مویی، یادداشت در راست و شماره‌ی صفحه در چپ */
.page-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-6);
  margin-inline: var(--gutter);
  padding-block: var(--s-4) var(--s-6);
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.8;
}
.page-foot a { color: inherit; }
.page-foot a:hover { color: var(--accent); }
.page-no {
  direction: ltr;
  font-family: var(--font-display);
  font-size: var(--fs-kicker);
  letter-spacing: 0.2em;
  color: var(--text-faint);
  flex: none;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-fill { fill: currentColor; stroke: none; }

/* ================================================================== *
 * ۳. کامپوننت‌ها
 * ================================================================== */

/* --- دکمه --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-1);
  font-family: var(--font-fa);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-1) var(--ease-out),
    border-color var(--dur-1) var(--ease-out),
    color var(--dur-1) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

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

.btn-ghost { border-color: var(--line-strong); color: var(--text-1); }
.btn-ghost:hover { border-color: var(--text-1); background: var(--line-faint); color: var(--text-1); }

.btn-quiet { color: var(--text-3); padding-inline: 14px; }
.btn-quiet:hover { color: var(--text-1); background: var(--line-faint); }

.btn-lg { min-height: 56px; padding-inline: 28px; font-size: 1rem; border-radius: 12px; }
.btn-sm { min-height: 36px; padding-inline: 14px; font-size: 0.8125rem; gap: 8px; }
.btn-block { width: 100%; }

.btn .icon { transition: transform var(--dur-2) var(--ease-out); }
.btn-primary:hover .icon-go { transform: translateX(-4px); }

/* پیکان «رفتن» در فارسی رو به چپ است؛ در صفحه‌ی چپ‌به‌راست آینه می‌شود. پیکان «برگشت» برعکس. */
html[dir="ltr"] .icon-go,
html[dir="ltr"] .alert-go,
html[dir="ltr"] .icon-back { transform: scaleX(-1); }
html[dir="ltr"] .btn-primary:hover .icon-go { transform: scaleX(-1) translateX(-4px); }

.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"] .icon-go { display: none; }
.btn[aria-busy="true"]::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* --- کارت --- */

.card {
  background: var(--surface);
  border: 1px solid var(--surface-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: clamp(18px, 2.4vw, 28px);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.card-head h3 { font-size: var(--fs-h3); }

/* --- هشدار --- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-1);
  font-size: var(--fs-sm);
  line-height: 1.85;
  text-decoration: none;
}
.alert .icon { margin-top: 3px; }
.alert-danger { background: var(--danger-tint); border-color: var(--danger-line); }
.alert-danger .icon, .alert-danger b { color: var(--danger); }
.alert-warn { background: var(--warn-tint); border-color: var(--warn-line); }
.alert-warn .icon, .alert-warn b { color: var(--warn); }
.alert-info { background: var(--accent-tint); border-color: var(--accent-ring); }
.alert-info .icon, .alert-info b { color: var(--accent); }
.alert-ok { background: var(--ok-tint); border-color: var(--ok-line); }
.alert-ok .icon, .alert-ok b { color: var(--ok); }

a.alert { transition: border-color var(--dur-1), transform var(--dur-2) var(--ease-out); }
a.alert:hover { border-color: var(--accent-graphic); color: var(--text-1); }
a.alert .alert-go { margin-inline-start: auto; align-self: center; color: var(--accent); }
a.alert:hover .alert-go { transform: translateX(-3px); }
html[dir="ltr"] a.alert:hover .alert-go { transform: scaleX(-1) translateX(-3px); }

/* --- برچسب وضعیت --- */

.pill,
.mine-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.7;
  color: var(--text-2);
  white-space: nowrap;
}
.pill::before,
.mine-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill-ok, .s-answered { color: var(--ok); border-color: var(--ok-line); background: var(--ok-tint); }
.pill-warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-tint); }
.pill-danger { color: var(--danger); border-color: var(--danger-line); background: var(--danger-tint); }
.pill-info, .s-new { color: var(--accent); border-color: var(--accent-ring); background: var(--accent-tint); }
.s-seen { color: var(--text-2); }
.s-closed { color: var(--text-faint); }

/* --- فیلد فرم --- */

.field,
.rfp-field,
.rfp-form label {
  display: grid;
  gap: 7px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.6;
}

.input,
.rfp-form input[type="text"],
.rfp-form select,
.rfp-form textarea,
.mark-note,
.cmsg-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  color: var(--text-1);
  font-family: var(--font-fa);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  user-select: text;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}

.rfp-form textarea,
.cmsg-form textarea {
  min-height: 92px;
  padding: 11px 14px;
  line-height: 1.9;
  resize: vertical;
}

.input::placeholder,
.rfp-form ::placeholder,
.mark-note::placeholder,
.cmsg-form ::placeholder { color: var(--text-faint); opacity: 1; }

.input:hover,
.rfp-form input[type="text"]:hover,
.rfp-form select:hover,
.rfp-form textarea:hover { border-color: var(--line-strong); }

.input:focus,
.rfp-form input[type="text"]:focus,
.rfp-form select:focus,
.rfp-form textarea:focus,
.mark-note:focus,
.cmsg-form textarea:focus {
  outline: 0;
  border-color: var(--accent-graphic);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.rfp-form select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e9097' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
}
html[dir="ltr"] .rfp-form select { background-position: right 12px center; }

.field-hint { color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }

/* بله/خیر به شکل کلید */
.rfp-field.rfp-check {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  cursor: pointer;
}
.rfp-field.rfp-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease-out);
}
.rfp-field.rfp-check input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  transition: transform var(--dur-2) var(--ease-out);
}
.rfp-field.rfp-check input[type="checkbox"]:checked { background: var(--accent-graphic); }
.rfp-field.rfp-check input[type="checkbox"]:checked::after { transform: translateX(-18px); }
html[dir="ltr"] .rfp-field.rfp-check input[type="checkbox"]:checked::after { transform: translateX(18px); }

/* --- جدول مشخصات: همان ردیف‌های مویی کاتالوگ --- */

.kv { margin: 0; }
.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: 11px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.kv > div:first-child { border-top: 1px solid var(--line-strong); }
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text-1); font-weight: 600; text-align: end; }
.kv dd.mono { font-weight: 400; font-size: 0.75rem; letter-spacing: 0.1em; }

/* --- اعلان شناور --- */

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: max-content;
  max-width: calc(100vw - 24px);
  margin-inline: auto;
  padding-block: 8px;
  padding-inline: 18px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface-raised);
  box-shadow: var(--shadow-3);
  color: var(--text-1);
  font-size: var(--fs-sm);
  line-height: 1.6;
  animation: rise var(--dur-3) var(--ease-out) both;
}
.toast-plain { padding: 10px 20px; }
.toast-err { border-color: var(--danger-line); }
.toast.is-leaving { animation: sink var(--dur-2) var(--ease-in-out) both; }

/* ================================================================== *
 * ۴. صفحه‌ی ورود — یک کار (وارد کردن کد)، یک قهرمان (نمودار)
 * ================================================================== */

.gate { min-height: 100vh; min-height: 100dvh; }

/* قاب جدا از <body> است: overflow روی body به viewport منتقل می‌شود و چیزی را
   نمی‌بُرد؛ نمودار عمداً از لبه‌ی صفحه بیرون می‌زند و باید درون همین قاب بریده شود. */
.gate-frame {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overflow: clip;
}

.gate-main {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 88px);
  width: 100%;
  max-width: 1360px;
  margin-inline: auto;
  padding: clamp(16px, 4vh, 56px) var(--gutter);
}

.gate-copy { max-width: 500px; justify-self: end; width: 100%; }

.gate-copy h1 {
  margin-top: var(--s-5);
  font-size: var(--fs-display);
  line-height: 1.28;
}

.lead {
  margin-top: var(--s-4);
  max-width: 40ch;
  color: var(--text-2);
  font-size: 1.0625rem;
}

.gate-copy .alert { margin-top: var(--s-6); }

.code-form { margin-top: var(--s-8); }

.code-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-3);
  color: var(--text-1);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.code-label .kicker { color: var(--text-faint); letter-spacing: 0.18em; margin: 0; }

.code-field { position: relative; }

/* بدون JS: یک فیلد متنی درشت و سالم */
.code-input {
  width: 100%;
  min-height: 68px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.8rem + 1vw, 1.25rem);
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
}
.code-input::placeholder { color: var(--text-faint); opacity: 0.7; }
.code-input:focus { outline: 0; border-color: var(--accent-graphic); box-shadow: 0 0 0 3px var(--accent-ring); }
.code-input-plain { font-family: var(--font-fa); letter-spacing: normal; text-transform: none; }

/* با JS: ورودی واقعی نامرئی روی خانه‌ها می‌نشیند — پیست و کیبورد موبایل سالم می‌مانند */
.code-field.is-enhanced .code-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 0;
  cursor: text;
}
.code-field.is-enhanced .code-input::placeholder { color: transparent; }
.code-field.is-enhanced .code-input::selection { background: transparent; }

.code-cells {
  display: none;
  align-items: center;
  gap: clamp(5px, 1.2vw, 10px);
  direction: ltr;
}
.code-field.is-enhanced .code-cells { display: flex; }

/* خانه‌ها همان «کد سفارش» کاتالوگ‌اند */
.code-group {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  min-height: 68px;
  padding-inline: clamp(4px, 1.1vw, 14px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--surface-edge);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.code-field:focus-within .code-group.is-active {
  border-color: var(--accent-graphic);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.code-group.is-full { border-color: var(--text-1); }

.code-slot {
  position: relative;
  height: 1.7em;
  font-family: var(--font-display);
  font-size: clamp(0.9375rem, 0.62rem + 1.4vw, 1.3125rem);
  line-height: 1.7em;
  text-align: center;
  color: var(--text-1);
}
.code-slot:empty::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.32em;
  width: 9px;
  height: 1.5px;
  margin-left: -4.5px;
  background: var(--line-strong);
  opacity: 0.6;
}
.code-field:focus-within .code-slot.is-caret::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18%;
  width: 1.5px;
  height: 64%;
  background: var(--accent-graphic);
  animation: blink 1.1s steps(1) infinite;
}
.code-slot.is-new { animation: pop var(--dur-2) var(--ease-out); }

.code-dash { flex: none; width: clamp(5px, 1.2vw, 10px); height: 1.5px; background: var(--line-strong); }

.code-field.is-shaking .code-cells,
.code-field.is-shaking .code-input { animation: shake 0.4s var(--ease-in-out); }

.code-hint {
  min-height: 1.9em;
  margin-top: var(--s-2);
  color: var(--warn);
  font-size: var(--fs-xs);
  line-height: 1.9;
}

.code-form .btn { margin-top: var(--s-1); }

/* ورود مدیر روی گوشی: دیدنِ رمز هنگامِ تایپ (غلطِ تایپیِ بی‌صدا = «رمز نادرست») */
.show-pass {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  color: var(--text-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.show-pass input { width: 18px; height: 18px; accent-color: var(--primary-bg); }

.gate-note {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-5);
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.9;
}
.gate-note .icon { margin-top: 4px; color: var(--text-faint); }

/* --- نمودار قطبی --- */

.gate-visual {
  width: 100%;
  max-width: 660px;
  justify-self: start;
  color: var(--text-1);
}

.scope { position: relative; aspect-ratio: 1; cursor: crosshair; }

.dial { display: block; width: 100%; height: 100%; overflow: visible; }
.dial .plate { fill: url(#plate-grad); }
.dial .hair { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0.2; vector-effect: non-scaling-stroke; }
.dial .hair-dash { stroke-dasharray: 2 6; opacity: 0.17; }
.dial .cross { opacity: 0.13; }
.dial .tick { fill: none; stroke: currentColor; opacity: 0.32; }
.dial .tick-major { opacity: 0.7; }
.dial text {
  fill: currentColor;
  opacity: 0.42;
  font-family: var(--font-display);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-anchor: middle;
  dominant-baseline: middle;
}
.dial text.el { font-size: 6.5px; text-anchor: start; opacity: 0.32; }
.dial .hub { fill: currentColor; opacity: 0.85; }

/* حلقه‌ی بیرونی یک‌بار «کشیده» می‌شود، بعد نمودار شروع به کار می‌کند */
.dial .ring { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0.34; animation: draw-ring 1.3s var(--ease-in-out) 0.15s forwards; }
.dial .tick { animation: fade 0.9s var(--ease-out) 0.7s both; }

.scope-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.scope-panel {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  direction: ltr;
  margin: var(--s-2) 9% 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.5625rem;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  white-space: nowrap;
}
.scope-panel b { margin-inline-start: 7px; color: var(--text-1); font-weight: 400; font-variant-numeric: tabular-nums; }
.scope-mode { margin-right: auto; color: var(--accent); }
.scope-mode::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
  animation: blink 2.4s steps(1) infinite;
}

/* تبلت و موبایل: نمودار بالای فرم می‌ماند — کوچک‌تر، بدون برچسب، ولی زنده */
@media (max-width: 900px) {
  .gate-main { grid-template-columns: 1fr; align-items: start; gap: var(--s-4); padding-top: 0; }
  .gate-copy { max-width: 540px; justify-self: center; }
  .gate-visual { order: -1; justify-self: center; width: min(62vw, 300px); }
  .gate-visual .dial text { display: none; }
  .scope-panel { display: none; }
  .scope { cursor: default; }
  .gate-copy h1 { margin-top: var(--s-3); }
  .code-form { margin-top: var(--s-6); }
}

@media (max-width: 560px) {
  .brand-desc,
  .page-index { display: none; } /* جا برای کلید زبان */
  .gate-visual { width: min(52vw, 220px); }
  .gate-copy h1 { font-size: clamp(1.625rem, 7.4vw, 2.125rem); }
  .lead { font-size: 1rem; }
  .code-group, .code-input { min-height: 56px; border-radius: 10px; }
}

@media (max-height: 640px) and (max-width: 900px) {
  .gate-visual { display: none; } /* گوشیِ کوتاه یا کیبوردِ باز: فرم مقدم است */
}

/* ================================================================== *
 * ۵. داشبورد — فقط آنچه کارفرما لازم دارد: کاتالوگ‌هایش، پاسخ‌ها، و یک فرم درخواست
 * ================================================================== */

.home { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.home-main {
  flex: 1;
  display: grid;
  gap: clamp(28px, 5vh, 56px);
  align-content: start;
  padding-block: clamp(20px, 5vh, 56px) var(--s-18);
}

.welcome { display: grid; gap: 2px; }
.home-hello { color: var(--text-3); font-size: var(--fs-body); }
.welcome h1 { font-size: var(--fs-display); line-height: 1.25; overflow-wrap: anywhere; }

.alerts { display: grid; gap: var(--s-3); margin-top: calc(var(--s-4) * -1); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line-strong);
}
.section-head > div { display: grid; gap: 4px; }
.section-head h2 { font-size: var(--fs-h2); font-weight: 800; }

/* --- کارت کاتالوگ --- */

.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.cat-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); }

.cat-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: center;
  padding: 12px;
  padding-inline-end: clamp(14px, 2vw, 24px);
  border: 1px solid var(--surface-edge);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.cat-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.cat-card.is-pending { opacity: 0.6; }
.cat-card.is-pending:hover { transform: none; box-shadow: var(--shadow-1); }
.cat-grid[data-count="1"] .cat-card { grid-template-columns: minmax(0, 0.62fr) minmax(0, 1fr); padding: 16px; padding-inline-end: clamp(18px, 4vw, 56px); }

/* جلد تایپوگرافیک. تصویر صفحه‌ی اول را نمی‌گیریم (هر درخواست صفحه در گزارش بازدید ثبت
   می‌شود)؛ جلد از عنوان ساخته می‌شود و حال‌وهوای خودِ کاتالوگ را می‌گیرد:
   paper = جلدهای روشن SAMT، ink = جلدهای تیره‌ی ROZAN. رنگ‌ها عمداً خام‌اند — جلد در تم
   تیره‌ی رابط هم همان می‌ماند، چون نماینده‌ی شیء چاپی است. */
.cover {
  --cover-fg: #16171b;
  --cover-dim: #6e7078;
  --cover-line: rgb(22 23 27 / 0.2);
  --cover-accent: #2a6699;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  aspect-ratio: 842 / 596;
  padding: 7% 8%;
  overflow: hidden;
  border-radius: var(--r-md);
  background: linear-gradient(165deg, #eeeff0 0%, #e0e1e3 48%, #cfd0d5 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.7), 0 14px 30px -18px rgb(10 11 14 / 0.6);
  color: var(--cover-fg);
  text-decoration: none;
  container-type: inline-size;
}
.cover-ink {
  --cover-fg: #f5f6f7;
  --cover-dim: #8d939b;
  --cover-line: rgb(255 255 255 / 0.16);
  --cover-accent: #74abdc;
  background: linear-gradient(165deg, #20242b 0%, #18191d 55%, #111215 100%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.07), 0 14px 30px -18px rgb(0 0 0 / 0.9);
}
/* حلقه‌ی سَمت، بریده در گوشه — همان نقشِ صفحه‌ی ورود */
.cover::before,
.cover::after {
  content: "";
  position: absolute;
  z-index: -1;
  aspect-ratio: 1;
  border: 1px solid var(--cover-line);
  border-radius: 50%;
}
.cover::before { inset-inline-end: -22%; bottom: -58%; width: 78%; }
.cover::after { inset-inline-end: -4%; bottom: -32%; width: 42%; border-style: dashed; } /* هم‌مرکز */
.cover:hover { color: var(--cover-fg); }
.cover-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cover-top .brand-word { direction: ltr; font-size: clamp(0.5rem, 4cqw, 0.8125rem); color: var(--cover-fg); }
.cover-top .kicker { font-size: clamp(0.4375rem, 3cqw, 0.625rem); color: var(--cover-accent); margin: 0; }
.cover-title {
  align-self: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-width: 88%;
  color: var(--cover-fg);
  font-size: clamp(0.8125rem, 7.4cqw, 1.75rem);
  font-weight: 800;
  line-height: 1.4;
}
html[lang="en"] .cover-title { line-height: 1.2; letter-spacing: -0.015em; }
.cover-foot {
  display: flex;
  align-items: baseline;
  gap: 8px;
  direction: ltr;
  padding-top: 5%;
  border-top: 1px solid var(--cover-line);
  font-family: var(--font-display);
  font-size: clamp(0.375rem, 2.6cqw, 0.5625rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cover-dim);
}
.cover-foot b { color: var(--cover-accent); font-weight: 400; font-size: 1.7em; letter-spacing: 0.06em; }

.cat-body { display: grid; gap: 6px; align-content: center; min-width: 0; }
.cat-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 2px; }
.tag {
  padding: 1px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.7;
}
.tag[dir="ltr"] { font-family: var(--font-display); font-size: 0.5625rem; font-weight: 400; letter-spacing: 0.14em; line-height: 2.1; color: var(--text-3); }
.tag-lang { border-color: var(--accent-ring); background: var(--accent-tint); color: var(--accent); }

.cat-body h3 { font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.25rem); font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.cat-grid[data-count="1"] .cat-body h3 { font-size: clamp(1.375rem, 1.1rem + 1.2vw, 1.875rem); }
.cat-body h3 a { color: inherit; text-decoration: none; }
.cat-body h3 a:hover { color: var(--accent); }
.cat-product {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.75;
}
.cat-meta { color: var(--text-3); font-size: var(--fs-xs); }
.cat-meta a { color: var(--accent); text-decoration: none; }
.cat-meta a:hover { text-decoration: underline; }

/* تا کجا خوانده — یک خط مویی، نه یک نمودار */
.cat-progress { height: 2px; margin-top: 4px; border-radius: 1px; background: var(--line); }
.cat-progress i { display: block; width: var(--p); height: 100%; border-radius: 1px; background: var(--text-1); }

.cta-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: var(--s-3); }

/* --- درخواست‌ها: ردیف‌های مویی --- */

.req-list { margin: 0; padding: 0; list-style: none; }
.req-list a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: 14px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--text-1);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: background var(--dur-1), padding var(--dur-2) var(--ease-out);
}
.req-list a:hover { background: var(--line-faint); padding-inline: 12px; }
.req-list .icon { color: var(--text-faint); }
.req-no { min-width: 3.4em; font-size: 0.75rem; color: var(--accent); }
.req-cat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.req-date { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

/* --- فرم درخواست، آخرِ صفحه --- */

.request-new {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(20px, 4vw, 64px);
  padding: clamp(20px, 3.2vw, 40px);
  background: var(--panel-grad);
  border-color: var(--panel-line);
}
.request-copy { display: grid; gap: var(--s-2); align-content: start; }
.request-copy h2 { font-size: var(--fs-h1); font-weight: 800; }
.request-copy p:last-child { margin-top: var(--s-2); color: var(--text-2); max-width: 36ch; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.request-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-top: var(--s-1); }
.request-actions .field-hint { flex: 1 1 220px; }

@media (max-width: 900px) {
  .cat-grid { grid-template-columns: minmax(0, 1fr); }
  .request-new { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .cat-card,
  .cat-grid[data-count="1"] .cat-card { grid-template-columns: 116px minmax(0, 1fr); align-items: start; padding: 10px; gap: 12px; }
  .cat-card .cta-group { grid-column: 1 / -1; }
  .cat-card .cta-group .btn-primary { flex: 1; }
  .cat-body { display: contents; }
  .cat-body > :not(.cta-group) { grid-column: 2; }
  .cat-card .cover { grid-row: 1 / span 5; align-self: start; }
  .cat-grid[data-count="1"] .cat-body h3 { font-size: 1.125rem; }
  .form-row { grid-template-columns: 1fr; }
  .req-list a { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 4px; }
  .req-list .req-date { grid-column: 2; }
  .req-list .icon { display: none; }
}

/* ================================================================== *
 * ۶. نمایشگر — همیشه تم ink تا کاغذ کاتالوگ برجسته بماند
 * ================================================================== */

.viewer-body { overflow-x: auto; overscroll-behavior-y: none; }
.viewer-body::before { background: var(--bg); }

.viewer-top {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: var(--z-bar);
  display: flex;
  align-items: center;
  gap: var(--s-4);
  height: var(--topbar-h);
  padding-inline: clamp(10px, 2.4vw, 24px);
  border-bottom: 1px solid var(--line);
  background: rgb(24 25 29 / 0.88);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding-inline: 10px 14px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-1), color var(--dur-1);
}
.back-home:hover { background: var(--line-faint); color: var(--text-1); }

.doc-title {
  min-width: 0;
  padding-inline-start: var(--s-4);
  border-inline-start: 1px solid var(--line);
  overflow: hidden;
  color: var(--text-1);
  font-size: 0.9375rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-top-end {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
  margin-inline-start: auto;
}

.stamp-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 30vw;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.6;
  white-space: nowrap;
}
.stamp-chip span { overflow: hidden; text-overflow: ellipsis; }
.stamp-chip .icon { color: var(--accent); }

.read-progress {
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 2px;
  transform-origin: right center;
  transform: scaleX(var(--progress, 0));
  background: var(--accent-graphic);
  box-shadow: 0 0 10px var(--accent-ring);
}

/* اطلاعیه‌ی مهر — صادقانه، ولی مزاحم مطالعه نیست */
.stamp-notice {
  position: fixed;
  top: calc(var(--topbar-h) + 14px);
  inset-inline: 0;
  z-index: var(--z-notice);
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: max-content;
  max-width: calc(100vw - 24px);
  margin-inline: auto;
  padding-block: 10px;
  padding-inline: 16px 10px;
  border: 1px solid var(--panel-line);
  border-radius: var(--r-md);
  background: var(--panel-grad);
  box-shadow: var(--shadow-3);
  color: var(--text-1);
  font-size: var(--fs-sm);
  line-height: 1.8;
  animation: drop var(--dur-3) var(--ease-out) both;
}
.stamp-notice > .icon { color: var(--accent); }
.stamp-notice.is-leaving { animation: lift var(--dur-2) var(--ease-in-out) both; }

/* --- صفحات --- */

.pages {
  --zoom: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3vh, 32px);
  width: max-content;
  min-width: 100%;
  padding: calc(var(--topbar-h) + clamp(16px, 3vh, 32px)) 12px calc(120px + env(safe-area-inset-bottom, 0px));
  /* زوم دوانگشتی را خودمان می‌گیریم تا نسخه‌ی DPI بالاتر بیاید، نه بزرگ‌نمایی مات مرورگر */
  touch-action: pan-x pan-y;
}

.page-slot {
  position: relative;
  flex: none;
  /* --sbw: پهنای اسکرول‌بار عمودی (viewer.js اندازه می‌گیرد) — 100vw آن را هم می‌شمارد */
  width: calc(min(100vw - 24px - var(--sbw, 0px), var(--base-w, 960px)) * var(--zoom));
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.04), 0 22px 50px -24px rgb(0 0 0 / 0.9);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.page-slot canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  transition: filter var(--dur-2) var(--ease-out);
}

/* جای‌نگهدار — شماره‌ی صفحه به سبک کاتالوگ */
.page-slot .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  color: var(--text-faint);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 2rem);
  letter-spacing: 0.2em;
  direction: ltr;
}
.page-slot .ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 0.045) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer 1.8s var(--ease-in-out) infinite;
}
.page-slot.is-failed .ph::after { display: none; }
.page-slot .ph-retry {
  display: grid;
  gap: 12px;
  justify-items: center;
  font-family: var(--font-fa);
  font-size: var(--fs-sm);
  letter-spacing: 0;
  direction: rtl;
  color: var(--text-3);
}
html[dir="ltr"] .page-slot .ph-retry { direction: ltr; }

body.obscured .page-slot canvas { filter: blur(18px) brightness(0.8); }
body.obscured::after {
  content: "برای ادامه‌ی مطالعه به این پنجره برگردید";
  position: fixed;
  top: 50%;
  inset-inline: 0;
  z-index: var(--z-notice);
  width: max-content;
  max-width: 90vw;
  margin-inline: auto;
  padding: 10px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface-raised);
  box-shadow: var(--shadow-3);
  color: var(--text-1);
  font-size: var(--fs-sm);
  transform: translateY(-50%);
  pointer-events: none;
}

/* --- نشان‌گذاری --- */

.mark-btn {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 50%;
  background: rgb(24 25 29 / 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #f5f6f7;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity var(--dur-2), transform var(--dur-2) var(--ease-out), color var(--dur-1), background var(--dur-1);
}
.page-slot:hover .mark-btn,
.mark-btn:focus-visible,
.mark-btn.on { opacity: 1; transform: none; }
.mark-btn:hover { background: rgb(24 25 29 / 0.85); }
.mark-btn.on { color: var(--star); }
.mark-btn.on .icon { fill: currentColor; }
.mark-btn.is-popping .icon { animation: pop var(--dur-3) var(--ease-out); }
@media (hover: none) { .mark-btn { opacity: 0.85; transform: none; } }

/* --- ریل صفحات (دسکتاپ) --- */

.page-rail {
  position: fixed;
  top: 50%;
  inset-inline-end: 14px;
  z-index: var(--z-rail);
  display: none;
  flex-direction: column;
  max-height: min(70vh, 640px);
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(31 32 36 / 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: translateY(-50%);
}
.rail-tick {
  position: relative;
  flex: 1 1 14px;
  min-height: 3px;
  max-height: 16px;
  width: 30px;
  padding: 0;
  border: 0;
  background: none;
}
.rail-tick::before {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-end: 4px;
  width: 9px;
  height: 1.5px;
  margin-top: -0.75px;
  border-radius: 1px;
  background: var(--line-strong);
  transition: width var(--dur-2) var(--ease-out), background var(--dur-1);
}
.rail-tick:hover::before { width: 15px; background: var(--text-1); }
.rail-tick.is-current::before { width: 20px; background: var(--accent); box-shadow: 0 0 8px var(--accent-ring); }
.rail-tick.is-marked::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 1px;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  background: var(--star);
  transform: rotate(45deg);
}
.rail-tip {
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  direction: ltr;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity var(--dur-1);
}
.rail-tick:hover .rail-tip,
.rail-tick:focus-visible .rail-tip { opacity: 1; }
@media (min-width: 1100px) and (hover: hover) { .page-rail { display: flex; } }

/* --- داک پایین --- */

.viewer-bar {
  position: fixed;
  inset-inline: 0;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-bar);
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100vw - 12px);
  margin-inline: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgb(31 32 36 / 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: var(--shadow-3);
  transition: inset-inline-end var(--dur-3) var(--ease-out);
}

.dock-group { display: flex; align-items: center; gap: 2px; }
.dock-zoom { direction: ltr; } /* − همیشه چپ، + همیشه راست */
.dock-sep { flex: none; width: 1px; height: 22px; margin-inline: 2px; background: var(--line-strong); }

.dock-btn {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  transition: background var(--dur-1), color var(--dur-1);
}
.dock-btn:hover { background: rgb(255 255 255 / 0.07); color: var(--text-1); }
.dock-btn:disabled { opacity: 0.3; cursor: default; background: transparent; }

.viewer-bar .btn { min-height: 40px; border-radius: 10px; }

.page-ind { display: flex; align-items: center; gap: 6px; padding-inline: 4px; direction: ltr; }

#page-jump {
  width: 46px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-sunken);
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: 0.75rem;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
#page-jump::-webkit-outer-spin-button,
#page-jump::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#page-jump:focus { outline: 0; border-color: var(--accent-graphic); box-shadow: 0 0 0 3px var(--accent-ring); }

#page-total,
.zoom-ind {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-3);
  white-space: nowrap;
}

.zoom-ind {
  min-width: 52px;
  height: 32px;
  padding: 0 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: center;
  direction: ltr;
}
.zoom-ind:hover { background: rgb(255 255 255 / 0.07); color: var(--text-1); }

.count-chip {
  position: absolute;
  top: 3px;
  inset-inline-end: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--accent-graphic);
  color: #fff;
  font-family: var(--font-fa);
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.chip-alert { background: #d9483d; }

@media (max-width: 760px) {
  .dock-zoom, .dock-zoom + .dock-sep, #btn-full, #btn-full + .dock-sep { display: none; }
  .stamp-chip { display: none; }
}
@media (max-width: 430px) {
  .dock-step { display: none; }
  .viewer-bar { gap: 3px; padding: 5px; }
  .viewer-bar .btn { padding-inline: 12px; font-size: 0.78125rem; }
  .back-home span { display: none; }
  .doc-title { font-size: var(--fs-sm); }
  .stamp-notice { gap: 10px; padding-block: 8px; padding-inline: 12px 8px; font-size: var(--fs-xs); }
  .stamp-notice > .icon { display: none; }
}

/* --- برگه‌ها: فرم درخواست، نشان‌ها، درخواست‌های من --- */

.rfp-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  display: flex;
  justify-content: flex-end;
  background: var(--scrim);
  animation: fade var(--dur-2) var(--ease-out) both;
}
.rfp-modal[hidden] { display: none; }

.rfp-box {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  height: 100%;
  border-inline-start: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: sheet-side var(--dur-3) var(--ease-out) both;
}

.rfp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.rfp-head > div { display: grid; gap: 4px; }
.rfp-head h2 { font-size: 1.1875rem; font-weight: 800; }

.rfp-head button {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin-block-start: -4px;
  margin-inline-end: -6px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-3);
  transition: background var(--dur-1), color var(--dur-1);
}
.rfp-head button:hover { background: var(--line-faint); color: var(--text-1); }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sheet-body > :last-child { margin-bottom: 22px; }
.sheet-body > .rfp-form:last-child { margin-bottom: 0; } /* پایش دکمه‌های چسبان است */

/* زیر ۱۱۰۰px برگه مودال است: صفحه‌ی پشتش اسکرول نخورد */
@media (max-width: 1099px) { body.sheet-open { overflow: hidden; } }

.rfp-intro { margin-bottom: var(--s-5); color: var(--text-3); font-size: var(--fs-sm); line-height: 1.9; }

.rfp-form { display: grid; gap: var(--s-4); }
#rfp-fields { display: grid; gap: var(--s-4); }
#rfp-fields:empty { display: none; }

.form-legend {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-2);
  color: var(--text-1);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.form-legend::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#rfp-fields:empty + .form-legend { margin-top: 0; }

.rfp-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--s-2);
  margin: 6px -22px 0 !important;
  padding: 14px 22px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.rfp-actions .btn-primary { flex: 1; }

.ghost-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: border-color var(--dur-1), color var(--dur-1);
}
.ghost-btn:hover { border-color: var(--text-1); color: var(--text-1); }

.rfp-msg {
  display: flex;
  gap: var(--s-3);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  line-height: 1.8;
  color: var(--text-1);
}
.rfp-msg .icon { margin-top: 3px; }
.rfp-msg.ok { background: var(--ok-tint); border-color: var(--ok-line); }
.rfp-msg.ok .icon { color: var(--ok); }
.rfp-msg.err { background: var(--danger-tint); border-color: var(--danger-line); }
.rfp-msg.err .icon { color: var(--danger); }

/* نشان‌ها */
.marks-list { display: grid; gap: var(--s-3); }
.mark-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-2);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-raised);
}
.mark-go {
  min-width: 52px;
  height: 46px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: var(--accent-tint);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  direction: ltr;
  transition: background var(--dur-1), color var(--dur-1);
}
.mark-go:hover { background: var(--accent-graphic); color: #fff; }
.mark-row .mark-note { border-color: transparent; background: transparent; padding-inline: 8px; }
.mark-row .mark-note:hover { border-color: var(--line); }
.mark-del {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-faint);
  transition: background var(--dur-1), color var(--dur-1);
}
.mark-del:hover { background: var(--danger-tint); color: var(--danger); }

.empty {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-10) var(--s-4);
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}
.empty .icon { width: 30px; height: 30px; color: var(--text-faint); stroke-width: 1.3; }

/* درخواست‌های من */
.mine-list { display: grid; gap: var(--s-4); }

.mine-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-raised);
}

.mine-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: var(--s-3); }
.mine-head b { font-size: 0.9375rem; }
.mine-head b span { font-family: var(--font-display); font-size: 0.75rem; font-weight: 400; letter-spacing: 0.06em; color: var(--accent); margin-inline-start: 4px; }
.mine-date { margin-inline-start: auto; color: var(--text-3); font-size: var(--fs-xs); }
/* درخواست‌ها مالِ کدند، نه یک کاتالوگ؛ هر کارت می‌گوید دربارهٔ کدام است */
.mine-catalog { margin: -4px 0 var(--s-3); color: var(--text-3); font-size: var(--fs-xs); }

.mine-items { margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.mine-items li {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
  line-height: 1.7;
}
.mine-items li:first-child { border-top: 1px solid var(--line-strong); }
.mine-items li span { color: var(--text-3); }
.mine-items li b { font-weight: 600; text-align: end; }

.mine-meta { margin-top: var(--s-3); color: var(--text-3); font-size: var(--fs-xs); }

.mine-note {
  margin-top: var(--s-3);
  padding: 10px 14px;
  border-inline-start: 2px solid var(--line-strong);
  background: var(--line-faint);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.9;
  white-space: pre-wrap;
}

.mine-thread { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px dashed var(--line-strong); }
.mine-thread h4 { margin-bottom: var(--s-3); color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; }

.cmsg { max-width: 88%; margin-bottom: var(--s-2); padding: 9px 13px; border: 1px solid var(--line); border-radius: 14px; }
.cmsg-head { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 0.6875rem; }
.cmsg-head b { font-size: var(--fs-xs); }
.cmsg p { margin-top: 2px; color: var(--text-1); font-size: var(--fs-sm); line-height: 1.9; white-space: pre-wrap; }
.cmsg-them { border-color: var(--panel-line); border-start-start-radius: 4px; background: var(--panel-grad); }
.cmsg-them .cmsg-head b { color: var(--accent); }
.cmsg-me { margin-inline-start: auto; border-start-end-radius: 4px; background: var(--surface); }

.cmsg-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: var(--s-2); margin-top: var(--s-3); }
.cmsg-form textarea { min-height: 46px; padding-block: 9px; }
.cmsg-form button {
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--primary-bg);
  color: var(--primary-fg);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.cmsg-form button:hover { background: var(--primary-hover); }
.cmsg-form button:disabled { opacity: 0.5; }

.mine-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-top: var(--s-4); }
.mine-locked { color: var(--text-faint); font-size: var(--fs-xs); }

.mine-history { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px dashed var(--line-strong); }
.mine-history .rev { margin-bottom: var(--s-3); font-size: var(--fs-xs); }
.mine-history .rev-no { color: var(--accent); font-weight: 700; }
.mine-history .rev-date { margin-inline-start: 8px; color: var(--text-faint); }
.mine-history ul { margin: 4px 0 0; padding-inline-start: 18px; color: var(--text-3); line-height: 1.9; }

/* دسکتاپ: برگه کنار کاتالوگ می‌نشیند تا هنگام نوشتن، جدول مشخصات دیده شود */
@media (min-width: 1100px) {
  .rfp-modal { top: var(--topbar-h); background: transparent; pointer-events: none; animation: none; }
  .rfp-box { pointer-events: auto; box-shadow: 24px 0 60px -30px rgb(0 0 0 / 0.8); }
  html[dir="ltr"] .rfp-box { box-shadow: -24px 0 60px -30px rgb(0 0 0 / 0.8); }
  body.sheet-open .pages { padding-inline-end: 472px; }
  body.sheet-open .page-slot { width: calc(min(100vw - 496px - var(--sbw, 0px), var(--base-w, 960px)) * var(--zoom)); }
  body.sheet-open .viewer-bar,
  body.sheet-open .stamp-notice { inset-inline-end: 460px; max-width: calc(100vw - 472px); }
  body.sheet-open .page-rail { display: none; }
}

/* موبایل: برگه از پایین بالا می‌آید */
@media (max-width: 700px) {
  .rfp-modal { align-items: flex-end; }
  .rfp-box {
    width: 100%;
    height: auto;
    max-height: 92vh;
    max-height: 92dvh;
    border: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: 20px 20px 0 0;
    animation-name: sheet-up;
  }
  .rfp-head { position: relative; padding-top: 26px; }
  .rfp-head::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 2px;
    background: var(--line-strong);
  }
}

/* ================================================================== *
 * ۶٫۵ نسخه‌ی انگلیسی — همان سیستم، چپ‌به‌راست
 * بیشترِ چیدمان با ویژگی‌های منطقی خودش برمی‌گردد؛ این‌ها استثناهای فیزیکی‌اند.
 * ================================================================== */

/* حروف لاتینِ Vazirmatn (بر پایه‌ی Roboto) همان متنِ انگلیسی کاتالوگ است. لاتین به
   فاصله‌ی سطر کمتری نیاز دارد و — برخلاف فارسی — فشردگیِ ملایم حروف تیتر را می‌پذیرد. */
html[lang="en"] { --lh-body: 1.7; --lh-tight: 1.16; }
html[lang="en"] h1,
html[lang="en"] h2 { letter-spacing: -0.022em; }
html[lang="en"] h3 { letter-spacing: -0.01em; }
html[lang="en"] .gate-copy h1,
html[lang="en"] .welcome h1 { line-height: 1.12; }
html[lang="en"] .lead { max-width: 48ch; }
html[lang="en"] .alert,
html[lang="en"] .gate-note,
html[lang="en"] .rfp-intro,
html[lang="en"] .cmsg p,
html[lang="en"] .mine-note { line-height: 1.65; }

html[dir="ltr"] .read-progress { transform-origin: left center; }
html[dir="ltr"] .rail-tip { left: auto; right: calc(100% + 10px); }
html[dir="ltr"] .rfp-box { animation-name: sheet-side-ltr; }
html[dir="ltr"] body.obscured::after { content: "Return to this window to keep reading"; }

@media (max-width: 700px) {
  html[dir="ltr"] .rfp-box { animation-name: sheet-up; }
}

/* ================================================================== *
 * ۷. حرکت، چاپ
 * ================================================================== */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw-ring { to { stroke-dashoffset: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.7); opacity: 0.2; } 60% { transform: scale(1.12); } 100% { transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes sink { to { opacity: 0; transform: translateY(10px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } }
@keyframes lift { to { opacity: 0; transform: translateY(-10px); } }
@keyframes sheet-side { from { transform: translateX(-32px); opacity: 0; } }
@keyframes sheet-side-ltr { from { transform: translateX(32px); opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.7; } 80%, 100% { transform: scale(2.1); opacity: 0; } }
@keyframes shake {
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

.reveal { animation: enter 0.7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* چاپ عملاً بی‌فایده می‌شود */
@media print {
  body { display: none !important; }
}
