:root {
  color-scheme: dark;
  --bg: #0a1014;
  --surface: #111a20;
  --surface-2: #17232b;
  --border: #293942;
  --text: #e8f0f2;
  --muted: #94a7ae;
  --accent: #66e3ad;
  --accent-dark: #082b20;
  --blue: #72b7ff;
  --danger: #ff8b8b;
  --warning: #f2c66d;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 80% -20%, #173029 0, transparent 34rem), var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
.site-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: .75rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--text); font-weight: 700; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: var(--accent); border: 1px solid var(--accent); border-radius: 8px; font-size: .75rem; letter-spacing: .08em; }
nav { display: flex; align-items: center; gap: 1rem; }
nav form { display: inline; }
.user-label { color: var(--muted); }
.page-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 5rem; }
.site-footer { color: var(--muted); text-align: center; padding: 2rem; border-top: 1px solid var(--border); }
h1, h2, h3 { letter-spacing: -.025em; line-height: 1.12; }
h1 { font-size: clamp(2rem, 5vw, 3.75rem); margin: .25rem 0 1rem; }
h2 { font-size: 1.25rem; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: .75rem; font-weight: 700; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 66ch; line-height: 1.65; }
.muted, .help-text { color: var(--muted); }
.hero-row, .detail-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.detail-header { display: block; }
.detail-header h1 { max-width: 20ch; }
.header-actions { display: flex; gap: .6rem; margin-top: 1.5rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .55rem .9rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; text-decoration: none; cursor: pointer; }
.button:hover { border-color: var(--muted); text-decoration: none; }
.button-primary { background: var(--accent); border-color: var(--accent); color: #071812; font-weight: 700; }
.button-small { min-height: 32px; padding: .35rem .65rem; font-size: .85rem; }
.link-button { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; }
.danger { color: var(--danger); }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(180px, 1.3fr) minmax(160px, 1fr) auto; gap: .75rem; align-items: end; padding: 1rem; margin-bottom: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
label, .field > label { display: grid; gap: .45rem; color: var(--muted); font-size: .86rem; font-weight: 600; }
input, select, textarea { width: 100%; padding: .72rem .78rem; color: var(--text); background: #0c1419; border: 1px solid var(--border); border-radius: 7px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; border-color: var(--accent); }
.query-list { display: grid; gap: .9rem; }
.query-card { padding: 1.25rem 1.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.query-card:hover { border-color: #45606c; }
.query-card h2 { margin: .8rem 0 .5rem; }
.query-card h2 a { color: var(--text); }
.query-card p { color: #c4d0d4; line-height: 1.55; }
.query-card-top, .metadata { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.metadata { color: var(--muted); font-size: .84rem; gap: 1rem; }
.badge { display: inline-flex; padding: .28rem .5rem; color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); border-radius: 5px; font-size: .75rem; font-weight: 650; }
.badge-success { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.badge-muted { color: var(--muted); background: color-mix(in srgb, var(--muted) 10%, transparent); }
.badge-ai { color: #cf9cff; background: #251933; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, .8fr); gap: 2rem; align-items: start; }
.main-column, .side-column { display: grid; gap: 1.25rem; }
.content-section, .side-column section, .revision-item, .auth-card { padding: 1.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.content-section > h2:first-child, .side-column h2 { margin-top: 0; }
.side-column section { padding: 1.1rem; }
.side-column h2 { font-size: .95rem; color: var(--muted); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.prose { line-height: 1.7; color: #d2dcdf; }
.query-code { overflow-x: auto; margin: .75rem 0 0; padding: 1.1rem; color: #d9f6e9; background: #071013; border: 1px solid #203138; border-radius: 7px; line-height: 1.55; tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
.plain-list { display: grid; gap: .6rem; list-style: none; padding: 0; margin: 0; }
.plain-list li { display: grid; gap: .2rem; }
.small-prose { font-size: .9rem; line-height: 1.55; }
.hash-value { display: block; word-break: break-all; color: var(--warning); }
.discussion-list { display: grid; gap: .75rem; margin: 1rem 0; }
.discussion-message { padding: 1rem; background: #0d161b; border: 1px solid var(--border); border-radius: 8px; }
.discussion-message header, .message-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; color: var(--muted); font-size: .8rem; }
.discussion-message header strong { color: var(--text); font-size: .9rem; }
.message-body { margin: .8rem 0; line-height: 1.6; }
.message-actions form { display: inline; }
.reply-context, .revision-warning, .reply-indicator { margin-top: .7rem; padding: .5rem .65rem; background: var(--surface-2); color: var(--muted); border-radius: 5px; font-size: .82rem; }
.revision-warning { color: var(--warning); }
.message-form { display: grid; gap: .65rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.empty-state, .empty-discussion { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.editor-form { width: min(900px, 100%); display: grid; gap: 1.2rem; }
.compact-form { width: min(680px, 100%); }
.field { display: grid; gap: .45rem; }
.form-section { display: grid; gap: 1rem; min-width: 0; padding: 1.25rem; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.form-section legend { padding: 0 .45rem; color: var(--text); font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.field-label { color: var(--muted); font-size: .86rem; font-weight: 600; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1rem; padding: 0; margin: .2rem 0; }
.field ul label { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
.field ul input { width: auto; }
.switch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.switch-stack { display: grid; gap: .85rem; }
.switch-row { display: flex; align-items: center; gap: .7rem; min-width: 0; color: var(--text); font-size: .9rem; font-weight: 500; cursor: pointer; }
.switch-row-primary { width: fit-content; font-weight: 650; }
.telemetry-switch { min-height: 44px; padding: .65rem .75rem; background: #0c1419; border: 1px solid var(--border); border-radius: 8px; }
.telemetry-switch:hover { border-color: #45606c; }
.switch-control { position: relative; display: inline-flex; flex: 0 0 auto; width: 2.75rem; height: 1.5rem; }
.switch-input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.switch-track { display: block; width: 100%; height: 100%; padding: 2px; background: #26363f; border: 1px solid #435761; border-radius: 999px; transition: background-color .18s ease, border-color .18s ease; }
.switch-thumb { display: block; width: 1.1rem; height: 1.1rem; background: var(--muted); border-radius: 50%; box-shadow: 0 1px 3px #0008; transition: transform .18s ease, background-color .18s ease; }
.switch-input:checked + .switch-track { background: var(--accent-dark); border-color: var(--accent); }
.switch-input:checked + .switch-track .switch-thumb { background: var(--accent); transform: translateX(1.2rem); }
.switch-input:focus-visible + .switch-track { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; }
.switch-input:disabled + .switch-track { opacity: .5; cursor: not-allowed; }
.switch-label { min-width: 0; line-height: 1.35; }
.conditional-panel { display: grid; gap: 1rem; }
.conditional-panel[hidden] { display: none; }
.conditional-panel-nested { padding: 1rem; margin: -.15rem 0 .25rem 3.45rem; background: #0d161b; border: 1px solid var(--border); border-radius: 8px; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }
.errorlist { color: var(--danger); margin: 0; padding-left: 1.2rem; }
.help-text { font-size: .8rem; font-weight: 400; }
.form-actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-top: .5rem; }
.narrow-header { max-width: 820px; margin-bottom: 2rem; }
.revision-list { display: grid; gap: 1rem; }
.revision-item header { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); }
.revision-item h2 { color: var(--text); margin: 0; }
.auth-card { width: min(480px, 100%); margin: 5vh auto; padding: 2rem; }
.stacked-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.stacked-form > div { display: grid; gap: .45rem; }
.warning-card { width: min(650px, 100%); }
.destination-url { display: block; padding: .8rem; margin: 1rem 0; background: #071013; color: var(--warning); border-radius: 6px; overflow-wrap: anywhere; }
.flash-region { width: min(1180px, calc(100% - 2rem)); margin: 1rem auto 0; }
.flash { padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.flash.success { border-color: var(--accent); }
.flash.error { border-color: var(--danger); }
.notice { color: var(--warning); }
.status-banner { display: flex; flex-wrap: wrap; gap: .7rem 1rem; align-items: center; margin-bottom: 1.5rem; padding: .85rem 1rem; color: var(--warning); background: color-mix(in srgb, var(--warning) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); border-radius: var(--radius); }
.status-banner span { color: var(--muted); }
.settings-layout { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); gap: 1.25rem; align-items: start; }
.token-list { display: grid; gap: .75rem; }
.token-row { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(240px, 1.7fr) auto; gap: 1rem; align-items: center; padding: 1rem; background: #0d161b; border: 1px solid var(--border); border-radius: 8px; }
.token-row > div:first-child { display: grid; gap: .35rem; }
.token-row code { color: var(--warning); }
.token-created-card { width: min(760px, 100%); }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; margin: .5rem 0; }
.copy-field input { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.guide-layout { display: grid; gap: 1.25rem; max-width: 940px; }
.guide-layout .prose code { color: var(--warning); }
.guide-layout .prose li { margin: .45rem 0; }
@media (max-width: 800px) {
  .site-header { position: static; align-items: flex-start; }
  nav { justify-content: flex-end; flex-wrap: wrap; }
  .user-label { display: none; }
  .filter-bar, .detail-layout, .field-grid, .switch-grid, .settings-layout, .token-row { grid-template-columns: 1fr; }
  .hero-row { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .switch-track, .switch-thumb { transition: none; }
}
@media (max-width: 520px) {
  .site-header { padding: .75rem 1rem; }
  nav > a:not(.button), .brand > span:last-child { display: none; }
  .page-shell { padding-top: 2rem; }
  .revision-item header { display: grid; }
}

.lookup-list { display: grid; gap: .9rem; list-style: none; padding: 0; margin: .75rem 0 0; }
.lookup-item { display: grid; gap: .45rem; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: 7px; min-width: 0; }
.lookup-item-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.lookup-name { font-weight: 650; overflow-wrap: anywhere; }
.lookup-preview { overflow-x: auto; margin-top: .5rem; }
.lookup-preview table { border-collapse: collapse; font-size: .82rem; min-width: 100%; }
.lookup-preview th, .lookup-preview td { padding: .35rem .6rem; border: 1px solid var(--border); text-align: left; white-space: nowrap; }
.lookup-preview th { color: var(--muted); font-weight: 650; }
input[type="file"] { padding: .55rem; }

nav a[aria-current="page"] { color: var(--text, inherit); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: .45rem; }
.lede p { margin: 0 0 .75rem; }
.guide-shell { display: grid; grid-template-columns: 200px minmax(0, 940px); gap: 2rem; align-items: start; }
.guide-toc { position: sticky; top: 88px; display: grid; gap: .6rem; }
.guide-toc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.guide-toc a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.guide-toc a:hover, .guide-toc a:focus-visible { color: var(--accent); }
.guide-layout section { scroll-margin-top: 88px; }
.guide-layout pre { overflow-x: auto; margin: .75rem 0 0; padding: 1.1rem; color: #d9f6e9; background: #071013; border: 1px solid #203138; border-radius: 7px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.guide-layout pre code { color: inherit; }
.guide-layout table { width: 100%; border-collapse: collapse; font-size: .9rem; display: block; overflow-x: auto; }
.guide-layout th, .guide-layout td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.guide-layout th { color: var(--muted); }
@media (max-width: 800px) {
  .guide-shell { grid-template-columns: 1fr; }
  .guide-toc { position: static; }
  .guide-toc ul { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
}
