/* ==========================================================================
   docs.weesa.ir — مرکز مستندات زیرساخت ویسا
   طرح بصری بر پایه‌ی پروتوتایپ ui-ux/project/مستندات ویسا.dc.html
   ========================================================================== */

/* --------------------------------------------------------------- tokens -- */

:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface2: #F4F0E8;
  --sunken: #F0EBE1;
  --ink: #1A1A17;
  --ink2: #524F47;
  --ink3: #8B8578;
  --line: #E6DFD2;
  --line2: #D8CFBE;
  --accent: #3B6FF5;
  --accent-ink: #2A55CC;
  --accent-soft: #EEF2FE;
  --code-bg: #1D1E24;
  --code-ink: #E9E6DF;
  --code-line: #2E3038;
  --code-dim: #9A968C;
  --ok: #0E9F6E;
  --warn: #D98211;
  --danger: #D64545;
  --lh: 1.95;
  --rowpad: 9px;
  --shadow-lg: 0 32px 80px -20px rgba(0, 0, 0, .28);
  --shadow-sm: 0 1px 2px rgba(20, 20, 15, .04);
  --sans: Vazirmatn, "Segoe UI", Tahoma, "Iranian Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --topbar-h: 66px;
  --sidebar-w: 274px;
}

html[data-theme="dark"] {
  --bg: #121210;
  --surface: #191917;
  --surface2: #20201D;
  --sunken: #0D0D0C;
  --ink: #F4F1EA;
  --ink2: #B8B3A7;
  --ink3: #847F73;
  --line: #2B2B26;
  --line2: #3A3A33;
  --accent: #7196FF;
  --accent-ink: #9CB4FF;
  --accent-soft: #1B2540;
  --code-bg: #0D0D0C;
  --code-ink: #E9E6DF;
  --code-line: #262622;
  --ok: #35C08D;
  --warn: #E9A13B;
  --danger: #F07171;
  --shadow-lg: 0 32px 80px -20px rgba(0, 0, 0, .6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
}

/* ---------------------------------------------------------------- reset -- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

code, pre, kbd, samp {
  font-family: var(--mono);
  direction: ltr;
  unicode-bidi: isolate;
}

button { font: inherit; color: inherit; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

@keyframes wRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes wFade { from { opacity: 0; } to { opacity: 1; } }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ---------------------------------------------------------------- shell -- */

.app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  height: 100dvh;
}

/* -------------------------------------------------------------- topbar --- */

.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--topbar-h);
  padding: 0 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  flex: 0 0 auto;
  color: inherit;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.brand-sub { font-size: 10.5px; color: var(--ink3); font-weight: 500; }

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 14px;
}
.topnav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink2);
  white-space: nowrap;
}
.topnav a:hover { background: var(--surface2); color: var(--ink); text-decoration: none; }
.topnav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

.searchbtn {
  flex: 1 1 auto;
  max-width: 420px;
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: text;
  color: var(--ink3);
  text-align: start;
}
.searchbtn:hover { border-color: var(--line2); background: var(--surface2); }
.searchbtn .ico { width: 13px; height: 13px; border: 1.6px solid currentColor; border-radius: 99px; flex: 0 0 auto; }
.searchbtn .lbl { font-size: 13px; flex: 1; }

kbd {
  font-size: 10.5px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink3);
}

.topactions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }

.pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink2);
  background: transparent;
  white-space: nowrap;
}
.pill:hover { border-color: var(--line2); color: var(--ink); text-decoration: none; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--ok); flex: 0 0 auto; }
.dot.amber { background: var(--warn); }
.dot.red { background: var(--danger); }

.iconbtn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink2);
  background: transparent;
}
.iconbtn:hover { border-color: var(--line2); color: var(--ink); }

.menubtn { display: none; }

/* ------------------------------------------------------------- layout --- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 0;
}

/* ------------------------------------------------------------ sidebar --- */

.sidebar {
  border-inline-end: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  padding: 26px 20px 60px;
}

.navgroup { margin-bottom: 26px; }
.navgroup-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink3);
  padding: 0 10px 9px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.navgroup-title .num {
  font-family: var(--mono);
  font-size: 10px;
  opacity: .7;
}
.navgroup-title a { color: inherit; }
.navlist { display: flex; flex-direction: column; gap: 1px; }

