/* App pages: sell, dataset, agents, takedown, ops. Tokens and base components come from style.css.
   Concept: every page is a sheet of vellum in a ledger. Page heads sit on ruled ledger lines with one gold row
   inked in; facts and quotes read as ledger strips (hairline-ruled cells on one surface, not a grid of cards);
   forms are numbered entries. Gold is kept for the single thing that matters on each screen. */

.page { padding-top: clamp(28px, 7vw, 72px); min-height: 70vh; }
.page > section, .page > div > section { margin-top: clamp(40px, 7vw, 72px); }
.page > section:first-child { margin-top: 0; }
.page h2 { margin-top: 0; font-size: clamp(1.45rem, 4vw, 2rem); }
.lead { font-size: clamp(1.05rem, 2.6vw, 1.2rem); line-height: 1.55; color: var(--ink-2); max-width: 42rem; margin-bottom: 0; }
.bad-text { color: var(--bad); }
:not(pre) > code { overflow-wrap: anywhere; color: #e4dccb; }
pre code { background: none; border: 0; padding: 0; overflow-wrap: normal; font-size: inherit; }

/* ---------- page head: ruled ledger lines, one gold row inked in ---------- */
.pagehead { position: relative; padding-bottom: 64px; }
.pagehead h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); overflow-wrap: anywhere; margin-bottom: .35em; }
.pagehead .chips:not(:empty) { margin-top: 14px; }
.pagehead::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46px; pointer-events: none;
  background: repeating-linear-gradient(180deg, transparent 0 14px, rgba(226, 216, 196, .1) 14px 15px);
  -webkit-mask-image: linear-gradient(90deg, #000, rgba(0, 0, 0, .55) 55%, transparent);
  mask-image: linear-gradient(90deg, #000, rgba(0, 0, 0, .55) 55%, transparent);
}
.pagehead::after {
  content: ""; position: absolute; left: 0; bottom: 16px; height: 14px; width: min(52%, 320px); pointer-events: none;
  background: linear-gradient(90deg, rgba(200, 112, 62, .3), rgba(200, 112, 62, .08) 65%, transparent);
  box-shadow: inset 2px 0 0 var(--gold);
  transform-origin: left center;
  animation: ink 1.2s var(--ease-out) .35s both;
}
@keyframes ink { from { transform: scaleX(0); opacity: 0; } }
/* page head contents arrive one line after another */
.js .pagehead.reveal { opacity: 1; transform: none; }
.js .pagehead.reveal > * { opacity: 0; transform: translate3d(0, 14px, 0); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.js .pagehead.reveal > :nth-child(2) { transition-delay: 70ms; }
.js .pagehead.reveal > :nth-child(3) { transition-delay: 140ms; }
.js .pagehead.reveal > :nth-child(n+4) { transition-delay: 210ms; }
.js .pagehead.reveal.in > * { opacity: 1; transform: none; }
.js .reveal.d1 { --d: 90ms; }
.js .reveal.d2 { --d: 180ms; }

/* section heads: a title with a ruled line running out to the margin */
.page section:not(.card) > h2 { display: flex; align-items: baseline; gap: 16px; }
.page section:not(.card) > h2::after { content: ""; flex: 1 1 24px; min-width: 24px; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); transform: translateY(-.3em); }
.page section > h2 + p.muted { margin-top: -4px; }

/* ---------- shared bits ---------- */
.nav a.btn, .nav a.btn:hover, .nav a.btn[aria-current] { color: #0e1830; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.actions .hint { margin: 0; flex: 1 1 200px; }
.form .field:last-child { margin-bottom: 0; }
label { letter-spacing: .005em; }
.hint { line-height: 1.5; }

/* a sheet: the main working surface on a page */
.sheet, .page .card.form {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 120px),
    var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 40px 80px -40px rgba(0, 0, 0, .85), 0 2px 6px rgba(0, 0, 0, .25);
}

/* numbered ledger entries in forms */
#sell-form, #td-form { counter-reset: entry; padding: 0; }
#sell-form > .field, #td-form > .field { margin: 0; padding: 20px clamp(16px, 4vw, 28px); }
#sell-form > .field + .field, #td-form > .field + .field { border-top: 1px solid var(--line); }
#sell-form > .field > label:not(.check)::before, #td-form > .field > label:not(.check)::before {
  counter-increment: entry; content: counter(entry, decimal-leading-zero);
  display: inline-block; min-width: 2.2em; font: 500 .72rem/1 var(--mono); color: var(--gold); letter-spacing: .04em; vertical-align: 1px;
}
#sell-form > .field > .hint, #td-form > .field > .hint { padding-left: 0; }
#sell-form > .note, #td-form > .note { margin: 0 clamp(16px, 4vw, 28px) 16px; }
#sell-form > .actions, #td-form > .actions {
  margin: 0; padding: 18px clamp(16px, 4vw, 28px) 22px; border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, .14); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
