/* GET documentation site: shared stylesheet.
   One file for the whole site. Tokens first, then layout, then components. */

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

:root {
  --bg:           #f6f8fb;
  --bg-raised:    #ffffff;
  --bg-sunken:    #eef3f7;
  --bg-code:      #f1f4f7;
  --border:       #d5dee7;
  --border-firm:  #6f8498;
  --text:         #17232e;
  --text-muted:   #4d6071;
  --text-faint:   #52677a;
  --accent:       #0c6770;
  --accent-soft:  #e1f3f2;
  --accent-line:  #70b7b7;
  --warn:         #8b5600;
  --warn-soft:    #fff3dc;
  --warn-line:    #d4a45d;
  --good:         #246d46;
  --good-soft:    #e4f5eb;
  --good-line:    #83c39f;
  --plan:         #6c419b;
  --bad:          #a3242c;
  --bad-soft:     #fdecec;
  --bad-line:     #dfa1a1;
  /* Text on an --accent fill. Both themes need it: the light accent is dark
     and the dark accent is light, so neither one colour works on both. */
  --on-accent:    #ffffff;

  color-scheme: light;

  --sidebar-w: 17.5rem;
  --toc-w: 15rem;
  --layout-max: 96rem;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  --bg:#14181c; --bg-raised:#1c2228; --bg-sunken:#101419; --bg-code:#1d242b;
  --border:#303a44; --border-firm:#536272; --text:#edf1f4; --text-muted:#b1bcc7;
  --text-faint:#94a1ae; --accent:#7dd3d5; --accent-soft:#153238; --accent-line:#35777b;
  --warn:#f0c574; --warn-soft:#332817; --warn-line:#735828; --good:#8bd5a9;
  --good-soft:#183126; --good-line:#376a4c; --plan:#c6a8ef;
  --bad:#f2a7a7; --bad-soft:#33191b; --bad-line:#6f3b3b; --on-accent:#0d1a1c;
  color-scheme: dark;
}



/* ---------- base ------------------------------------------------------ */

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

html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Themed scrollbars. Without this the default light scrollbar on an overflowing
   code block is the brightest thing on a dark page. */
* { scrollbar-width: thin; scrollbar-color: var(--border-firm) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-firm); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .16em; }
a:hover { text-decoration-thickness: .14em; }

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

.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;
}
.skip-link {
  position: fixed; z-index: 100; top: .7rem; left: .7rem; padding: .55rem .8rem;
  border-radius: 6px; background: var(--text); color: var(--bg); transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 620; letter-spacing: -0.011em; }
h1 { font-size: 2.1rem; margin: 0 0 .4rem; letter-spacing: -0.021em; }
h2 {
  font-size: 1.4rem;
  margin: 2.8rem 0 .9rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}
h3 { font-size: 1.1rem; margin: 2rem 0 .6rem; }
h4 { font-size: .97rem; margin: 1.5rem 0 .4rem; color: var(--text-muted); }

p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.3rem; }
li { margin: .3rem 0; }
li > ul, li > ol { margin-top: .3rem; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* anchor links beside headings */
.anchor {
  opacity: 0;
  margin-left: .4rem;
  font-weight: 400;
  color: var(--text-faint);
  text-decoration: none;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }

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

code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .35em;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1.2rem;
  font-size: .855rem;
  line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; font-size: 1em; }

.codeblock { position: relative; }
.codeblock > .lang {
  position: absolute;
  top: .5rem; right: .6rem;
  font-size: .68rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-faint);
  pointer-events: none;
}
.copy-btn {
  position: absolute;
  top: .45rem; right: .45rem;
  font: inherit;
  font-size: .72rem;
  padding: .15rem .5rem;
  border: 1px solid var(--border-firm);
  border-radius: 5px;
  background: var(--bg-raised);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}
.codeblock:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn:focus-visible { opacity: 1; }