.navlink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--rowpad) 11px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink2);
  cursor: pointer;
  position: relative;
}
.navlink:hover { background: var(--surface2); color: var(--ink); text-decoration: none; }
.navlink.on {
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.navlink.on::before {
  content: "";
  position: absolute;
  inset-inline-end: -20px;
  top: 8px; bottom: 8px;
  width: 2.5px;
  border-radius: 99px;
  background: var(--accent);
}
.navlink .label { min-width: 0; }
.navbadge {
  margin-inline-start: auto;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface2);
  color: var(--ink3);
  flex: 0 0 auto;
}
.navlink.on .navbadge { background: var(--surface); color: var(--accent-ink); }

.sidecard {
  margin-top: 8px;
  padding: 15px;
  border: 1px dashed var(--line2);
  border-radius: 13px;
  background: var(--bg);
}
.sidecard h4 { font-size: 12.5px; font-weight: 700; margin: 0 0 5px; }
.sidecard p { font-size: 11.5px; line-height: 1.85; color: var(--ink3); margin: 0 0 10px; }
.sidecard a { font-size: 12px; font-weight: 600; }

/* ---------------------------------------------------------------- main --- */

.main { overflow-y: auto; position: relative; scroll-behavior: smooth; }

.progress {
  position: sticky;
  top: 0;
  height: 2px;
  z-index: 20;
  background: transparent;
}
.progress-bar {
  height: 2px;
  background: var(--accent);
  width: 0;
  transition: width .12s linear;
}

.page { animation: wFade .3s ease both; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 56px 60px 90px; }
.wrap-narrow { max-width: 860px; }

/* ---------------------------------------------------------------- home --- */

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: .04em;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 52px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -1.2px;
  margin: 0 0 20px;
  max-width: 20ch;
  text-wrap: pretty;
}

.hero-lead {
  font-size: 19px;
  line-height: 1.9;
  color: var(--ink2);
  max-width: 64ch;
  margin: 0 0 34px;
  text-wrap: pretty;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 40px;
}
.metric .v { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.metric .k { font-size: 11.5px; color: var(--ink3); margin-top: 3px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 60px;
}

.card {
  display: block;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  color: inherit;
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.card-num {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700;
  margin-bottom: 14px;
  font-family: var(--mono);
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 7px; }
.card-desc { font-size: 13.5px; line-height: 1.9; color: var(--ink3); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 56px;
  align-items: start;
}

.h-sec { font-size: 15px; font-weight: 700; letter-spacing: .02em; margin: 0 0 6px; }
.h-sub { font-size: 13px; color: var(--ink3); margin: 0 0 22px; }

.rowlist {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  color: inherit;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface2); text-decoration: none; }
.row .kind {
  font-size: 10.5px; font-weight: 700; color: var(--ink3);
  width: 62px; flex: 0 0 auto;
}
.row .rtitle { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.row .meta { font-size: 12px; color: var(--ink3); white-space: nowrap; }
.row .arrow { color: var(--ink3); font-size: 13px; }

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.panel + .panel { margin-top: 14px; }
.panel h4 { font-size: 13px; font-weight: 700; margin: 0 0 14px; }
.panel p { font-size: 12.5px; line-height: 1.9; color: var(--ink3); margin: 0; }
.panel .kv {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--ink2); gap: 12px;
}
.panel .kv + .kv { margin-top: 11px; }
.panel .more { margin-top: 16px; font-size: 12px; font-weight: 600; display: inline-block; }
.val-ok { color: var(--ok); font-weight: 600; }
.val-warn { color: var(--warn); font-weight: 600; }
.val-red { color: var(--danger); font-weight: 600; }

.steps { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.step {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding-bottom: 26px;
  border-inline-start: 1.5px solid var(--line);
  margin-inline-start: 17px;
  padding-inline-start: 30px;
  position: relative;
}
.step:last-child { border-inline-start-color: transparent; padding-bottom: 0; }
.step-num {
  position: absolute;
  inset-inline-start: -17.5px;
  top: 0;
  width: 34px; height: 34px;
  border-radius: 99px;
  background: var(--surface);
  border: 1.5px solid var(--line2);
  color: var(--ink2);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  font-family: var(--mono);
}
.step:first-child .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step h3 { font-size: 17px; font-weight: 700; margin: 4px 0 8px; }
.step p { font-size: 14.5px; line-height: var(--lh); color: var(--ink2); margin: 0; }
.step a { font-weight: 600; }

/* ------------------------------------------------------------- article --- */

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 246px;
  max-width: 1180px;
  margin: 0 auto;
  gap: 48px;
  padding: 52px 60px 120px;
}

.article { min-width: 0; max-width: 78ch; }

.crumbs {
  font-size: 12px;
  color: var(--ink3);
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.crumbs a { color: var(--ink3); }
.crumbs a:hover { color: var(--accent-ink); }

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink3);
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}
.article-meta .sep { opacity: .5; }
.article-meta .srcbtn {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--ink2);
}
.article-meta .srcbtn:hover { border-color: var(--line2); color: var(--ink); text-decoration: none; }