#sell-form .check, #td-form .check { padding: 2px 0; }
#sell-form .check span, #td-form .check span { line-height: 1.5; }

/* file field: a drop sheet */
input[type="file"] {
  width: 100%; min-height: 64px; padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--r);
  background: rgba(6, 11, 22, .5); cursor: pointer; transition: border-color .2s, background .2s;
}
input[type="file"]:hover { border-color: rgba(200, 112, 62, .55); background: rgba(200, 112, 62, .04); }
input[type="file"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input[type="file"]::file-selector-button { transition: background .15s, border-color .15s, color .15s; }
input[type="file"]::file-selector-button:hover { background: var(--raise); border-color: rgba(226, 216, 196, .3); }

/* account strip */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px;
  padding: 10px 10px 10px 16px; background: rgba(19, 30, 51, .7); border: 1px solid var(--line); border-radius: 999px;
  margin-bottom: 8px; font-size: .92rem; color: var(--ink-2);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.bar > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.bar > div::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); flex: none; }
.bar .chip { max-width: 100%; }
@media (max-width: 400px) { .bar { border-radius: var(--r-lg); padding: 12px 14px; } }

/* ledger strip: hairline-ruled cells on one surface */
.stats, .qgrid, .facts-grid {
  display: grid; gap: 1px; margin: 0 0 16px; padding: 0; overflow: hidden;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 48px -28px rgba(0, 0, 0, .8);
}
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat, .facts-grid > div { background: var(--surface); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat .k, .facts-grid dt { font: 500 .68rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.stat .v { font: 500 clamp(1.1rem, 3.6vw, 1.5rem)/1.15 var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; letter-spacing: -.01em; }
.stat .v small, .facts-grid dd small { font-size: .62em; color: var(--ink-3); font-weight: 400; letter-spacing: .04em; }
#totals:empty { display: none; }

/* steps: a numbered margin column with a thread between entries */
.steps { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 0; }
.steps > li { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; align-items: start; padding-bottom: 20px; }
.steps > li:last-child { padding-bottom: 0; }
.steps > li:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 34px; bottom: 6px; width: 1px; background: linear-gradient(180deg, var(--line-2), transparent); }
.steps > li > div { min-width: 0; padding-top: 3px; color: var(--ink-2); }
.steps > li > div > strong { color: var(--ink); }
.steps .n {
  width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center;
  font: 500 .8rem/1 var(--mono); color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(200, 112, 62, .28);
}
.steps pre { margin-top: 10px; }

/* status pills */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font: 500 .72rem/1.6 var(--mono); letter-spacing: .03em; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.status.live { background: var(--ok-soft); color: var(--ok); border-color: rgba(143, 195, 154, .25); }
.status.review { background: var(--warn-soft); color: var(--warn); border-color: rgba(231, 178, 92, .25); }
.status.off { background: var(--bad-soft); color: var(--bad); border-color: rgba(238, 143, 132, .22); }
.warnchip { background: var(--warn-soft); color: #f1bd94; border-color: rgba(231, 178, 92, .25); white-space: normal; }

.kv { margin: 12px 0 0; display: grid; gap: 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.kv > div { display: grid; grid-template-columns: minmax(6.5rem, 11rem) minmax(0, 1fr); gap: 12px; font-size: .9rem; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.kv dt { color: var(--ink-3); font: 500 .72rem/1.9 var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .kv > div { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
.note ul { margin: 8px 0; padding-left: 1.2em; }
.note li + li { margin-top: 4px; }
.note a { color: inherit; }

/* empty states: a blank ledger, ruled, with no gold row yet */
.empty { padding: 44px 20px 40px; border: 1px dashed var(--line-2); background: rgba(255, 255, 255, .012); }
.empty::before {
  content: ""; display: block; width: 64px; height: 46px; margin: 0 auto 18px; border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(200, 112, 62, .55) 0 2px, transparent 2px) 0 0 / 100% 100% no-repeat,
    repeating-linear-gradient(180deg, transparent 0 10px, rgba(226, 216, 196, .2) 10px 11px),
    var(--bg-2);
  box-shadow: 0 0 0 1px var(--line-2), 0 12px 24px -12px rgba(0, 0, 0, .8);
}
.empty p { margin: 0; }
.empty p + p { margin-top: 6px; }
.empty strong { font: 500 1.15rem/1.3 var(--display); letter-spacing: -.01em; }
.empty a:not(.btn) { color: var(--gold-2); }
.empty .btn { margin-top: 16px; }

/* entrance for items rendered after load */
@keyframes rise { from { opacity: 0; transform: translate3d(0, 10px, 0); } }
@keyframes settle { from { opacity: 0; transform: translate3d(0, 6px, 0) scale(.985); } }

/* ---------- sell ---------- */
#signed-in, #closed, #loading { margin-top: clamp(28px, 6vw, 48px); }
#loading { font: 500 .8rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
#signed-out { max-width: 780px; margin-top: clamp(28px, 6vw, 48px); padding: 0; overflow: hidden; }
#signed-out > h2 { font-size: clamp(1.3rem, 3.4vw, 1.6rem); padding: clamp(20px, 4.5vw, 30px) clamp(18px, 4.5vw, 30px) 4px; margin: 0 0 16px; }
#signed-out > .steps { padding: 0 clamp(18px, 4.5vw, 30px); }
#signed-out > .actions, #signed-out > #deeplinks { margin: 24px 0 0; padding: 18px clamp(18px, 4.5vw, 30px); border-top: 1px solid var(--line); background: rgba(0, 0, 0, .16); }
#signed-out > #deeplinks { margin-top: 0; border-top: 0; padding-top: 0; }
#signed-out > .note { margin: 0 clamp(18px, 4.5vw, 30px) 14px; }
#signed-out > .actions + .note { margin-top: 0; }
#signed-out > .hint { margin: 0; padding: 0 clamp(18px, 4.5vw, 30px) 20px; background: rgba(0, 0, 0, .16); }
#signed-out > .actions:has(+ #si-err:not([hidden])) { padding-bottom: 14px; }
#wallets:empty { display: none; }
#wallets { margin: 0; }
#wallets .btn, #deeplinks .btn { animation: rise .4s var(--ease-out) both; }
#wallets .btn:nth-child(2), #deeplinks .btn:nth-child(2) { animation-delay: 60ms; }
#wallets .btn:nth-child(3), #deeplinks .btn:nth-child(3) { animation-delay: 120ms; }

#signed-in > section { margin-top: clamp(40px, 7vw, 64px); }
#signed-in > section:first-of-type { margin-top: clamp(32px, 6vw, 48px); }
#upload { scroll-margin-top: 80px; }
#upload > .note { margin-bottom: 16px; }
.scan { margin-top: 14px; animation: settle .45s var(--ease-out) both; }
.scan:empty { display: none; }
.scanhead { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.scanhead .chip { border-color: rgba(200, 112, 62, .3); background: var(--gold-soft); }
.scanhead .chip b { color: var(--gold-2); font-weight: 500; }
.scan .cols { margin-bottom: 12px; max-height: 9.5rem; overflow-y: auto; padding: 10px; border-radius: var(--r); background: rgba(6, 11, 22, .5); border: 1px solid var(--line); }
.price-line b { color: var(--gold-2); font-weight: 500; }
#sell-result { margin-top: 16px; animation: settle .5s var(--ease-out) both; }
#sell-result > strong { display: inline; font-family: var(--display); font-weight: 550; font-size: 1.08rem; }

.tlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.titem { padding: clamp(16px, 4vw, 22px); transition: border-color .2s, transform .25s var(--ease-out); animation: rise .5s var(--ease-out) both; }
.titem:nth-child(2) { animation-delay: 60ms; }
.titem:nth-child(3) { animation-delay: 120ms; }
.titem:nth-child(n+4) { animation-delay: 180ms; }
.titem:hover { border-color: var(--line-2); transform: translateY(-1px); }
.thead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ttitle { font: 550 1.2rem/1.3 var(--display); letter-spacing: -.01em; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.ttitle:hover { color: var(--gold-2); }
.tnote { margin: 6px 0 0; }
.tmeta { display: grid; grid-template-columns: repeat(4, minmax(0, max-content)); justify-content: start; gap: 8px 36px; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.tmeta dt { font: 500 .66rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.tmeta dd { margin: 4px 0 0; font: 500 .98rem/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.titem .actions .small.muted { margin-left: auto; font-family: var(--mono); font-size: .75rem; }
@media (max-width: 520px) {
  .tmeta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .titem .actions .small.muted { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 380px) { .stats .stat { padding: 12px; } .stat .k { letter-spacing: .05em; } }

@media (min-width: 980px) {
  #upload { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0 32px; align-items: start; }
  #upload > h2 { grid-column: 1 / -1; }
  #upload > .note { grid-column: 2; grid-row: 2; position: sticky; top: 88px; margin: 0; }
  #sell-form { grid-column: 1; grid-row: 2; }
  #sell-result { grid-column: 1; grid-row: 3; }
}

/* ---------- dataset ---------- */
#state { margin-top: 8px; font: 500 .8rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
#d-slug { color: var(--ink-2); text-transform: none; letter-spacing: .02em; }
#d-badges:empty { display: none; }
#d-status { margin-top: 14px; max-width: 42rem; }
#d-desc { margin-top: 16px; }
.facts { margin-top: 10px !important; }
.facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.facts-grid dd { margin: 0; font: 500 1.1rem/1.35 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; color: var(--ink); }
.facts-grid dd.prose { font: 400 .95rem/1.5 var(--sans); color: var(--ink-2); }
.facts-grid .wide { grid-column: 1 / -1; }
.facts-grid > div.key { position: relative; background: linear-gradient(180deg, rgba(200, 112, 62, .11), rgba(200, 112, 62, .03)), var(--surface); }
.facts-grid > div.key::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--gold); }
.facts-grid .key dt { color: var(--gold); }
.facts-grid .key dd { color: var(--gold-2); font-size: 1.25rem; }
@media (min-width: 760px) {
  .facts-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .facts-grid .wide { grid-column: span 2; }
  .facts-grid dd { font-size: 1.3rem; }
  .facts-grid .key dd { font-size: 1.45rem; }
}
#d-cols td.mono { color: var(--ink); }
#d-cols tbody tr { transition: background .15s; }
#d-cols tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table-scroll { -webkit-overflow-scrolling: touch; box-shadow: 0 24px 48px -32px rgba(0, 0, 0, .8); }
.table-scroll table { min-width: 100%; }
td.mono { font-family: var(--mono); font-size: .86rem; }

#quote-section .card.form { padding: clamp(16px, 4vw, 26px); }
#q-conds:empty { display: none; }
#q-conds { display: grid; gap: 10px; margin-bottom: 4px; }
.cond { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 8px; align-items: center; animation: settle .35s var(--ease-out) both; }
.cond select, .cond input { min-width: 0; }
.cond .c-del { color: var(--ink-2); }
.cond .c-del:hover { color: var(--bad); border-color: rgba(238, 143, 132, .4); }
#q-conds + .actions { margin-top: 12px; }
#q-conds:empty + .actions { margin-top: 0; }
.field.limit { margin: 18px 0 0; max-width: 14rem; }
#quote-section .card.form > .note { margin-top: 16px; }
.quote { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); animation: settle .45s var(--ease-out) both; }
.qgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.qgrid .stat { background: var(--bg-2); }
.qgrid .stat:nth-child(2) { position: relative; background: linear-gradient(180deg, rgba(200, 112, 62, .12), rgba(200, 112, 62, .03)), var(--bg-2); }
.qgrid .stat:nth-child(2)::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--gold); }
.qgrid .stat:nth-child(2) .k { color: var(--gold); }
.qgrid .stat:nth-child(2) .v { color: var(--gold-2); }
.quote .note { margin: 0; }
#q-id { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .qgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cond { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); }
  .cond .c-val { grid-column: 1 / -1; }
  .cond .c-del { grid-column: 1 / -1; justify-self: start; }
}
#buy-section > p.muted { max-width: 46rem; }
#agent-steps { margin-top: 22px; }
#agent-steps > p { margin-top: 16px; }
.report { margin-top: 56px; text-align: center; font-size: .88rem; }
.report a { color: var(--ink-3); display: inline-flex; align-items: center; min-height: 44px; }
.report a:hover { color: var(--bad); }

/* not found: a big blank ledger */
#notfound { max-width: 560px; margin: clamp(8px, 4vw, 40px) auto 0; padding: 56px 22px 48px; border-style: solid; border-color: var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 60%), var(--surface); box-shadow: var(--shadow); animation: settle .6s var(--ease-out) both; }
#notfound::before { width: 120px; height: 86px; margin-bottom: 26px; background:
    linear-gradient(90deg, rgba(238, 143, 132, .5) 0 2px, transparent 2px) 0 0 / 100% 100% no-repeat,
    repeating-linear-gradient(180deg, transparent 0 14px, rgba(226, 216, 196, .2) 14px 15px),
    var(--bg-2); }
#notfound h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
#notfound p { color: var(--ink-2); max-width: 30rem; margin: 0 auto; }

/* ---------- code blocks: a tabbed sheet, scrolling inside itself ---------- */
.codebox { position: relative; margin: 10px 0 16px; max-width: 100%; }
.codebox pre, pre.code {
  margin: 0; max-width: 100%; white-space: pre; -webkit-overflow-scrolling: touch;
  padding: 16px 92px 16px 18px; font-size: 13px; line-height: 1.7; color: #ddd6c6;
  border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 48px), #070d18;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px -28px rgba(0, 0, 0, .9);
  scrollbar-width: thin; scrollbar-color: var(--raise) transparent;
}
.codebox .copy {
  position: absolute; top: 5px; right: 6px; min-height: 30px; min-width: 56px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink-2);
  font: 500 .72rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s var(--ease-out);
}
.codebox .copy::after { content: ""; position: absolute; inset: -7px -4px; }
.codebox .copy:hover { background: rgba(255, 255, 255, .05); border-color: var(--line-2); color: var(--ink); }
.codebox .copy:active { transform: scale(.96); }
@media (max-width: 560px) {
  .steps > li > div > .codebox { margin-left: -50px; }
  .codebox pre {
    padding: 54px 16px 16px;
    background:
      linear-gradient(var(--line), var(--line)) 0 40px / 100% 1px no-repeat,
      linear-gradient(rgba(255, 255, 255, .03), rgba(255, 255, 255, .03)) 0 0 / 100% 40px no-repeat,
      #070d18;
  }
}
pre.code:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- agents (docs) ---------- */
.docs { counter-reset: sec toc; }
.docs > section[id] { counter-increment: sec; scroll-margin-top: 84px; }
.docs > section[id] > h2::before { content: "§ " counter(sec, decimal-leading-zero); font: 500 .74rem/1 var(--mono); color: var(--gold); letter-spacing: .06em; transform: translateY(-.35em); flex: none; }
.docs section > p { max-width: 68ch; }
.docs section > p:not(.muted) { color: var(--ink-2); }
.docs section h3 {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  margin: 2.2em 0 .2em; font: 500 .98rem/1.4 var(--mono); letter-spacing: 0; color: var(--ink); overflow-wrap: anywhere;
}
.docs section h2 + p + h3, .docs section h2 + h3 { margin-top: 1.4em; }
.verb { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font: 500 .68rem/1 var(--mono); letter-spacing: .08em; color: var(--slate); background: var(--slate-soft); border: 1px solid rgba(143, 176, 196, .25); }
.docs .muted.small { line-height: 1.6; max-width: 72ch; }
.docs .table-scroll { margin: 14px 0 16px; }
.wrapcell { white-space: normal; min-width: 11rem; color: var(--ink-2); }
#ops-table td.mono { color: var(--gold-2); }
.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); max-width: 72ch; }
.rules li { position: relative; padding: 14px 0 14px 28px; border-bottom: 1px solid var(--line); color: var(--ink-2); overflow-wrap: anywhere; }
.rules li::before { content: ""; position: absolute; left: 4px; top: 1.45em; width: 10px; height: 1px; background: var(--gold); }
.rules li strong { color: var(--ink); }