/* syntax tinting, applied by site.js, deliberately minimal */
.tok-com { color: var(--text-faint); font-style: italic; }
.tok-str { color: var(--good); }
.tok-key { color: var(--accent); }
.tok-num { color: var(--plan); }
.tok-fn  { color: var(--warn); }

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

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  /* Past this width the whole page centres rather than growing: the sidebar
     stops drifting away from the text, and the reading column stays put
     instead of sliding left as the window widens. */
  max-width: var(--layout-max);
  margin: 0 auto;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-sunken);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1.1rem 0 3rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.1rem 1rem;
  margin-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.brand a { color: var(--text); font-weight: 680; font-size: 1.02rem; letter-spacing: -.01em; }
.brand a:hover { text-decoration: none; color: var(--accent); }
.brand .mark {
  width: 26px; height: 26px; flex: none;
}
.brand-repo {
  display: block;
  padding: 0 1.1rem;
  margin: -.15rem 0 .9rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.brand-repo:hover { color: var(--accent); text-decoration: underline; }
.brand .tag {
  font-size: .68rem;
  color: var(--text-faint);
  border: 1px solid var(--border-firm);
  border-radius: 20px;
  padding: 0 .45rem;
  margin-left: auto;
}

.sidebar-tools { padding: 0 .8rem .65rem; border-bottom: 1px solid var(--border); }
.sidebar-tools input {
  width: 100%; min-height: 2.4rem; border: 1px solid var(--border-firm); border-radius: 7px;
  background: var(--bg-raised); color: var(--text); padding: .45rem .65rem; font: inherit;
  font-size: .84rem;
}
.sidebar-tools input::placeholder { color: var(--text-faint); }
.theme-toggle {
  border: 0; background: transparent; color: var(--text-muted); padding: .45rem .15rem 0;
  font: inherit; font-size: .76rem; cursor: pointer; text-decoration: underline;
  text-underline-offset: .15em;
}

.nav-group { padding: .35rem 0 .1rem; }
.nav-group > .nav-title {
  display: flex;
  align-items: center;
  width: 100%;
  gap: .4rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-faint);
  font-weight: 650;
  padding: .35rem 1.1rem .35rem .9rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.sidebar .nav-title:hover { color: var(--text); }

/* The caret is drawn rather than typed, so it inherits colour and needs no
   font that might be missing. */
.nav-group > .nav-title::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transition: transform .15s ease;
}
.nav-group.open > .nav-title::before { transform: rotate(90deg); }
.nav-group.open > .nav-title { color: var(--text-muted); }

/* Collapsed sections are hidden outright rather than height-animated: the
   click navigates, so the section is gone before any transition could play. */
.nav-items { display: none; }
.nav-group.open > .nav-items { display: block; }
.sidebar a.nav-link {
  display: block;
  padding: .3rem 1.1rem .3rem 1.15rem;
  font-size: .875rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
}
.sidebar a.nav-link, .toc a, .pager a { text-decoration: none; }
.sidebar a.nav-link:focus-visible, .toc a:focus-visible, .pager a:focus-visible { text-decoration: underline; }
.sidebar a.nav-link:hover { color: var(--text); background: var(--bg-raised); text-decoration: none; }
.sidebar a.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 560;
}
.nav-status {
  float: right; margin-left: .35rem; padding: 0 .35rem; border: 1px solid var(--border-firm);
  border-radius: 999px; font-size: .61rem; line-height: 1.55; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .035em;
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 2.5rem;
  /* No max-width: the grid fills the space beside the sidebar so the contents
     rail sits against the right edge. The reading column is capped by `main`
     below instead, which is what should be limited -- capping the grid put the
     rail in the middle of the page with empty space to its right. */
  padding: 2.4rem 2.2rem 6rem;
}
.content > main { max-width: 54rem; grid-column: 1; grid-row: 1; }
.content.no-toc { grid-template-columns: minmax(0, 1fr); }

main { min-width: 0; }

