/* Harvestree docs bis — MOIZ blue theme (aligned with external_doc) */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #475569;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --line: #dbe4ee;
  --accent: #1d4ed8;
  --accent-deep: #1e3a8a;
  --accent-soft: #dbeafe;
  --accent-mid: #2563eb;
  --cyan: #0e7490;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --slate: #1e3a8a;
  --code-bg: #0f172a;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --max: 1180px;
  --nav-w: 248px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(29, 78, 216, 0.08), transparent 55%),
    radial-gradient(900px 500px at -5% 20%, rgba(14, 116, 144, 0.06), transparent 50%),
    var(--paper);
  line-height: 1.55;
  font-size: 15.5px;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #1e40af; }

/* —— Shell —— */
.doc-top {
  background: linear-gradient(125deg, #0f172a 0%, #1e3a8a 38%, #1d4ed8 62%, #0e7490 100%);
  color: #fff;
  padding: 26px 24px 22px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}
.doc-top .brand-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: flex-start;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto 12px;
}
.doc-top .brand-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.doc-top .portal-parent {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  text-decoration: none;
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 23, 42, 0.28);
  width: fit-content;
}
.doc-top .portal-parent:hover {
  background: #fff;
  color: var(--accent-deep);
  border-color: #fff;
}
.doc-top .brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.doc-top .brand span {
  opacity: 0.78;
  font-weight: 500;
  margin-left: 8px;
}
.doc-top .audience {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.doc-top .audience a {
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}
.doc-top .audience a:hover,
.doc-top .audience a[aria-current="true"] {
  background: #fff;
  color: var(--accent-deep);
  border-color: #fff;
}
.doc-top h1 {
  max-width: var(--max);
  margin: 0 auto 6px;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  line-height: 1.25;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.doc-top .lede {
  max-width: 68ch;
  margin: 0 auto;
  opacity: 0.95;
  font-size: 0.98rem;
}

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px 24px 48px;
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.side {
  position: sticky;
  top: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 12px;
  border-left: 4px solid var(--accent-mid);
}
.side .side-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  margin: 12px 8px 6px;
}
.side .side-label:first-child { margin-top: 0; }
.side a {
  display: block;
  text-decoration: none;
  color: var(--accent);
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}
.side a:hover {
  background: var(--accent-soft);
  color: #1e40af;
  text-decoration: none;
}
.side a[aria-current="page"] {
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.14), rgba(14, 116, 144, 0.1));
  border: 1px solid rgba(37, 99, 235, 0.18);
}

