:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e4e2dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #76756f;
  --accent: #2a78d6;
  --accent-soft: #e3eefc;
  --on-accent: #ffffff;
  --code-bg: #eeede8;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  /* ordinal story-status ramp (validated: dataviz --ordinal, light) */
  --st-draft: #86b6ef;
  --st-ac_approved: #5598e7;
  --st-in_progress: #2a78d6;
  --st-in_review: #1c5cab;
  --st-done: #104281;
  --meter-track: #cde2fb;
  --meter-fill: #2a78d6;
  --shadow: 0 1px 2px rgba(20, 20, 18, 0.05), 0 1px 1px rgba(20, 20, 18, 0.03);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #33322f;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #93928a;
    --accent: #3987e5;
    --accent-soft: #1b2c44;
    --on-accent: #ffffff;
    --code-bg: #262624;
    --st-draft: #184f95;
    --st-ac_approved: #256abf;
    --st-in_progress: #3987e5;
    --st-in_review: #6da7ec;
    --st-done: #9ec5f4;
    --meter-track: #184f95;
    --meter-fill: #6da7ec;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --surface-2: #232321;
  --border: #33322f;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #93928a;
  --accent: #3987e5;
  --accent-soft: #1b2c44;
  --on-accent: #ffffff;
  --code-bg: #262624;
  --st-draft: #184f95;
  --st-ac_approved: #256abf;
  --st-in_progress: #3987e5;
  --st-in_review: #6da7ec;
  --st-done: #9ec5f4;
  --meter-track: #184f95;
  --meter-fill: #6da7ec;
  --shadow: none;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn Variable", "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.8;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
code,
pre,
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 5px;
}
bdi {
  unicode-bidi: isolate;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
}
.brand b {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}
.tabs a {
  white-space: nowrap;
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 14px;
}
.tabs a:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.tabs a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.live {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.live .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.live.on .dot {
  background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent);
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  border: 0;
  background: none;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- layout ---------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.stack {
  display: grid;
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 16px;
  margin: 0 0 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .count {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
h1 {
  font-size: 24px;
  line-height: 1.5;
  margin: 0 0 6px;
  font-weight: 800;
}

/* ---------- hero + tiles ---------- */
.hero {
  padding: 22px;
}
.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.hero p {
  margin: 0;
  color: var(--text-2);
}
.hero-next {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-2);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.tile .label {
  font-size: 13px;
  color: var(--text-2);
}
.tile .value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.3;
}
.tile .sub {
  font-size: 12.5px;
  color: var(--muted);
}
a.tile:hover {
  text-decoration: none;
  border-color: var(--accent);
}

/* ---------- chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 9px;
  line-height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.chip.id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  direction: ltr;
  unicode-bidi: isolate;
}
.chip .sw {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.chip.accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.icon-good {
  color: var(--good);
}
.icon-warning {
  color: color-mix(in srgb, var(--warning) 75%, var(--text));
}
.icon-critical {
  color: var(--critical);
}

/* ---------- open items ---------- */
.items {
  display: grid;
  gap: 10px;
}
.item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface);
}
.item.pe {
  border-inline-start: 3px solid var(--accent);
}
.item h3 {
  margin: 0 0 2px;
  font-size: 14.5px;
  font-weight: 700;
}
.item p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
}
.item .row {
  margin-top: 8px;
}
details.more > summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: 10px;
}

/* ---------- roadmap ---------- */
.roadmap {
  list-style: none;
  margin: 0;
  padding: 0;
}
.roadmap li {
  position: relative;
  padding-inline-start: 28px;
  padding-bottom: 14px;
}
.roadmap li::before {
  content: "";
  position: absolute;
  inset-inline-start: 8px;
  top: 18px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}
.roadmap li:last-child::before {
  display: none;
}
.roadmap .dot {
  position: absolute;
  inset-inline-start: 2px;
  top: 7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
}
.roadmap li.done .dot {
  background: var(--accent);
  border-color: var(--accent);
}
.roadmap li.in_progress .dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.roadmap li.next .dot {
  border-color: var(--accent);
}
.roadmap .t {
  font-weight: 700;
}
.roadmap li.current {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 8px 12px 10px;
  padding-inline-start: 28px;
  margin-bottom: 12px;
}
.roadmap li.current::before {
  display: none;
}
.roadmap li.current .dot {
  top: 15px;
}
.roadmap .sum {
  color: var(--text-2);
  font-size: 13.5px;
}

/* ---------- charts ---------- */
.phase-row {
  margin-bottom: 14px;
}
.phase-row .row {
  margin-bottom: 4px;
  font-size: 13.5px;
}
.stack-bar {
  display: flex;
  gap: 2px;
  height: 20px;
}
.stack-bar .seg-bar {
  height: 100%;
  min-width: 4px;
  cursor: default;
}
.stack-bar .seg-bar:first-child {
  border-start-start-radius: 4px;
  border-end-start-radius: 4px;
}
.stack-bar .seg-bar:last-child {
  border-start-end-radius: 4px;
  border-end-end-radius: 4px;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.meter {
  margin-top: 12px;
}
.meter .row {
  font-size: 13.5px;
  margin-bottom: 4px;
}
.meter .track {
  height: 8px;
  border-radius: 4px;
  background: var(--meter-track);
  overflow: hidden;
}
.meter .fill {
  height: 100%;
  background: var(--meter-fill);
  border-radius: 4px;
}
#tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  padding: 4px 9px;
  border-radius: 7px;
}