/* on-page table of contents */
.toc {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 2.4rem;
  align-self: start;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  font-size: .82rem;
  border-left: 1px solid var(--border);
  padding-left: 1rem;
}
.toc-toggle {
  width: 100%; border: 0; background: transparent; text-align: left; padding: 0;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-faint);
  font-weight: 650;
  margin-bottom: .5rem;
  cursor: pointer;
}
.toc-toggle::after { content: "\00a0\25be"; }
.toc-toggle[aria-expanded="false"]::after { content: "\00a0\25b8"; }
.toc a { display: block; color: var(--text-muted); padding: .17rem 0; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.lvl-3 { padding-left: .8rem; font-size: .78rem; }
.toc a.active { color: var(--accent); font-weight: 560; }

/* page header block */
.page-kicker {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-faint);
  font-weight: 650;
  margin-bottom: .5rem;
}
.lede {
  font-size: 1.08rem;
  color: var(--text-muted);
  margin: 0 0 1.6rem;
  max-width: 46rem;
}

/* prev / next */
.pager {
  display: flex;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.pager a {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  background: var(--bg-raised);
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .dir { display: block; font-size: .7rem; text-transform: uppercase;
              letter-spacing: .08em; color: var(--text-faint); }
.pager .to-next { text-align: right; }

/* ---------- components ------------------------------------------------ */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.3rem;
  font-size: .89rem;
}
.table-wrap { overflow-x: auto; margin-bottom: 1.3rem; }
.table-wrap table { margin-bottom: 0; }
th, td {
  text-align: left;
  padding: .5rem .7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-weight: 620;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-firm);
}
tbody tr:hover { background: var(--bg-sunken); }
td code { white-space: nowrap; }

.callout, .note, .warn, .tip {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-firm);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin: 0 0 1.3rem;
  background: var(--bg-raised);
  font-size: .93rem;
}
.callout > :last-child, .note > :last-child, .warn > :last-child,
.tip > :last-child { margin-bottom: 0; }
.note  { border-left-color: var(--accent); background: var(--accent-soft); }
.warn  { border-left-color: var(--warn);   background: var(--warn-soft); }
.tip   { border-left-color: var(--good);   background: var(--good-soft); }
/* Neutral by design: a callout marks something worth stopping on without
   claiming it is a warning. Left border only, no tinted fill. */
.callout { border-left-color: var(--border-firm); }
.callout ul { margin-bottom: 0; }
.callout b, .note b, .warn b, .tip b { font-weight: 650; }

/* card grid, used on the landing page */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 0 0 1.6rem;
}
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  background: var(--bg-raised);
  color: inherit;
}
.card:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.card h3 { margin: 0 0 .3rem; font-size: 1rem; color: var(--accent); }
.card p  { margin: 0; font-size: .88rem; color: var(--text-muted); }

/* figures / diagrams */
figure {
  margin: 0 0 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 1.1rem;
  overflow-x: auto;
}
figure svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
figure img { display: block; width: 100%; height: auto; margin: 0 auto; }

/* On a phone the diagrams would otherwise shrink to fit, taking their 11px
   labels down with them. `figure` already scrolls; this gives the SVG a floor
   so the scroll actually engages instead. Gated below the desktop breakpoint,
   so wide screens are unaffected. */
@media (max-width: 700px) {
  figure svg { min-width: 600px; }
  figure.result-figure img { min-width: 680px; }
  figure .loop-flow { min-width: 0; }
}
figcaption {
  margin-top: .8rem;
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
}

/* svg diagram theming hooks */
.d-fill-bg   { fill: var(--bg-raised); }
.d-fill-box  { fill: var(--bg-sunken); }
.d-fill-acc  { fill: var(--accent-soft); }
.d-fill-warn { fill: var(--warn-soft); }
.d-fill-good { fill: var(--good-soft); }
.d-stroke    { stroke: var(--border-firm); fill: none; }
.d-stroke-acc{ stroke: var(--accent); fill: none; }
.d-text      { fill: var(--text); font-family: var(--font); font-size: 13px; }
.d-text-sm   { fill: var(--text-muted); font-family: var(--font); font-size: 11px; }
.d-text-mono { fill: var(--text); font-family: var(--mono); font-size: 12px; }
.d-text-acc  { fill: var(--accent); font-family: var(--font); font-size: 12px; font-weight: 600; }