.content {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px 32px;
  min-width: 0;
}
.content > h2 {
  margin: 1.6rem 0 0.55rem;
  font-size: 1.2rem;
  letter-spacing: 0.1px;
  padding-bottom: 8px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--accent-mid), var(--cyan)) 1;
}
.content > h2:first-child { margin-top: 0; }
.content > h3 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1.02rem;
  color: var(--accent-deep);
  letter-spacing: 0.1px;
}
.content p { margin: 0.45rem 0 0.7rem; max-width: 78ch; color: var(--ink-soft); }
.content ul, .content ol { margin: 0.3rem 0 0.8rem; padding-left: 1.2rem; color: var(--ink-soft); }
.content li { margin: 0.28rem 0; }
.content strong { color: var(--ink); }
.content .muted { color: var(--muted); }

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px 36px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* —— Scan helpers —— */
.glance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 0 0 1.2rem;
}
.glance .tile {
  background: linear-gradient(165deg, #ffffff, #eff6ff);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-mid);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.glance--hero .tile {
  padding: 16px 16px 14px;
  border: none;
  border-left: 4px solid transparent;
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-height: 88px;
}
.glance--hero .k {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: inherit;
  opacity: 0.85;
}
.glance--hero .v {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 4px;
}
.glance .tile--power {
  border-left-color: #ea580c;
}
.glance .tile--config {
  border-left-color: #2563eb;
}
.glance .tile--measure {
  border-left-color: #059669;
}
.glance .tile--radio {
  border-left-color: #7c3aed;
}
.glance .k {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.glance .v {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.3;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 12px 0 8px;
}
.path-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 40px 14px 16px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  border-top: 3px solid var(--line);
}
.path-card::after {
  content: "→";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent-mid);
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s;
}
.path-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
}
.path-card:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(4px);
}
.path-card:focus-visible {
  outline: 2px solid var(--accent-mid);
  outline-offset: 2px;
}
.path-card .step {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}
.path-card strong {
  font-size: 1.02rem;
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.path-card:hover strong {
  text-decoration-color: currentColor;
}
.path-card span { color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.path-card--field {
  background: linear-gradient(165deg, #ffffff, #eff6ff);
  border-top-color: #2563eb;
  border-color: #93c5fd;
}
.path-card--field .step { color: #1d4ed8; }
.path-card--field::after { color: #2563eb; }
.path-card--field:hover {
  border-color: #2563eb;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.16);
}
.path-card--field:hover strong { color: #1d4ed8; }
.path-card--it {
  background: linear-gradient(165deg, #ffffff, #ecfdf5);
  border-top-color: #059669;
  border-color: #6ee7b7;
}
.path-card--it .step { color: #047857; }
.path-card--it::after { color: #059669; }
.path-card--it:hover {
  border-color: #059669;
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.16);
}
.path-card--it:hover strong { color: #047857; }
.path-card--ref {
  background: linear-gradient(165deg, #ffffff, #f5f3ff);
  border-top-color: #7c3aed;
  border-color: #c4b5fd;
}
.path-card--ref .step { color: #6d28d9; }
.path-card--ref::after { color: #7c3aed; }
.path-card--ref:hover {
  border-color: #7c3aed;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.16);
}
.path-card--ref:hover strong { color: #6d28d9; }

.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: start;
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.06), #f8fafc);
  border-left: 4px solid var(--accent-mid);
}
.callout .tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.callout.warn {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.1), #fffbeb);
  border-color: #fcd34d;
  border-left-color: var(--amber);
}
.callout.warn .tag { background: #fde68a; color: #92400e; }
.callout.danger {
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.08), #fff1f2);
  border-color: #fecdd3;
  border-left-color: var(--rose);
}
.callout.danger .tag { background: #fecdd3; color: var(--rose); }
.callout p { margin: 0; max-width: none; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0;
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; }
  .split { grid-template-columns: 1fr; }
}

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #f8fafc;
}
.panel h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--accent-deep);
}
.panel ul { margin: 0; }

/* —— Schematics —— */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}
.flow .node {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 110px;
  text-align: center;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.flow .node small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 2px;
}
.flow .node.accent {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.flow .arrow {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 1.1rem;
  user-select: none;
}

.swim {
  display: grid;
  gap: 10px;
  margin: 12px 0 18px;
}
.swim-row {
  display: grid;
  grid-template-columns: minmax(110px, 140px) 1fr;
  gap: 12px;
  align-items: stretch;
}
.swim-who {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 10px 0;
}
.swim-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid var(--line);
}
.swim-bar span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
}

/* —— Tables & codes —— */
.table-wrap { overflow-x: auto; margin: 8px 0 14px; }
table.dense {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.dense th, table.dense td {
  border: 1px solid var(--line);
  padding: 7px 9px;
  text-align: left;
  vertical-align: top;
}
table.dense th {
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  color: var(--accent-deep);
  font-weight: 700;
  white-space: nowrap;
}
table.dense tr:nth-child(even) td { background: #f8fafc; }
table.dense code, code, .mono {
  font-family: var(--mono);
  font-size: 0.84em;
}
code.inline {
  background: #eff6ff;
  color: var(--accent-deep);
  padding: 1px 5px;
  border-radius: 4px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border: 1px solid #bfdbfe;
}
.chip.neutral {
  background: #eef2f5;
  color: var(--ink-soft);
  border-color: var(--line);
}
.chip.warn {
  background: var(--amber-soft);
  color: #92400e;
  border-color: #fcd34d;
}

.port-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.port-tile {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
a.port-tile:hover,
a.port-tile:focus-visible {
  border-color: #f59e0b;
  background: var(--amber-soft);
  color: #92400e;
  outline: none;
}
a.port-tile.is-active {
  border-color: #d97706;
  background: #ffedd5;
  color: #9a3412;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.35);
}
.port-family {
  margin: 1.1rem 0 1.4rem;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.port-family > h3 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-deep);
  border: none;
}
.mode-card {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  border-left: 4px solid var(--accent-mid);
  background: #fff;
  scroll-margin-top: 16px;
}
.mode-card:target {
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.35);
  border-color: #f59e0b;
  border-left-color: #d97706;
  background: #fffbeb;
}
.mode-card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  color: var(--accent-deep);
}
.mode-card p { margin: 0.35rem 0; max-width: 70ch; }
.mode-card ul { margin: 0.35rem 0 0; }
.mode-card .out {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 6px;
}
.mode-card .hw,
.mode-card .proc {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0.4rem 0;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}
.mode-card .hw strong,
.mode-card .proc strong {
  color: var(--accent-deep);
  font-weight: 600;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.checklist li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 6px 0;
  background: #fff;
}
.checklist .box {
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent-mid);
  border-radius: 4px;
  margin-top: 2px;
}

.toc-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.toc-mini a {
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--accent-deep);
  border: 1px solid #bfdbfe;
}
.toc-mini a:hover {
  background: var(--accent-soft);
  color: #1e40af;
}

pre.sample {
  background: var(--code-bg);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  border: 1px solid #1e3a8a;
}
pre.decoder-src {
  max-height: min(75vh, 56rem);
  overflow: auto;
  margin: 0;
  white-space: pre;
}

.mapping {
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  margin-top: 28px;
  padding-top: 12px;
}
.mapping code { font-size: 0.8em; }

.kbd {
  font-family: var(--mono);
  font-size: 0.8em;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  color: var(--accent-deep);
}

/* —— Media / photos —— */
figure.media {
  margin: 14px 0 18px;
  padding: 0;
}
figure.media img {
  display: block;
  width: 100%;
  max-width: 920px;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
figure.media figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 8px;
}
figure.media.wide img { max-width: 1100px; }
figure.media.media-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}
figure.media.media-row img {
  width: 100%;
  max-width: none;
  margin: 0;
}
figure.media.media-row figcaption {
  grid-column: 1 / -1;
}

details.fold {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 8px 0;
  background: #f8fafc;
}
details.fold summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-deep);
}
details.fold[open] summary { margin-bottom: 8px; }
details.fold p { margin: 0.35rem 0; }