/* table of contents: an index strip on phones, a sticky margin index on wide screens */
.toc {
  display: flex; gap: 4px; margin: 0 calc(var(--pad) * -1); padding: 4px var(--pad) 8px; overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--pad), #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--pad), #000 calc(100% - 28px), transparent);
}
.toc::-webkit-scrollbar { display: none; }
.toc a {
  counter-increment: toc; flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(19, 30, 51, .6); text-decoration: none; color: var(--ink-2);
  font-weight: 500; font-size: .9rem; transition: border-color .2s, color .2s, transform .2s var(--ease-out), background .2s;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font: 500 .68rem/1 var(--mono); color: var(--ink-3); transition: color .2s; }
.toc a:hover { color: var(--ink); border-color: rgba(200, 112, 62, .4); transform: translateY(-1px); }
.toc a:hover::before { color: var(--gold); }
.docs > .toc { margin-top: 28px; }
@media (min-width: 1080px) {
  .docs { display: grid; grid-template-columns: 190px minmax(0, 1fr); column-gap: 72px; align-items: start; }
  .docs > .pagehead { grid-column: 1 / -1; }
  .docs > .toc {
    grid-column: 1; grid-row: 2 / span 7; position: sticky; top: 96px; align-self: start;
    flex-direction: column; gap: 0; margin: clamp(40px, 7vw, 72px) 0 0; padding: 0 0 0 0; overflow: visible; -webkit-mask-image: none; mask-image: none;
    border-left: 1px solid var(--line);
  }
  .docs > .toc a { min-height: 38px; padding: 0 0 0 18px; border: 0; border-radius: 0; background: none; margin-left: -1px; border-left: 1px solid transparent; }
  .docs > .toc a:hover { transform: translateX(2px); border-left-color: var(--gold); }
  .docs > section[id] { grid-column: 2; min-width: 0; }
}