.loop-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.8rem;
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: loop-step;
}
.loop-flow li {
  position: relative;
  min-width: 0;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--accent-soft);
  padding: .8rem;
  text-align: center;
}
.loop-flow li:not(:last-child)::after {
  content: "→";
  position: absolute;
  left: calc(100% + .9rem);
  top: 50%;
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1;
  transform: translate(-50%, -50%);
}
.loop-flow b { display: block; }
.loop-flow span { display: block; color: var(--text-muted); font-size: .82rem; }
.d-fill-acc.d-stroke-acc { fill: var(--accent-soft); }
.d-fill-box.d-stroke { fill: var(--bg-sunken); }
.d-fill-good.d-stroke { fill: var(--good-soft); }
.d-fill-warn.d-stroke { fill: var(--warn-soft); }


/* mobile nav toggle */
.nav-toggle { display: none; }

/* Landing and onboarding pages. */
.hero { padding: 1.2rem 0 .5rem; }
.hero h1 { max-width: 46rem; font-size: clamp(2.2rem, 5vw, 3.5rem); }
.hero .lede { font-size: 1.18rem; }
.status-banner {
  display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; margin: 1rem 0 1.6rem;
  border: 1px solid var(--warn-line); border-radius: var(--radius); background: var(--warn-soft);
}
.status-banner .status-label {
  flex: none; padding: .08rem .45rem; border-radius: 999px; background: #8b5600; color: #fff;
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.path-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.path-card {
  display: flex; flex-direction: column; min-height: 12rem; padding: 1.15rem; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg-raised); color: inherit; text-decoration: none;
}
a.path-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 8px 24px rgba(23,35,46,.08); }
.path-card .eyebrow { color: var(--text-faint); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.path-card h2, .path-card h3 { border: 0; padding: 0; margin: .45rem 0; color: var(--accent); }
.path-card:not(a) h2, .path-card:not(a) h3 { color: var(--text); }
.path-card p { color: var(--text-muted); font-size: .9rem; }
.path-card .card-action { margin-top: auto; color: var(--accent); font-weight: 650; }
.step-list { list-style: none; counter-reset: step; padding: 0; }
.step-list > li { position: relative; padding: 0 0 1.3rem 3rem; counter-increment: step; }
.step-list > li::before {
  content: counter(step); position: absolute; left: 0; top: -.1rem; display: grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 750;
}
.glossary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1.4rem; }
.glossary-grid > div { border-top: 1px solid var(--border); padding-top: .75rem; }
.glossary-grid dt { font-weight: 700; }
.glossary-grid dd { margin: .2rem 0 0; color: var(--text-muted); }
.route-table td:first-child { font-weight: 680; }
.availability { display: inline-block; border-radius: 999px; padding: .08rem .45rem; font-size: .7rem; font-weight: 700; }
.availability.ready { background: var(--good-soft); color: var(--good); }
.availability.source { background: var(--warn-soft); color: var(--warn); }

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