.mermaid {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 12px 0 16px;
  overflow-x: auto;
}
.e2e-flow .mermaid {
  padding: 22px 18px 18px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
}
.e2e-flow .mermaid svg {
  max-width: 100%;
  width: 100%;
  height: auto;
}
.e2e-flow .mermaid .nodeLabel,
.e2e-flow .mermaid .cluster-label,
.e2e-flow .mermaid .edgeLabel {
  font-size: 15px;
}
.alarm-flow {
  margin: 12px 0 18px;
}
.alarm-flow .mermaid {
  background: linear-gradient(180deg, #f8fafc, #fff);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: center;
}
.alarm-flow .mermaid svg {
  max-width: 100%;
  height: auto;
}
.alarm-flow .mermaid .edgeLabel {
  font-size: 12px;
  font-weight: 500;
}

.op-cycle-wrap {
  margin: 12px 0 18px;
  padding: 14px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  box-shadow: var(--shadow);
}
.op-cycle-title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-deep);
}
.op-cycle-sub {
  margin: 0 0 8px;
  font-size: 0.9rem;
}
.op-cycle-wrap .mermaid {
  margin: 8px 0 4px;
  border: none;
  background: transparent;
  padding: 0;
}
.op-cycle-wrap figure.media {
  margin: 8px 0 4px;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.op-cycle-wrap figure.media img {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.op-cycle-wrap figure.media figcaption {
  color: var(--muted);
  font-size: 0.86rem;
}

/* Alarm mode story on Operation page */
.alarm-story {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.alarm-beat {
  flex: 1 1 120px;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
}
.alarm-beat strong {
  color: var(--accent-deep);
  font-size: 0.95rem;
}
.alarm-beat span {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}
.alarm-step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border: 1px solid #bfdbfe;
  margin-bottom: 2px;
}
.alarm-step--alert {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fdba74;
}
.alarm-arrow {
  flex: 0 0 auto;
  align-self: center;
  width: 18px;
  height: 2px;
  background: var(--accent-mid);
  position: relative;
}
.alarm-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border: 5px solid transparent;
  border-left-color: var(--accent-mid);
  border-right-width: 0;
}
@media (max-width: 720px) {
  .alarm-arrow { display: none; }
  .alarm-beat { flex: 1 1 100%; }
}
.alarm-panel--sync {
  border-left: 4px solid var(--accent-mid);
}
.alarm-panel--async {
  border-left: 4px solid #ea580c;
}
.alarm-panel .out,
.panel .out {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 8px;
}

/* Compact async state machine */
.async-sm {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin: 12px 0 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  box-shadow: var(--shadow);
}
.async-sm-state {
  flex: 1 1 140px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 12px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-top-width: 3px;
}
.async-sm-state strong {
  font-size: 0.95rem;
  color: var(--ink);
}
.async-sm-state > span:last-child {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}
.async-sm-tag {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-bottom: 2px;
}
.async-sm-state--calm {
  border-top-color: #2563eb;
}
.async-sm-state--calm .async-sm-tag {
  background: #dbeafe;
  color: #1d4ed8;
}
.async-sm-state--decide {
  border-top-color: #ea580c;
}
.async-sm-state--decide .async-sm-tag {
  background: #ffedd5;
  color: #c2410c;
}
.async-sm-state--alarm {
  border-top-color: #dc2626;
}
.async-sm-state--alarm .async-sm-tag {
  background: #fee2e2;
  color: #b91c1c;
}
.async-sm-state--rearm {
  border-top-color: #059669;
}
.async-sm-state--rearm .async-sm-tag {
  background: #d1fae5;
  color: #047857;
}
.async-sm-arrow {
  flex: 0 0 auto;
  align-self: center;
  width: 14px;
  height: 2px;
  background: #94a3b8;
  position: relative;
}
.async-sm-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border: 5px solid transparent;
  border-left-color: #94a3b8;
  border-right-width: 0;
}
.async-sm-loop {
  margin: 0 0 10px;
  font-size: 0.88rem;
}
@media (max-width: 720px) {
  .async-sm-arrow { display: none; }
  .async-sm-state { flex: 1 1 100%; }
}