/* ---------- takedown ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: clamp(28px, 6vw, 48px); }
.layout > div { min-width: 0; }
.layout .side { position: sticky; top: 88px; background: rgba(19, 30, 51, .55); box-shadow: none; }
.layout .side h3 { font-size: 1.05rem; margin-bottom: 14px; }
.plain { list-style: none; counter-reset: p; padding: 0; margin: 0 0 18px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.plain li { counter-increment: p; position: relative; padding-left: 32px; color: var(--ink-2); font-size: .94rem; overflow-wrap: anywhere; }
.plain li::before { content: counter(p, decimal-leading-zero); position: absolute; left: 0; top: .2em; font: 500 .72rem/1.4 var(--mono); color: var(--gold); }
.layout .side > p { padding-top: 14px; border-top: 1px solid var(--line); margin: 0; }
.ok-card { border-color: rgba(143, 195, 154, .28); background: linear-gradient(180deg, rgba(143, 195, 154, .08), transparent 70%), var(--surface); }
#td-done { text-align: left; animation: settle .55s var(--ease-out) both; }
#td-done .seal { width: 52px; height: 52px; margin: 0 0 18px; color: var(--ok); animation: seal .7s var(--ease-out) .1s both; }
@keyframes seal { from { opacity: 0; transform: scale(.6) rotate(-12deg); } }
#td-done h2 { font-size: clamp(1.5rem, 4.5vw, 2rem); }
#td-id { color: var(--ink); font-size: 1.05em; padding: 1px 8px; border-radius: 6px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line-2); }
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); } .layout .side { position: static; } }

/* ---------- ops ---------- */
.login { margin-top: clamp(24px, 5vw, 36px); max-width: 26rem; padding: 0; overflow: hidden; }
.login > .field { padding: 22px 22px 6px; }
.login > .note { margin: 0 22px 12px; }
.login > .actions { margin: 14px 0 0; padding: 16px 22px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .16); }
#op-token { font-family: var(--mono); letter-spacing: .1em; }
#op-main section { margin-top: clamp(36px, 6vw, 56px); }
#op-main .bar { margin-top: 8px; }
#op-main .bar > span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-right: 10px; vertical-align: 1px; box-shadow: 0 0 0 3px var(--gold-soft); }
#op-msg { margin-top: 10px; animation: settle .35s var(--ease-out) both; }
.opcard { margin-bottom: 12px; padding: clamp(16px, 4vw, 22px); animation: rise .45s var(--ease-out) both; }
.opcard .thead strong { font-family: var(--display); font-weight: 550; font-size: 1.08rem; }
.opdetails { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 8px; padding: 12px 14px; border-radius: var(--r); background: rgba(6, 11, 22, .5); border: 1px solid var(--line); color: var(--ink-2); font-size: .94rem; }
#op-main td .actions { margin: 0; flex-wrap: nowrap; }
#op-main table td { vertical-align: middle; }
#op-main tbody tr { transition: background .15s; }
#op-main tbody tr:hover { background: rgba(255, 255, 255, .02); }
#op-main .empty { padding: 28px 18px; }
#op-main .empty::before { width: 48px; height: 34px; margin-bottom: 12px; }
#op-main { margin-top: clamp(24px, 5vw, 36px); }