@media (max-width: 1100px) {
  .content { grid-template-columns: minmax(0, 1fr); }
  .content > main { grid-column: 1; grid-row: auto; }
  /* Above the text rather than gone. Below it, the contents would sit past the
     end of the page they index, which is no use to anyone. */
  .toc {
    grid-column: 1;
    grid-row: auto;
    order: -1;
    position: static;
    max-height: none;
    overflow: visible;
    border-left: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 0 1rem;
    margin-bottom: .5rem;
  }
  .toc-toggle { min-height: 2.75rem; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-raised); }
  .toc-links { padding: .55rem .75rem .2rem; }
}

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    z-index: 30;
    width: min(20rem, 85vw);
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: 0 0 30px rgba(0,0,0,.18);
    visibility: hidden;
    padding-top: 4.6rem;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 20; background: rgba(8,16,22,.48); }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    position: fixed;
    top: .9rem; left: 1rem;
    z-index: 40;
    min-width: 6rem; height: 2.75rem;
    padding: 0 .8rem;
    border: 1px solid var(--border-firm);
    border-radius: 6px;
    background: var(--bg-raised);
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-weight: 650;
  }
  .content { padding: 3.6rem 1.2rem 5rem; }
  h1 { font-size: 1.7rem; }
  .path-grid { grid-template-columns: 1fr; }
  .path-card { min-height: 0; }
  .glossary-grid { grid-template-columns: 1fr; }
  .loop-flow { grid-template-columns: 1fr; gap: 1.6rem; }
  .loop-flow li:not(:last-child)::after {
    content: "↓";
    right: auto;
    left: 50%;
    top: calc(100% + .8rem);
    bottom: auto;
    transform: translate(-50%, -50%);
  }
  .status-banner { display: block; }
  .status-banner .status-label { display: inline-block; margin-bottom: .45rem; }
}

@media print {
  .sidebar, .toc, .nav-toggle, .pager, .copy-btn { display: none; }
  .layout, .content { display: block; max-width: none; }
}

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


/* ---------- the config builder ------------------------------------------
   Only `guide/config-builder.html` uses these. They live here rather than in
   that page because the site is one stylesheet, and every colour is a token so
   the builder follows the theme like everything else. Class names are prefixed
   `cb-` where they would otherwise collide with a site component. */

.cb-shell { display: grid; gap: 1.75rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 62rem) {
  .cb-shell { grid-template-columns: minmax(0, 1fr) 24rem; gap: 2rem; }
  .cb-panel-col { position: sticky; top: 1.5rem; }
}
.cb-form { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }

.cb-block {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.3rem;
}
.cb-block > h2 {
  font-size: 1.02rem; font-weight: 620; letter-spacing: -0.008em;
  margin: 0 0 .15rem; padding: 0; border: 0;
  display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap;
}
.cb-block > h2 .tbl {
  font-family: var(--mono); font-size: .8rem; font-weight: 500;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); border-radius: 5px; padding: .05rem .4rem;
}
.cb-note { color: var(--text-muted); font-size: .87rem; margin: 0 0 1rem; max-width: 58ch; }
.cb-fields { display: flex; flex-direction: column; gap: 1rem; }
.cb-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: .9rem; }
.cb-field { min-width: 0; }

/* `[hidden]` is a user-agent `display: none`, so any author `display` beats it,
   and every conditional block here carries one, through .cb-fields or .cb-grid2. */
[hidden] { display: none !important; }

.cb-label {
  display: block; font-size: .82rem; font-weight: 600; letter-spacing: .01em;
  margin-bottom: .45rem; color: var(--text);
}
.cb-label .key { font-family: var(--mono); font-weight: 500; color: var(--text-muted); }
.cb-req {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--warn); margin-left: .35rem; vertical-align: .08em;
}

.cb-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.cb-choice {
  appearance: none; background: var(--bg-sunken); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 7px; padding: .5rem .8rem;
  font: inherit; font-size: .88rem; line-height: 1.3; text-align: left; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
  display: flex; flex-direction: column; gap: .1rem; min-width: 8.5rem;
}
.cb-choice .cname { font-family: var(--mono); font-size: .87rem; color: var(--text); }
.cb-choice .cdesc { font-size: .76rem; color: var(--text-faint); }
.cb-choice:hover { border-color: var(--border-firm); background: var(--bg-raised); }
.cb-choice[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--text);
}
.cb-choice[aria-pressed="true"] .cname { color: var(--accent); }
.cb-choice[aria-pressed="true"] .cdesc { color: var(--text-muted); }
.cb-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cb-field input[type="text"], .cb-field input[type="number"] {
  width: 100%; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--mono); font-size: .9rem;
  padding: .48rem .6rem; transition: border-color .12s ease;
}
.cb-field input:hover { border-color: var(--border-firm); }
.cb-field input[data-state="bad"] { border-color: var(--bad); background: var(--bad-soft); }
.cb-field input[data-state="unset"] { border-style: dashed; }
.cb-field input::placeholder { color: var(--text-faint); }
.cb-field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cb-hint { font-size: .76rem; color: var(--text-faint); margin-top: .3rem; line-height: 1.45; }
.cb-hint.bad { color: var(--bad); }
.cb-hint.pinned {
  border: 1px solid var(--border); background: var(--bg-sunken);
  border-radius: 6px; padding: .45rem .6rem; margin-top: 0;
}
.cb-hint code { color: inherit; }
.cb-hint .lim { color: var(--accent); }

