@layer reset, tokens, base, layout, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, h4, p, ul, ol, dl, dd, figure, pre, table { margin: 0; }
  ul[class], ol[class] { padding: 0; list-style: none; }
  img, svg { display: block; max-width: 100%; }
  img { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  table { border-collapse: collapse; }
}

@layer tokens {
  @font-face { font-family: "JetBrains Mono"; src: url("../fonts/mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
  @font-face { font-family: "JetBrains Mono"; src: url("../fonts/mono-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
  @font-face { font-family: "Outfit"; src: url("../fonts/sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
  @font-face { font-family: "Outfit"; src: url("../fonts/sans-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

  :root {
    --ag-bg: #0d1417;
    --ag-panel: #142026;
    --ag-panel-deep: #10191e;
    --ag-line: #22343c;
    --ag-line-strong: #34505b;
    --ag-cyan: #2bd4c5;
    --ag-amber: #f5a524;
    --ag-text: #e6eef0;
    --ag-muted: #9fb3b9;
    --ag-add: #7ee2a8;
    --ag-del: #ff8f86;
    --ag-pink: #ff9ec7;
    --ag-ink: #0d1417;
    --ag-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --ag-sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
    --ag-radius: 6px;
    --ag-wrap: 1180px;
    --ag-gutter: clamp(16px, 4vw, 40px);
    --ag-status-h: auto;
    color-scheme: dark;
  }
}

@layer base {
  html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
  body {
    background: var(--ag-bg);
    color: var(--ag-text);
    font-family: var(--ag-sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    overflow-x: hidden;
  }
  html.ag-has-drawer body { padding-bottom: 220px; }
  h1, h2, h3, h4 { font-family: var(--ag-mono); line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
  h1 { font-size: clamp(1.6rem, 1.15rem + 1.9vw, 2.35rem); }
  h3 { font-size: 1.1rem; }
  p + p { margin-top: 0.9em; }
  a { color: var(--ag-cyan); text-underline-offset: 3px; text-decoration-thickness: 1px; }
  a:hover { color: var(--ag-text); text-decoration-thickness: 2px; }
  :focus-visible { outline: 2px solid var(--ag-amber); outline-offset: 3px; border-radius: 3px; }
  code, kbd, pre { font-family: var(--ag-mono); font-size: 0.92em; }
  :not(pre) > code { background: var(--ag-panel); border: 1px solid var(--ag-line); border-radius: 4px; padding: 0.05em 0.35em; color: var(--ag-cyan); }
  strong { font-weight: 600; color: #fff; }
  ::selection { background: var(--ag-cyan); color: var(--ag-ink); }
}

@layer layout {
  .ag-split, .ag-doc, .ag-editor, .ag-diff, .ag-warns, .ag-media-row { grid-template-columns: minmax(0, 1fr); }
  .ag-wrap { width: min(100% - 2 * var(--ag-gutter), var(--ag-wrap)); margin-inline: auto; }
  .ag-section { padding-block: clamp(3rem, 6vw, 5rem); border-top: 1px solid var(--ag-line); }
  .ag-split { display: grid; gap: 2rem; }
  @media (min-width: 900px) {
    .ag-split { grid-template-columns: 1.15fr 0.85fr; align-items: start; gap: 3rem; }
  }
  .ag-doc { display: grid; gap: 2rem; padding-block: 2.5rem 4rem; }
  @media (min-width: 960px) {
    .ag-doc { grid-template-columns: 230px minmax(0, 1fr); gap: 3rem; }
    .ag-doc__outline { position: sticky; top: 1rem; align-self: start; }
  }
}

@layer components {
  /* skip link */
  .ag-skip { position: absolute; left: 1rem; top: -100px; z-index: 100; background: var(--ag-amber); color: var(--ag-ink); padding: 0.5rem 1rem; font-family: var(--ag-mono); font-weight: 700; border-radius: var(--ag-radius); }
  .ag-skip:focus { top: 0.75rem; }
  .ag-skip:hover { color: var(--ag-ink); }

  .ag-ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: miter; stroke-linecap: square; }

  /* ---------- editor shell (header) ---------- */
  .ag-shell { background: var(--ag-panel-deep); border-bottom: 1px solid var(--ag-line); }
  .ag-shell__bar { display: flex; align-items: center; gap: 0.9rem; min-height: 52px; padding-inline: var(--ag-gutter); font-family: var(--ag-mono); font-size: 0.85rem; }
  .ag-shell__dots { display: flex; gap: 6px; }
  .ag-shell__dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--ag-line-strong); }
  .ag-shell__dots i:first-child { background: var(--ag-amber); }
  .ag-shell__dots i:nth-child(2) { background: var(--ag-cyan); }
  .ag-shell__path { color: var(--ag-muted); display: none; }
  @media (min-width: 760px) { .ag-shell__path { display: inline; } }
  .ag-brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ag-text); text-decoration: none; font-weight: 700; font-size: 1rem; padding: 0.25rem 0.35rem; border-radius: 4px; }
  .ag-brand:hover { color: var(--ag-cyan); }
  .ag-brand__mark { width: 26px; height: 26px; }
  .ag-kbd { margin-left: auto; display: inline-flex; align-items: center; gap: 0.5rem; background: var(--ag-panel); border: 1px solid var(--ag-line-strong); color: var(--ag-text); border-radius: var(--ag-radius); padding: 0.35rem 0.65rem; font-family: var(--ag-mono); font-size: 0.8rem; line-height: 1.2; }
  .ag-kbd kbd { color: var(--ag-muted); font-size: 0.75rem; white-space: nowrap; }
  .ag-kbd:hover { border-color: var(--ag-cyan); background: #18303a; color: #fff; }
  .ag-kbd:hover kbd { color: var(--ag-cyan); }
  .ag-kbd__label { display: none; }
  @media (min-width: 560px) { .ag-kbd__label { display: inline; } }

  .ag-shell__tabs { border-top: 1px solid var(--ag-line); overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--ag-line-strong) transparent; }
  .ag-tabs { display: flex; padding-inline: var(--ag-gutter); width: max-content; min-width: 100%; }
  .ag-tab { display: flex; align-items: center; gap: 0.45rem; padding: 0.7rem 1.05rem 0.65rem; font-family: var(--ag-mono); font-size: 0.85rem; color: var(--ag-muted); text-decoration: none; white-space: nowrap; border-right: 1px solid var(--ag-line); border-top: 2px solid transparent; }
  .ag-tabs li:first-child .ag-tab { border-left: 1px solid var(--ag-line); }
  .ag-tab:hover { color: var(--ag-text); background: var(--ag-panel); text-decoration: none; }
  .ag-tab[aria-current="page"] { color: var(--ag-text); background: var(--ag-bg); border-top-color: var(--ag-cyan); }
  .ag-tab[aria-current="page"] .ag-ico { color: var(--ag-cyan); }
  .ag-tab:focus-visible { outline-offset: -3px; }

  /* ---------- command palette ---------- */
  .ag-palette { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding: 12vh 16px 16px; background: rgb(5 9 11 / 0.72); }
  .ag-palette[hidden] { display: none; }
  .ag-palette__box { width: min(100%, 600px); background: var(--ag-panel); border: 1px solid var(--ag-line-strong); border-radius: 8px; box-shadow: 0 24px 60px rgb(0 0 0 / 0.55); overflow: hidden; }
  .ag-palette__field { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.9rem; border-bottom: 1px solid var(--ag-line); color: var(--ag-cyan); }
  .ag-palette__input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 0.7rem 0; font-family: var(--ag-mono); font-size: 0.95rem; color: var(--ag-text); }
  .ag-palette__input:focus { outline: none; }
  .ag-palette__field:focus-within { box-shadow: inset 0 -2px 0 var(--ag-cyan); }
  .ag-palette__input::placeholder { color: var(--ag-muted); opacity: 1; }
  .ag-palette__list { max-height: min(55vh, 420px); overflow-y: auto; padding: 0.35rem; }
  .ag-palette__item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0.75rem; border-radius: 4px; color: var(--ag-text); text-decoration: none; font-size: 0.95rem; }
  .ag-palette__item small { font-family: var(--ag-mono); color: var(--ag-muted); font-size: 0.75rem; white-space: nowrap; }
  .ag-palette__item:hover { background: #1b2d35; color: #fff; text-decoration: none; }
  .ag-palette__item[aria-selected="true"] { background: var(--ag-cyan); color: var(--ag-ink); }
  .ag-palette__item[aria-selected="true"] small { color: var(--ag-ink); }
  .ag-palette__item[hidden] { display: none; }
  .ag-palette__empty, .ag-palette__hint { padding: 0.6rem 0.9rem; font-family: var(--ag-mono); font-size: 0.78rem; color: var(--ag-muted); }
  .ag-palette__hint { border-top: 1px solid var(--ag-line); }

  /* ---------- buttons ---------- */
  .ag-btn { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--ag-mono); font-weight: 700; font-size: 0.95rem; text-decoration: none; padding: 0.8rem 1.3rem; border-radius: var(--ag-radius); border: 1px solid var(--ag-cyan); background: var(--ag-cyan); color: var(--ag-ink); line-height: 1.2; }
  .ag-btn:hover { background: var(--ag-amber); border-color: var(--ag-amber); color: var(--ag-ink); text-decoration: none; }
  .ag-btn--ghost { background: transparent; color: var(--ag-cyan); border-color: var(--ag-line-strong); }
  .ag-btn--ghost:hover { background: var(--ag-panel); border-color: var(--ag-cyan); color: #fff; }

  /* ---------- hero editor ---------- */
  .ag-hero { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 5vw, 4rem); }
  .ag-editor { display: grid; border: 1px solid var(--ag-line); border-radius: 8px; overflow: hidden; background: var(--ag-panel); }
  @media (min-width: 960px) {
    .ag-editor { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
    .ag-editor .ag-pane--code { grid-column: 1; grid-row: 1; border-right: 1px solid var(--ag-line); border-top: 0; }
    .ag-editor .ag-pane--intro { grid-column: 2; grid-row: 1; }
  }
  .ag-pane { min-width: 0; }
  .ag-pane--code { border-top: 1px solid var(--ag-line); background: var(--ag-panel-deep); display: flex; flex-direction: column; }
  .ag-pane__head { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem 0.5rem 1rem; border-bottom: 1px solid var(--ag-line); font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-muted); }
  .ag-pane__head .ag-ico { color: var(--ag-amber); }
  .ag-copy { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; background: transparent; border: 1px solid var(--ag-line-strong); color: var(--ag-text); border-radius: 4px; padding: 0.3rem 0.65rem; font-family: var(--ag-mono); font-size: 0.78rem; }
  .ag-copy:hover { border-color: var(--ag-cyan); color: var(--ag-cyan); background: var(--ag-panel); }
  .ag-copy[data-state="done"] { border-color: var(--ag-add); color: var(--ag-add); }
  .ag-code { overflow-x: auto; padding: 1rem 0; font-size: 0.8rem; line-height: 1.7; counter-reset: ag-line; flex: 1; }
  .ag-code code { display: block; min-width: max-content; color: var(--ag-text); }
  .ag-code__ln { display: block; padding-right: 1.25rem; white-space: pre; }
  .ag-code__ln::before { counter-increment: ag-line; content: counter(ag-line); display: inline-block; width: 3.2em; padding-right: 1.1em; text-align: right; color: #6f878e; user-select: none; }
  .tk-k { color: var(--ag-pink); }
  .tk-s { color: var(--ag-add); }
  .tk-c { color: var(--ag-muted); font-style: italic; }
  .tk-n { color: var(--ag-amber); }
  .tk-f { color: var(--ag-cyan); }
  .ag-pane--intro { padding: clamp(1.5rem, 4vw, 2.75rem); display: flex; flex-direction: column; justify-content: center; gap: 1.1rem; }
  .ag-pane__lead { font-size: 1.12rem; color: var(--ag-text); }
  .ag-pane__meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-muted); }
  .ag-pane__meta span { display: inline-flex; align-items: center; gap: 0.4rem; }
  .ag-pane__meta .ag-ico { color: var(--ag-cyan); }
  .ag-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

  .ag-frame { margin-top: 1.75rem; border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel); padding: 0.6rem; max-width: 880px; }
  .ag-frame img { width: 100%; border-radius: 4px; }
  .ag-frame figcaption { font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-muted); padding: 0.65rem 0.35rem 0.2rem; }
  .ag-frame--side { margin-top: 0; }

  /* ---------- section heading as command line ---------- */
  .ag-cmd { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
  .ag-cmd__line { font-size: 0.85rem; font-weight: 400; color: var(--ag-muted); }
  .ag-cmd__line b { color: var(--ag-cyan); font-weight: 700; margin-right: 0.5ch; }
  .ag-cmd__title { font-size: clamp(1.4rem, 1.1rem + 1.3vw, 2rem); }
  .ag-intro { max-width: 70ch; color: var(--ag-text); }
  .ag-intro + * { margin-top: 2rem; }
  .ag-note { font-size: 0.92rem; color: var(--ag-muted); }

  /* ---------- tree view ---------- */
  .ag-tree { font-family: var(--ag-mono); font-size: 0.9rem; border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel-deep); padding: 0.6rem; }
  .ag-tree__node { list-style: none; }
  .ag-tree__node:focus { outline: none; }
  .ag-tree__row { display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.45rem 0.6rem; border-radius: 4px; color: var(--ag-text); }
  .ag-tree__node--dir > .ag-tree__row { cursor: pointer; font-weight: 700; }
  .ag-tree__node--dir > .ag-tree__row:hover { background: var(--ag-panel); }
  .ag-tree__node:focus-visible > .ag-tree__row { outline: 2px solid var(--ag-amber); outline-offset: -2px; background: var(--ag-panel); }
  .ag-tree__chev { width: 1em; height: 1em; margin-top: 0.25em; transition: transform 0.15s; color: var(--ag-muted); }
  .ag-tree__node[aria-expanded="true"] > .ag-tree__row .ag-tree__chev { transform: rotate(90deg); }
  .ag-tree__row .ag-ico { margin-top: 0.2em; }
  .ag-tree__node--dir > .ag-tree__row .ag-ico:not(.ag-tree__chev) { color: var(--ag-amber); }
  .ag-tree__node--file .ag-ico { color: var(--ag-cyan); }
  .ag-tree__label { display: flex; flex-direction: column; gap: 0.1rem; }
  .ag-tree__label small { font-family: var(--ag-sans); font-weight: 400; font-size: 0.92rem; color: var(--ag-muted); }
  .ag-tree__group { padding-left: 1.6rem; margin-left: 1.1rem; border-left: 1px dashed var(--ag-line-strong); }
  .ag-js .ag-tree__node[aria-expanded="false"] > .ag-tree__group { display: none; }
  .ag-tree__node--file .ag-tree__row { font-weight: 400; }

  /* ---------- diff view ---------- */
  .ag-diff { display: grid; gap: 1rem; }
  @media (min-width: 860px) { .ag-diff { grid-template-columns: 1fr 1fr; } }
  .ag-diff__col { border: 1px solid var(--ag-line); border-radius: 8px; overflow: hidden; background: var(--ag-panel-deep); }
  .ag-diff__head { font-family: var(--ag-mono); font-size: 0.8rem; padding: 0.55rem 1rem; color: var(--ag-muted); background: var(--ag-panel); border-bottom: 1px solid var(--ag-line); }
  .ag-diff__head b { color: var(--ag-text); }
  .ag-diff__list li { display: grid; grid-template-columns: 2.2rem 1fr; padding: 0.55rem 1rem 0.55rem 0; border-bottom: 1px solid rgb(34 52 60 / 0.6); font-size: 0.98rem; }
  .ag-diff__list li:last-child { border-bottom: 0; }
  .ag-diff__list li::before { font-family: var(--ag-mono); font-weight: 700; text-align: center; }
  .ag-diff__list--add li { background: rgb(126 226 168 / 0.07); }
  .ag-diff__list--add li::before { content: "+"; color: var(--ag-add); }
  .ag-diff__list--del li { background: rgb(255 143 134 / 0.07); }
  .ag-diff__list--del li::before { content: "\2212"; color: var(--ag-del); }

  /* ---------- backtest chart + warnings ---------- */
  .ag-chart { border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel-deep); padding: 1rem; }
  .ag-chart svg { width: 100%; max-width: 860px; height: auto; margin-inline: auto; }
  .ag-chart figcaption { font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-muted); margin-top: 0.6rem; }
  .ag-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-text); margin-bottom: 0.5rem; }
  .ag-legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
  .ag-legend i { width: 22px; height: 0; border-top: 3px solid var(--ag-cyan); }
  .ag-legend i.is-oos { border-top: 3px dashed var(--ag-amber); }
  .ag-warns { display: grid; gap: 1rem; margin-top: 2rem; }
  @media (min-width: 760px) { .ag-warns { grid-template-columns: 1fr 1fr; } }
  .ag-warn { border: 1px solid var(--ag-line); border-left: 3px solid var(--ag-amber); border-radius: 4px 8px 8px 4px; background: var(--ag-panel); padding: 1rem 1.2rem; }
  .ag-warn h3 { font-size: 0.98rem; display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
  .ag-warn h3 span { color: var(--ag-amber); font-size: 0.8rem; }
  .ag-warn p { margin-top: 0.5rem; font-size: 0.98rem; }

  .ag-media-row { display: grid; gap: 1.5rem; margin-top: 2rem; align-items: center; }
  @media (min-width: 860px) { .ag-media-row { grid-template-columns: 0.9fr 1.1fr; } }

  /* ---------- worked example ---------- */
  .ag-table-wrap { overflow-x: auto; border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel-deep); }
  .ag-table { width: 100%; min-width: 560px; font-family: var(--ag-mono); font-size: 0.85rem; }
  .ag-table caption { text-align: left; padding: 0.7rem 1rem; color: var(--ag-muted); border-bottom: 1px solid var(--ag-line); font-size: 0.8rem; }
  .ag-table th, .ag-table td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--ag-line); text-align: right; white-space: nowrap; }
  .ag-table th:first-child, .ag-table td:first-child { text-align: left; }
  .ag-table thead th { color: var(--ag-cyan); font-weight: 700; background: var(--ag-panel); }
  .ag-table tbody tr:last-child td, .ag-table tbody tr:last-child th { border-bottom: 0; }
  .ag-table .is-neg { color: var(--ag-del); }
  .ag-table .is-pos { color: var(--ag-add); }
  .ag-steps { counter-reset: ag-step; display: grid; gap: 0.9rem; margin-top: 1.75rem; }
  .ag-steps li { counter-increment: ag-step; display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.5rem; }
  .ag-steps li::before { content: "[" counter(ag-step) "]"; font-family: var(--ag-mono); color: var(--ag-amber); font-weight: 700; }
  .ag-formula { display: block; margin-top: 0.35rem; font-family: var(--ag-mono); font-size: 0.85rem; background: var(--ag-panel); border: 1px solid var(--ag-line); border-radius: 4px; padding: 0.5rem 0.75rem; overflow-x: auto; white-space: nowrap; color: var(--ag-text); }

  /* ---------- terminal todo ---------- */
  .ag-term { border: 1px solid var(--ag-line); border-radius: 8px; background: #091013; font-family: var(--ag-mono); font-size: 0.88rem; overflow: hidden; }
  .ag-term__top { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 1rem; background: var(--ag-panel); border-bottom: 1px solid var(--ag-line); color: var(--ag-muted); font-size: 0.78rem; }
  .ag-term__body { padding: 1rem 1.1rem 1.2rem; }
  .ag-term__prompt { color: var(--ag-muted); margin-bottom: 0.75rem; }
  .ag-term__prompt b { color: var(--ag-cyan); }
  .ag-todo li { display: grid; grid-template-columns: 3.2ch minmax(0, 1fr); gap: 0.9ch; padding: 0.35rem 0; }
  .ag-todo li::before { content: "[ ]"; color: var(--ag-amber); font-weight: 700; }
  .ag-todo li.is-done::before { content: "[x]"; color: var(--ag-add); }
  .ag-todo li span { font-family: var(--ag-sans); font-size: 1rem; color: var(--ag-text); }
  .ag-todo li em { font-style: normal; color: var(--ag-muted); }
  .ag-todo__legend { margin-top: 0.9rem; color: var(--ag-muted); font-size: 0.8rem; }

  /* ---------- man page FAQ ---------- */
  .ag-man { border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel-deep); padding: clamp(1rem, 3vw, 2rem); }
  .ag-man__header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-muted); border-bottom: 1px solid var(--ag-line); padding-bottom: 0.75rem; margin-bottom: 1.25rem; }
  .ag-man__sec + .ag-man__sec { margin-top: 1.6rem; }
  .ag-man__name { font-size: 0.95rem; color: var(--ag-amber); letter-spacing: 0.04em; }
  .ag-man__body { padding-left: clamp(0.75rem, 4vw, 3.5rem); margin-top: 0.35rem; }
  .ag-man__q { font-family: var(--ag-sans); font-size: 1.08rem; font-weight: 600; color: #fff; margin-bottom: 0.3rem; letter-spacing: 0; }

  /* ---------- config-file form ---------- */
  .ag-conf { border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel-deep); overflow: hidden; }
  .ag-conf__body { padding: clamp(1rem, 3vw, 1.75rem); display: grid; gap: 1.1rem; }
  .ag-conf__comment { font-family: var(--ag-mono); font-size: 0.82rem; color: var(--ag-muted); }
  .ag-conf__section { font-family: var(--ag-mono); color: var(--ag-amber); font-weight: 700; font-size: 0.9rem; }
  .ag-field { display: grid; gap: 0.35rem; }
  @media (min-width: 640px) { .ag-field { grid-template-columns: 11rem 1fr; align-items: center; column-gap: 1rem; } .ag-field .ag-hint { grid-column: 2; } }
  .ag-field label { font-family: var(--ag-mono); font-size: 0.9rem; color: var(--ag-cyan); }
  .ag-field label span { color: var(--ag-muted); }
  .ag-input { width: 100%; background: var(--ag-bg); border: 1px solid var(--ag-line-strong); border-radius: 4px; padding: 0.65rem 0.8rem; font-family: var(--ag-mono); font-size: 0.92rem; color: var(--ag-text); }
  .ag-input:hover { border-color: #4a6a76; }
  .ag-input:focus { outline: none; border-color: var(--ag-cyan); box-shadow: 0 0 0 3px rgb(43 212 197 / 0.25); }
  textarea.ag-input { min-height: 8rem; resize: vertical; line-height: 1.5; }
  .ag-field--top { align-items: start; }
  .ag-field--top label { padding-top: 0.6rem; }
  .ag-hint { font-family: var(--ag-mono); font-size: 0.78rem; color: var(--ag-muted); }
  .ag-check { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start; font-size: 0.96rem; }
  .ag-check input { width: 1.15rem; height: 1.15rem; margin-top: 0.25rem; accent-color: var(--ag-cyan); }
  .ag-conf__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding-top: 0.5rem; }
  .ag-btn[type="submit"] { cursor: pointer; }
  .ag-info { margin-top: 1.5rem; border: 1px solid var(--ag-line); border-radius: 8px; overflow: hidden; }
  .ag-info table { width: 100%; font-size: 0.92rem; }
  .ag-info caption { text-align: left; font-family: var(--ag-mono); font-weight: 700; font-size: 0.85rem; padding: 0.7rem 1rem; background: var(--ag-panel); border-bottom: 1px solid var(--ag-line); }
  .ag-info th, .ag-info td { padding: 0.55rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--ag-line); }
  .ag-info tr:last-child th, .ag-info tr:last-child td { border-bottom: 0; }
  .ag-info th { font-family: var(--ag-mono); font-weight: 400; color: var(--ag-cyan); width: 9.5rem; font-size: 0.82rem; }
  @media (max-width: 520px) { .ag-info th, .ag-info td { display: block; width: auto; } .ag-info th { border-bottom: 0; padding-bottom: 0; } }

  .ag-gets { display: grid; gap: 0.75rem; }
  .ag-gets li { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start; }
  .ag-gets .ag-ico { color: var(--ag-cyan); margin-top: 0.3em; }

  /* ---------- footer: panel + status bar ---------- */
  .ag-foot { margin-top: 2rem; border-top: 1px solid var(--ag-line); background: var(--ag-panel-deep); }
  .ag-foot__panel { padding-block: 1.5rem; display: grid; gap: 1rem; }
  @media (min-width: 900px) { .ag-foot__panel { grid-template-columns: 1fr auto; align-items: center; } }
  .ag-risk { border: 1px solid var(--ag-amber); border-radius: 6px; padding: 0.9rem 1.1rem; font-size: 0.92rem; background: rgb(245 165 36 / 0.06); }
  .ag-risk strong { font-family: var(--ag-mono); color: var(--ag-amber); margin-right: 0.4rem; }
  .ag-risk a { color: var(--ag-amber); }
  .ag-risk a:hover { color: #fff; }
  .ag-foot__addr { font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-muted); display: flex; flex-direction: column; gap: 0.2rem; }
  .ag-status { background: #0a3d3a; border-top: 1px solid #1c6a63; font-family: var(--ag-mono); font-size: 0.78rem; color: #e9fbf9; }
  .ag-status__list { display: flex; flex-wrap: wrap; align-items: stretch; padding-inline: calc(var(--ag-gutter) - 0.6rem); }
  .ag-status__list li { display: flex; }
  .ag-status__item { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.6rem; color: #e9fbf9; text-decoration: none; background: none; border: 0; font: inherit; line-height: 1.4; }
  a.ag-status__item:hover, button.ag-status__item:hover { background: var(--ag-cyan); color: var(--ag-ink); text-decoration: none; }
  .ag-status__item:focus-visible { outline-offset: -2px; }
  .ag-status__item[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; }
  .ag-status__push { margin-left: auto; }
  .ag-status .ag-ico { width: 1em; height: 1em; }

  /* ---------- cookie drawer ---------- */
  .ag-drawer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: #091013; border-top: 1px solid var(--ag-line-strong); box-shadow: 0 -12px 40px rgb(0 0 0 / 0.45); font-family: var(--ag-mono); font-size: 0.85rem; max-height: 85vh; overflow-y: auto; }
  .ag-drawer[hidden] { display: none; }
  .ag-drawer__tabs { display: flex; gap: 1.5rem; padding: 0.35rem var(--ag-gutter); border-bottom: 1px solid var(--ag-line); font-size: 0.72rem; color: var(--ag-muted); letter-spacing: 0.06em; }
  .ag-drawer__tabs span:first-child { color: var(--ag-text); box-shadow: inset 0 -1px 0 var(--ag-cyan); }
  .ag-drawer__body { padding: 0.9rem var(--ag-gutter) 1.1rem; display: grid; gap: 0.7rem; min-height: 140px; align-content: start; }
  .ag-drawer__prompt { color: var(--ag-muted); }
  .ag-drawer__prompt b { color: var(--ag-cyan); }
  .ag-drawer__text { font-family: var(--ag-sans); font-size: 0.98rem; color: var(--ag-text); max-width: 95ch; }
  .ag-drawer__btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; max-width: 640px; }
  .ag-bracket { background: transparent; border: 1px solid var(--ag-cyan); color: var(--ag-cyan); border-radius: 4px; padding: 0.55rem 0.4rem; font-family: var(--ag-mono); font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
  .ag-bracket:hover { background: var(--ag-cyan); color: var(--ag-ink); }
  .ag-bracket span { color: inherit; opacity: 0.8; }
  @media (max-width: 480px) { .ag-bracket { font-size: 0.74rem; padding-inline: 0.15rem; } .ag-drawer__btns { gap: 0.4rem; } }
  @media (max-width: 959px) { .ag-doc__outline--after { order: 2; } }
  .ag-drawer__prefs { display: grid; gap: 0.45rem; border-left: 2px solid var(--ag-line-strong); padding-left: 0.9rem; }
  .ag-drawer__prefs[hidden] { display: none; }
  .ag-drawer__prefs label { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
  .ag-drawer__prefs input { width: 1.05rem; height: 1.05rem; accent-color: var(--ag-cyan); }
  .ag-drawer__prefs em { font-style: normal; color: var(--ag-muted); }
  .ag-drawer__save { justify-self: start; }

  /* ---------- docs / legal ---------- */
  .ag-outline { border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel-deep); font-family: var(--ag-mono); font-size: 0.8rem; }
  .ag-outline p { padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--ag-line); color: var(--ag-muted); letter-spacing: 0.06em; }
  .ag-outline ol { padding: 0.4rem; }
  .ag-outline a { display: block; padding: 0.35rem 0.55rem; color: var(--ag-text); text-decoration: none; border-radius: 4px; }
  .ag-outline a:hover { background: var(--ag-panel); color: var(--ag-cyan); }
  .ag-prose { max-width: 74ch; }
  .ag-prose h1 { margin-bottom: 0.75rem; }
  .ag-prose h2 { font-size: 1.2rem; margin-top: 2.4rem; margin-bottom: 0.7rem; padding-top: 0.25rem; }
  .ag-prose h2::before { content: "## "; color: var(--ag-cyan); }
  .ag-prose h3 { margin-top: 1.4rem; margin-bottom: 0.4rem; font-size: 1rem; }
  .ag-prose ul, .ag-prose ol { padding-left: 1.3rem; margin-top: 0.6rem; }
  .ag-prose li + li { margin-top: 0.35rem; }
  .ag-prose ul > li::marker { color: var(--ag-cyan); }
  .ag-prose p, .ag-prose ul, .ag-prose ol, .ag-prose .ag-info, .ag-prose .ag-table-wrap { margin-top: 0.8rem; }
  .ag-meta { font-family: var(--ag-mono); font-size: 0.8rem; color: var(--ag-muted); }
  .ag-callout { border: 1px solid var(--ag-line); border-left: 3px solid var(--ag-cyan); background: var(--ag-panel); border-radius: 4px 8px 8px 4px; padding: 1rem 1.2rem; margin-top: 1.25rem; }
  .ag-callout--amber { border-left-color: var(--ag-amber); }
  .ag-dl { display: grid; gap: 0.5rem; margin-top: 1rem; }
  .ag-dl div { display: grid; gap: 0.1rem; }
  @media (min-width: 640px) { .ag-dl div { grid-template-columns: 10rem 1fr; gap: 1rem; } }
  .ag-dl dt { font-family: var(--ag-mono); font-size: 0.85rem; color: var(--ag-cyan); }
  .ag-dl dd { overflow-wrap: anywhere; }

  .ag-roles { display: grid; gap: 1rem; margin-top: 1rem; }
  @media (min-width: 720px) { .ag-roles { grid-template-columns: 1fr 1fr; } }
  .ag-role { border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel); padding: 1rem 1.2rem; }
  .ag-role h3 { font-size: 0.95rem; color: var(--ag-cyan); margin: 0 0 0.35rem; }
  .ag-role p { font-size: 0.98rem; margin: 0; }

  .ag-contact-card { border: 1px solid var(--ag-line); border-radius: 8px; background: var(--ag-panel-deep); padding: 1.2rem; display: grid; gap: 0.9rem; }
  .ag-contact-card li { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start; }
  .ag-contact-card .ag-ico { color: var(--ag-cyan); margin-top: 0.3em; }
  .ag-contact-card b { display: block; font-family: var(--ag-mono); font-size: 0.78rem; color: var(--ag-muted); font-weight: 400; }

  .ag-errorbox { font-family: var(--ag-mono); border: 1px solid var(--ag-line); border-radius: 8px; background: #091013; padding: 1.25rem; font-size: 0.9rem; overflow-x: auto; }
  .ag-errorbox p + p { margin-top: 0.3rem; }
  .ag-errorbox .is-err { color: var(--ag-del); }
  .ag-errorbox .is-ok { color: var(--ag-add); }
  .ag-errorbox .is-dim { color: var(--ag-muted); }
}

@layer utilities {
  .ag-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .ag-mt { margin-top: 1.5rem; }
  .ag-mono { font-family: var(--ag-mono); }
  .ag-amber { color: var(--ag-amber); }
  .ag-muted { color: var(--ag-muted); }
  .ag-nowrap { white-space: nowrap; }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
  }
}

@layer components {
  .ag-table--text { font-family: var(--ag-sans); font-size: 0.92rem; }
  .ag-table--text th, .ag-table--text td { white-space: normal; text-align: left; vertical-align: top; }
  .ag-table--text thead th { font-family: var(--ag-mono); font-size: 0.82rem; }
}