/* ---------- git ---------- */
.kv {
  display: grid;
  gap: 6px;
}
.kv .row {
  font-size: 13.5px;
}
.commit {
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.commit code {
  flex: none;
}
.commit span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input[type="search"],
.toolbar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  min-height: 36px;
}
.toolbar input[type="search"] {
  flex: 1 1 240px;
  min-width: 0;
}
.toolbar label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-2);
}
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  min-height: 34px;
}
.btn:hover {
  border-color: var(--accent);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn.warn {
  border-color: color-mix(in srgb, var(--critical) 45%, var(--border));
  color: var(--critical);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.pills a,
.pills button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
}
.pills [aria-current="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.pills a:hover {
  text-decoration: none;
}

/* ---------- stories ---------- */
.phase-title {
  font-size: 18px;
  font-weight: 800;
  margin: 22px 0 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.epic {
  margin-bottom: 14px;
  padding: 0;
  overflow: hidden;
}
.epic-head {
  padding: 14px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.epic-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}
.epic-head p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--text-2);
  flex-basis: 100%;
}
.mini-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.mini-progress .track {
  width: 90px;
  height: 6px;
  border-radius: 3px;
  background: var(--meter-track);
  overflow: hidden;
}
.mini-progress .fill {
  height: 100%;
  background: var(--meter-fill);
}
.story {
  border-bottom: 1px solid var(--border);
}
.story:last-child {
  border-bottom: 0;
}
.story-head {
  width: 100%;
  text-align: start;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 12px 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.story-head:hover {
  background: var(--surface-2);
}
.story-head .title {
  font-weight: 700;
  flex: 1 1 260px;
}
.story-head .caret {
  color: var(--muted);
  transition: transform 0.15s;
}
.story[open] .story-head .caret {
  transform: rotate(90deg);
}
:root[dir="rtl"] .story-head .caret {
  transform: scaleX(-1);
}
:root[dir="rtl"] .story[open] .story-head .caret {
  transform: rotate(90deg);
}
.story-body {
  padding: 4px 18px 18px;
}
.story-text {
  color: var(--text-2);
  margin: 0 0 12px;
}
.alt {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}
.ac-list {
  display: grid;
  gap: 8px;
}
.ac {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
}
.ac-top {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}
.gwt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  font-size: 14px;
}
.gwt b {
  font-weight: 800;
  color: var(--text-2);
  font-size: 12.5px;
  padding-top: 2px;
}
.gwt p {
  margin: 0;
}
.gwt ul,
.gwt ol {
  margin: 2px 0;
  padding-inline-start: 20px;
}
.gwt table,
.doc table {
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 13.5px;
}
.gwt th,
.gwt td,
.doc th,
.doc td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: start;
  vertical-align: top;
}
.notes {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 12px;
}
.review {
  margin-top: 14px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.review textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface);
}
.review .row {
  margin-top: 8px;
}
.review-state {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.review-state.changes {
  color: var(--critical);
}
.shots {
  margin-top: 14px;
  font-size: 13.5px;
}
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.shot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 12px;
}
.shot img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.shot:hover img,
.shot:focus-visible img {
  border-color: var(--accent);
}
.shot span {
  direction: ltr;
  overflow-wrap: anywhere;
}
.cov {
  font-size: 12px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--muted);
}
.cov.yes {
  color: var(--good);
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* ---------- decisions + docs ---------- */
.cat-title {
  font-size: 15px;
  font-weight: 800;
  margin: 18px 0 8px;
  color: var(--text-2);
}
.adr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
a.adr-card {
  display: block;
  color: inherit;
}
a.adr-card:hover {
  text-decoration: none;
  border-color: var(--accent);
}
.adr-card h3 {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
}
.notice {
  border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.doc {
  font-size: 15px;
}
.doc h1 {
  font-size: 22px;
}
.doc h2 {
  font-size: 18px;
  margin: 26px 0 8px;
  font-weight: 800;
}
.doc h3 {
  font-size: 16px;
  margin: 20px 0 6px;
  font-weight: 700;
}
.doc ul,
.doc ol {
  padding-inline-start: 22px;
}
.doc li {
  margin: 3px 0;
}
.doc pre {
  background: var(--code-bg);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
}
.doc pre code {
  background: none;
  padding: 0;
}
.doc table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.doc .mermaid {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px;
  overflow-x: auto;
  text-align: center;
  direction: ltr;
  margin: 12px 0;
}
.doc blockquote {
  margin: 10px 0;
  padding: 4px 14px;
  border-inline-start: 3px solid var(--border);
  color: var(--text-2);
}
.doc-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.side-nav {
  position: sticky;
  top: 78px;
  display: grid;
  gap: 4px;
}
.side-nav a {
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
}
.side-nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.side-nav a:hover {
  text-decoration: none;
  background: var(--surface-2);
}
.glossary td:first-child {
  direction: ltr;
  unicode-bidi: isolate;
}

.issues {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  display: grid;
  gap: 4px;
}
.issues li {
  display: flex;
  gap: 6px;
}
.issues code {
  flex: none;
}
footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 32px;
  color: var(--muted);
  font-size: 12.5px;
}

#toast {
  position: fixed;
  inset-block-end: 18px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 60;
}
:root[dir="rtl"] #toast {
  transform: translateX(50%);
}

@media (max-width: 900px) {
  .grid-2,
  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .side-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
  }
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar-inner {
    flex-wrap: wrap;
  }
  .tabs {
    order: 3;
    flex-basis: 100%;
  }
  .brand small {
    display: none;
  }
}
@media (max-width: 480px) {
  .tile .value {
    font-size: 24px;
  }
  .live span {
    display: none;
  }
}