.cb-adv { margin-top: 1.1rem; border-top: 1px solid var(--border); padding-top: .85rem; }
.cb-adv > summary {
  cursor: pointer; font-size: .82rem; color: var(--accent); list-style: none;
  display: flex; align-items: center; gap: .4rem; width: fit-content;
}
.cb-adv > summary::-webkit-details-marker { display: none; }
.cb-adv > summary::before {
  content: "\25B8"; font-size: .72rem; transition: transform .12s ease; display: inline-block;
}
.cb-adv[open] > summary::before { transform: rotate(90deg); }
.cb-adv > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cb-adv .sum-note { color: var(--text-faint); font-size: .78rem; }
.cb-adv-body { margin-top: .9rem; display: flex; flex-direction: column; gap: 1rem; }

.cb-weights { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.2rem, 1fr)); gap: .6rem; }
.cb-weights .cb-label { font-size: .76rem; margin-bottom: .3rem; }

.cb-panel {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.cb-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem .9rem; border-bottom: 1px solid var(--border); background: var(--bg-sunken);
}
.cb-panel-head h2 {
  font-size: .8rem; margin: 0; padding: 0; border: 0; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}
.cb-stamp {
  font-family: var(--mono); font-size: .74rem; padding: .12rem .45rem;
  border-radius: 4px; border: 1px solid;
}
.cb-stamp.ok    { color: var(--good); background: var(--good-soft); border-color: var(--good-line); }
.cb-stamp.notok { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }

pre.cb-toml {
  margin: 0; padding: .9rem; background: var(--bg-code); font-family: var(--mono);
  font-size: .8rem; line-height: 1.55; overflow-x: auto; max-height: 26rem;
  overflow-y: auto; white-space: pre; border: 0; border-radius: 0;
}
.tok-tbl { color: var(--plan); }

.cb-gate {
  padding: .9rem; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: .75rem;
}
.cb-todo { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.cb-todo li {
  font-size: .82rem; color: var(--text-muted); display: flex; gap: .5rem;
  align-items: flex-start; line-height: 1.45;
}
.cb-todo li::before {
  content: ""; width: .5rem; height: .5rem; border-radius: 50%;
  flex: 0 0 auto; margin-top: .45rem; background: var(--warn);
}
.cb-todo li.err::before { background: var(--bad); }
.cb-todo li.done { color: var(--good); }
.cb-todo li.done::before { background: var(--good); }
.cb-todo li .where { font-family: var(--mono); color: var(--text-faint); }

.cb-actions { display: flex; flex-direction: column; gap: .5rem; }
.cb-btn-row { display: flex; gap: .5rem; }
.cb-btn-row .cb-btn { flex: 1; }
.cb-btn {
  appearance: none; font: inherit; font-size: .9rem; font-weight: 560;
  border-radius: 7px; padding: .6rem .9rem; cursor: pointer;
  border: 1px solid var(--border-firm); background: var(--bg-sunken); color: var(--text);
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.cb-btn:hover:not(:disabled) { border-color: var(--accent); }
.cb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cb-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cb-btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.cb-btn:disabled { opacity: .45; cursor: not-allowed; }
.cb-save-note { font-size: .76rem; color: var(--text-faint); margin: 0; min-height: 1.1em; }
.cb-save-note.bad { color: var(--bad); }
.cb-save-note.ok  { color: var(--good); }