/* Uplink decision flow (Three clocks) */
.tx-flow {
  margin: 14px 0 18px;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  box-shadow: var(--shadow);
}
.tx-flow-row {
  display: flex;
  justify-content: center;
}
.tx-node {
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  min-width: 160px;
  max-width: 280px;
}
.tx-node--sleep {
  border-radius: 999px;
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}
.tx-node--decide {
  border-radius: 10px;
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}
.tx-node--alarm {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}
.tx-node--normal {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.tx-node--ghost {
  background: #f8fafc;
  border-style: dashed;
  border-color: #cbd5e1;
  color: var(--muted);
  font-weight: 500;
}
.tx-node--loop {
  border-style: dashed;
}
.tx-flow-join,
.tx-flow-v {
  width: 2px;
  height: 18px;
  margin: 0 auto;
  background: #94a3b8;
}
.tx-flow-v--merge {
  height: 14px;
  margin-top: 4px;
}
.tx-flow-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 640px;
  margin: 6px auto 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.tx-flow-split-l { text-align: center; color: #b91c1c; }
.tx-flow-split-r { text-align: center; color: #c2410c; }
.tx-flow-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
  align-items: start;
}
.tx-flow-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  min-height: 100%;
}
.tx-flow-col--alarm { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fef2f2); }
.tx-flow-col--calm { border-color: #bbf7d0; background: linear-gradient(180deg, #fff, #f0fdf4); }
.tx-flow-col .tx-node { width: 100%; max-width: none; box-sizing: border-box; }
.tx-flow-fork {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin: 8px 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.tx-flow-calm-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.tx-flow-calm-split .tx-node {
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.8rem;
}
.tx-flow-merge {
  display: flex;
  justify-content: center;
  margin: 12px 0 6px;
  position: relative;
}
.tx-flow-merge::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 25%;
  right: 25%;
  height: 2px;
  background: #94a3b8;
}
.tx-flow-merge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 16px;
  background: #94a3b8;
  transform: translateX(-50%);
}
.tx-flow-merge span {
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-deep);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  margin-bottom: 16px;
}
.tx-flow-row--end { margin-top: 8px; }
@media (max-width: 640px) {
  .tx-flow-cols,
  .tx-flow-split,
  .tx-flow-calm-split,
  .tx-flow-fork { grid-template-columns: 1fr; }
  .tx-flow-split-l,
  .tx-flow-split-r { text-align: left; }
  .tx-flow-merge::before { left: 12px; right: 12px; }
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.steps::before {
  content: "";
  position: absolute;
  left: 25px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: linear-gradient(180deg, #93c5fd, #dbeafe);
  z-index: 0;
}
.steps li {
  counter-increment: step;
  position: relative;
  z-index: 1;
  padding: 14px 16px 14px 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 10px 0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-family: var(--mono);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px #fff;
}
.steps li > strong {
  display: block;
  color: var(--accent-deep);
  margin-bottom: 4px;
  font-size: 1rem;
}
.steps li p {
  margin: 0;
  max-width: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}
.steps li p strong {
  display: inline;
  color: var(--ink);
  font-size: inherit;
  margin: 0;
}

.power-block,
.join-path {
  margin: 8px 0 1.4rem;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  box-shadow: var(--shadow);
}
.power-lede,
.join-path-lede {
  margin: 0 0 12px;
  max-width: 70ch;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}
.power-block .glance { margin-bottom: 12px; }
.power-block .split { margin: 0 0 12px; }
.power-block .callout { margin: 0; }
.info-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-top: 3px solid var(--accent-mid);
}
.info-card h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--accent-deep);
  border: none;
}
.info-card--bench { border-top-color: #2563eb; }
.info-card--gate { border-top-color: #ea580c; }
.info-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}
.info-list li { margin: 0.35rem 0; }
.info-list li::marker { color: var(--accent-mid); }
.join-path .steps { margin-top: 4px; }

/* Configure page */
.cfg-channels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 10px 0 14px;
}
@media (max-width: 820px) {
  .cfg-channels { grid-template-columns: 1fr; }
}
.cfg-channel {
  padding: 16px 16px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cfg-channel--toolbox {
  border-top: 3px solid #2563eb;
  background: linear-gradient(180deg, #eff6ff, #fff);
}
.cfg-channel--downlink {
  border-top: 3px solid #059669;
  background: linear-gradient(180deg, #ecfdf5, #fff);
}
.cfg-channel-tag {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.cfg-channel--toolbox .cfg-channel-tag {
  background: #dbeafe;
  color: #1d4ed8;
}
.cfg-channel--downlink .cfg-channel-tag {
  background: #d1fae5;
  color: #047857;
}
.cfg-channel h3 {
  margin: 2px 0 0;
  font-size: 1.05rem;
  color: var(--accent-deep);
  border: none;
}
.cfg-channel-lede {
  margin: 0 0 4px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}
.cfg-channel .info-list { margin: 4px 0 8px; flex: 1; }
.cfg-channel-link {
  margin: 4px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.cfg-channel-link a { color: var(--accent-deep); }
.cfg-compare { margin: 0 0 8px; }
.cfg-flow { margin: 14px 0 4px; }
.cfg-fw {
  margin: 8px 0 14px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  box-shadow: var(--shadow);
}
.cfg-fw > p { margin: 0 0 12px; max-width: 70ch; }
.cfg-fw .chip-row { margin: 10px 0 0; }

/* Release notes */
.release-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.release-nav a {
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.release-nav a:hover {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.release {
  margin: 0 0 16px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  border-left: 4px solid var(--accent-mid);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  scroll-margin-top: 16px;
}
.release--maint {
  border-left-color: #94a3b8;
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.release--major {
  border-left-color: #ea580c;
}
.release--feature {
  border-left-color: var(--accent-mid);
}
.release--ops {
  border-left-color: #0284c7;
}
.release--stable {
  border-left-color: #059669;
}
.release--early {
  border-left-color: #d97706;
  background: linear-gradient(180deg, #fffbeb, #fff);
}
.release--previous {
  border-left-color: #cbd5e1;
  opacity: 0.92;
}
.release-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin: 0 0 10px;
}
.release-head h2 {
  margin: 0;
  font-size: 1.15rem;
  border: none;
  padding: 0;
}
.release-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.release-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}
/* Change-type tags: soft filled pills */
.release-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #92400e;
  border: none;
}
.release-badge--maint {
  background: #e2e8f0;
  color: #475569;
}
.release-badge--first {
  background: #ffedd5;
  color: #9a3412;
}
.release-badge--feature {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.release-badge--bugfix {
  background: #ffe4e6;
  color: #9f1239;
}
.release-badge--operation {
  background: #e0f2fe;
  color: #075985;
}
.release-badge--integration {
  background: #f3e8ff;
  color: #6b21a8;
}
/* Field maturity: outlined square chips (not pills) — distinct from change-type */
.release-maturity {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  background: transparent;
  border: 1.5px solid currentColor;
  line-height: 1.2;
}
.release-maturity--stable {
  color: #047857;
  background: #ecfdf5;
}
.release-maturity--early {
  color: #b45309;
  background: #fffbeb;
}
.release-maturity--previous {
  color: #64748b;
  background: #f8fafc;
}
.release h3 {
  margin: 12px 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: none;
}
.release ul {
  margin: 0 0 4px;
  padding-left: 1.15rem;
}
.release li { margin: 0.28rem 0; }
.release-req {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* Back to top */
.back-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.back-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.back-top:hover { background: var(--accent-deep); }

/* —— Screenshot placeholders (replace with real PNG in assets/shots/) —— */
figure.shot {
  margin: 16px 0 20px;
  padding: 0;
}
figure.shot.wide .shot-frame,
figure.shot.wide img {
  max-width: 1100px;
}
figure.shot img {
  display: block;
  width: 100%;
  max-width: 920px;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
.shot-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 920px;
  min-height: 220px;
  margin: 0 auto;
  padding: 28px 20px;
  border-radius: 12px;
  border: 2px dashed #93c5fd;
  background:
    repeating-linear-gradient(
      -45deg,
      #f8fafc,
      #f8fafc 12px,
      #eff6ff 12px,
      #eff6ff 24px
    );
  box-shadow: var(--shadow);
  text-align: center;
}
.shot-frame .shot-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e40af;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  padding: 4px 10px;
}
.shot-frame .shot-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  max-width: 28rem;
}
.shot-frame .shot-file {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}
figure.shot figcaption {
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 8px;
}
.step-list {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 12px 0 18px;
}
.step-list > li {
  counter-increment: step;
  position: relative;
  padding: 12px 14px 12px 52px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.step-list > li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}
.mini-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.mini-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-deep);
}
.mini-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