/* ---- markdown body ---- */

.md { font-size: 16px; line-height: var(--lh); color: var(--ink2); }

.md .doc-h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.9px;
  line-height: 1.3;
  margin: 0 0 18px;
  color: var(--ink);
  text-wrap: pretty;
}
.md h2 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.4px;
  margin: 52px 0 14px;
  scroll-margin-top: 24px;
  color: var(--ink);
  position: relative;
  text-wrap: pretty;
}
.md h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 36px 0 12px;
  scroll-margin-top: 24px;
  color: var(--ink);
}
.md h4 {
  font-size: 16px;
  font-weight: 700;
  margin: 28px 0 10px;
  scroll-margin-top: 24px;
  color: var(--ink);
}
.md h2 + h3 { margin-top: 22px; }

.md .anchor {
  position: absolute;
  inset-inline-end: 100%;
  padding-inline-end: 10px;
  color: var(--line2);
  font-weight: 500;
  opacity: 0;
  transition: opacity .15s ease;
  text-decoration: none;
}
.md h2:hover .anchor { opacity: 1; }
.md h3 .anchor, .md h4 .anchor { display: none; }

.md p { margin: 0 0 20px; text-wrap: pretty; }
.md strong { color: var(--ink); font-weight: 700; }
.md em { font-style: normal; background: linear-gradient(transparent 62%, var(--accent-soft) 0); padding: 0 2px; }

.md ul, .md ol { margin: 0 0 22px; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 9px; }
.md li { text-wrap: pretty; }
.md li > ul, .md li > ol { margin: 9px 0 0; }
.md ol { list-style: none; counter-reset: li; padding-inline-start: 0; }
.md ol > li { counter-increment: li; padding-inline-start: 30px; position: relative; }
.md ol > li::before {
  content: counter(li);
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  width: 21px; height: 21px;
  border-radius: 7px;
  background: var(--surface2);
  color: var(--ink2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  display: grid; place-items: center;
}
.md ul { list-style: none; padding-inline-start: 0; }
.md ul > li { padding-inline-start: 20px; position: relative; }
.md ul > li::before {
  content: "";
  position: absolute;
  inset-inline-start: 6px;
  top: .78em;
  width: 5px; height: 5px;
  border-radius: 99px;
  background: var(--line2);
}

.md ul.task-list > li { padding-inline-start: 30px; }
.md ul.task-list > li::before { display: none; }
.md .task-box {
  position: absolute;
  inset-inline-start: 0;
  top: .2em;
  width: 19px; height: 19px;
  border-radius: 6px;
  border: 1.5px solid var(--line2);
  display: grid; place-items: center;
  font-size: 11px;
  color: #fff;
}
.md li.task.done .task-box { background: var(--ok); border-color: var(--ok); }
.md li.task.done .task-text { color: var(--ink2); }

.md code {
  font-size: .87em;
  background: var(--surface2);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  word-break: break-word;
}
.md a.doc-ref code {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
}
.md a.doc-ref:hover { text-decoration: none; }
.md a.doc-ref:hover code { border-color: var(--accent); }

.md hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* ---- tables ---- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
  margin: 0 0 28px;
  background: var(--surface);
}
.md table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 13.5px; }
.md thead th {
  background: var(--surface2);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink2);
  padding: 12px 16px;
  text-align: start;
  white-space: nowrap;
}
.md tbody td {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink2);
  vertical-align: top;
  line-height: 1.85;
}
.md tbody tr:hover td { background: var(--surface2); }
.md tbody td:first-child { color: var(--ink); font-weight: 600; }
/* شناسه‌ها و دستورها داخل جدول نباید وسط کلمه بشکنند؛ جدول به‌جایش اسکرول می‌شود */
.md td > code, .md th > code { white-space: nowrap; }

/* ---- code blocks ---- */

.code-block, .mermaid-block {
  margin: 0 0 28px;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid var(--code-line);
  background: var(--code-bg);
}
.code-block figcaption, .mermaid-block figcaption {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--code-bg);
  padding: 8px 12px;
  border-bottom: 1px solid var(--code-line);
}
.code-lang {
  font-size: 11px;
  color: var(--code-dim);
  font-family: var(--mono);
  direction: ltr;
}
.fig-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.code-block figcaption .js-copy { margin-inline-start: auto; }

.btn-ghost {
  font-size: 11px;
  color: #C9C5BC;
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--code-line);
  background: transparent;
  font-family: var(--sans);
  white-space: nowrap;
}
.btn-ghost:hover { border-color: #4A4C55; color: #fff; text-decoration: none; }

.code-block pre, .mermaid-block pre {
  margin: 0;
  padding: 16px 18px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 13px;
  line-height: 1.9;
  overflow-x: auto;
  direction: ltr;
  text-align: start;
}
.code-block pre code, .mermaid-block pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
  white-space: pre;
}
.mermaid-block[data-rendered] pre.mermaid-src { display: none; }
.mermaid-block .mermaid-canvas { background: var(--surface); padding: 20px; overflow-x: auto; }
.mermaid-block .mermaid-canvas svg { max-width: 100%; height: auto; }

/* ---- status marks ---- */

.mark {
  font-size: .92em;
  line-height: 1;
  display: inline-block;
  vertical-align: baseline;
}

/* ---- feedback / footer of article ---- */

.article-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 52px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.pager { display: flex; gap: 12px; flex-wrap: wrap; width: 100%; }
.pager a {
  flex: 1 1 240px;
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .dir { font-size: 11.5px; color: var(--ink3); margin-bottom: 5px; }
.pager .t { font-size: 14px; font-weight: 700; }
.pager .next { text-align: end; }

/* ---- table of contents ---- */

.toc {
  position: sticky;
  top: 34px;
  align-self: start;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding-bottom: 20px;
}
.toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink3);
  margin-bottom: 14px;
}
.toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-inline-start: 1.5px solid var(--line);
}
.toc-list a {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink3);
  padding: 6px 14px;
  line-height: 1.7;
  border-inline-start: 1.5px solid transparent;
  margin-inline-start: -1.5px;
}
.toc-list a.lv3 { padding-inline-start: 26px; font-size: 12.5px; }
.toc-list a:hover { color: var(--ink); text-decoration: none; }
.toc-list a.on {
  font-weight: 700;
  color: var(--accent-ink);
  border-inline-start-color: var(--accent);
}

/* -------------------------------------------------------------- status --- */

.status-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  margin: 0 0 28px;
  flex-wrap: wrap;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink2);
  cursor: pointer;
}
.filter:hover { border-color: var(--line2); }
.filter.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.filter .n { font-family: var(--mono); font-size: 11.5px; opacity: .8; }

.statuslist { display: flex; flex-direction: column; gap: 10px; }
.statusitem {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}
.statusitem .bullet { font-size: 15px; line-height: 1.4; }
.statusitem .txt { font-size: 14.5px; line-height: 1.9; color: var(--ink2); text-wrap: pretty; }
.statusitem .src { margin-top: 8px; font-size: 12px; color: var(--ink3); display: flex; gap: 8px; flex-wrap: wrap; }
.statusitem.red { border-inline-start: 3px solid var(--danger); }
.statusitem.amber { border-inline-start: 3px solid var(--warn); }
.statusitem.green { border-inline-start: 3px solid var(--ok); }

/* ------------------------------------------------------------ sec index -- */

.secgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.seccard {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
}
.seccard:hover { border-color: var(--accent); text-decoration: none; }
.seccard .t { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.seccard .d { font-size: 13px; line-height: 1.85; color: var(--ink3); }
.seccard .n { font-size: 11.5px; color: var(--ink3); margin-top: 12px; font-family: var(--mono); }

/* --------------------------------------------------------------- search -- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 20, 15, .46);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  padding: 11vh 16px 16px;
  animation: wFade .16s ease both;
}
.overlay[hidden] { display: none; }

.searchbox {
  width: min(680px, 100%);
  max-height: 74vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wRise .22s cubic-bezier(.2, .8, .2, 1) both;
}
.searchbox .top {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.searchbox .top .ico { width: 15px; height: 15px; border: 1.8px solid var(--ink3); border-radius: 99px; flex: 0 0 auto; }
.searchbox input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 16.5px;
  color: var(--ink);
  min-width: 0;
}
.searchbox .results { overflow-y: auto; padding: 9px; }

.sresult {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border-radius: 11px;
  cursor: pointer;
  color: inherit;
}
.sresult:hover { background: var(--surface2); text-decoration: none; }
.sresult.on { background: var(--accent-soft); }
.sresult .kind {
  font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 5px;
  background: var(--surface2); color: var(--ink3);
  flex: 0 0 auto;
}
.sresult.on .kind { background: var(--surface); color: var(--accent-ink); }
.sresult .body { flex: 1; min-width: 0; }
.sresult .t { font-size: 14.5px; font-weight: 600; }
.sresult.on .t { color: var(--accent-ink); }
.sresult .snip {
  font-size: 12px; color: var(--ink3);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sresult .snip mark { background: transparent; color: var(--accent-ink); font-weight: 700; }
.sresult .sec { font-size: 12px; color: var(--ink3); flex: 0 0 auto; }
.sresult .ret { color: var(--accent-ink); font-size: 13px; }

.searchbox .foot {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 11.5px;
  color: var(--ink3);
  flex-wrap: wrap;
}
.searchbox .foot .count { margin-inline-start: auto; }

.empty { padding: 44px 20px; text-align: center; }
.empty .t { font-size: 14.5px; font-weight: 600; margin-bottom: 7px; }
.empty .d { font-size: 13px; color: var(--ink3); line-height: 1.9; }

/* ---------------------------------------------------------------- misc --- */

.toast {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-start: 50%;
  transform: translateX(50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(50%) translateY(0); }

.scrim { display: none; }

/* ----------------------------------------------------------- responsive -- */

@media (max-width: 1180px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 44px 44px 100px; }
  .toc { display: none; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 34px; }
}

@media (max-width: 1080px) {
  .topnav { display: none; }
}

@media (max-width: 900px) {
  .menubtn { display: grid; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  /* کشوی کناری: خارج از صفحه به سمت راست (چون کل سایت RTL است) */
  .sidebar {
    position: fixed;
    z-index: 60;
    top: var(--topbar-h);
    bottom: 0;
    right: 0;
    left: auto;
    width: min(300px, 84vw);
    transform: translateX(100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0;
    background: rgba(20, 20, 15, .4);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .wrap { padding: 36px 22px 70px; }
  .article-layout { padding: 32px 22px 80px; }
  .hero-title { font-size: 34px; letter-spacing: -.6px; }
  .hero-lead { font-size: 16.5px; }
  .md .doc-h1 { font-size: 29px; letter-spacing: -.4px; }
  .md h2 { font-size: 22px; margin-top: 40px; }
  .md { font-size: 15.5px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand-sub { display: none; }
  .searchbtn .lbl { font-size: 12.5px; }
  .searchbtn kbd { display: none; }
  .statuspill { display: none; }
  .metrics { gap: 18px; padding: 16px 18px; }
  .overlay { padding-top: 6vh; }
}

@media (max-width: 560px) {
  .searchbtn { max-width: none; }
  .verpill { display: none; }
  .row .kind { display: none; }
  .row .meta { display: none; }
  .article-meta .srcbtn { margin-inline-start: 0; }
  .sresult .sec { display: none; }
}

/* --------------------------------------------------------------- print --- */

@media print {
  body { overflow: visible !important; }
  .topbar, .sidebar, .toc, .progress, .overlay, .scrim, .article-foot, .btn-ghost, .anchor { display: none !important; }
  .app, .layout, .main { display: block; height: auto; overflow: visible; }
  .article-layout, .wrap { padding: 0; max-width: none; }
  .md { font-size: 11pt; }
  .code-block pre { white-space: pre-wrap; }
  a { color: inherit; }
}
