/* Live Sheet, the look of the Cellprose format site: the page is a spreadsheet. A title bar, ribbon tabs, formula bar
   and column letters on top, row numbers on the left, a 104 x 28 px grid behind everything, and each section a white
   sheet with a coloured tab naming its cell range. Geist and Geist Mono. One light look on purpose.
   Every page uses the same layout; only the accent changes. <body data-brand> picks it: home is ink with a stripe in
   the three product colours, audit is amber, diffs is teal and api is violet. Meaning colours (the yellow flagged
   cell, green and red diff lines, blue typed inputs) stay the same on every page. */
@font-face { font-family: "Geist"; src: url("/static/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --g: 36px;            /* row-number gutter */
  --chrome: 156px;      /* title 38 + ribbon 36 + sub-ribbon 30 + formula bar 30 + columns 22 */
  --line2: #c3cec8; --line3: #9fb2a8; --colhd: #6b7c73; --paper: #fbfcfb; --sheet: #ffffff; --grid: #e3e9e5; --gridbg: #e8eee9; --line: #b9c7bf; --rule: #d5ddd8;
  --ink: #13201a; --muted: #55665d; --faint: #7a8a81;
  --accent: #107c41; --accent-deep: #0b5a2f; --accent-ink: #ffffff; --accent-soft: #dff3e7; --head: #f3f6f4;
  --accent-text: #107c41; --accent-tint: rgba(16, 124, 65, .06); --accent-shadow: rgba(16, 124, 65, .45);
  --stripe: none;                                   /* the home page's product stripe under the title bar */
  --c-audit: #f2b41c; --c-diffs: #0f8a8f; --c-api: #6b3fc9;
  --mark: #ffe36e; --mark-ink: #2b2300; --warn: #c4441c; --warn-soft: #fff1ea;
  --in-bg: #dbe8ff; --in-ink: #1d4ab0; --f-ink: #0b6b37;
  --code-bg: #0f1a15; --code-fg: #dce8e1; --code-dim: #7f948a; --code-hd: #f3d36b; --code-kw: #8fd3bd;
  --add: #0b6b37; --add-bg: #e3f5ea; --del: #b3261e; --del-bg: #fde8e6;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (max-width: 639px) { :root { --g: 0px; } }

body[data-brand="home"] {
  --accent: #15191c; --accent-deep: #15191c; --accent-ink: #ffffff; --accent-soft: #eceeef; --accent-text: #15191c;
  --accent-tint: rgba(21, 25, 28, .05); --accent-shadow: rgba(21, 25, 28, .4);
  --stripe: linear-gradient(90deg, var(--c-audit) 0 33.4%, var(--c-diffs) 33.4% 66.7%, var(--c-api) 66.7%);
}
body[data-brand="audit"] {
  --accent: #f2b41c; --accent-deep: #7a4f00; --accent-ink: #2b2300; --accent-soft: #fff3cc; --accent-text: #7a4f00;
  --accent-tint: rgba(242, 180, 28, .1); --accent-shadow: rgba(160, 110, 0, .4);
}
body[data-brand="diffs"] {
  --accent: #0f8a8f; --accent-deep: #0a6669; --accent-ink: #ffffff; --accent-soft: #daf1f1; --accent-text: #0a6669;
  --accent-tint: rgba(15, 138, 143, .07); --accent-shadow: rgba(15, 138, 143, .45);
}
body[data-brand="api"] {
  --accent: #6b3fc9; --accent-deep: #52309c; --accent-ink: #ffffff; --accent-soft: #ece5fb; --accent-text: #6b3fc9;
  --accent-tint: rgba(107, 63, 201, .06); --accent-shadow: rgba(107, 63, 201, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--chrome) + 40px); scroll-behavior: smooth; }

/* Moving between the pages fades the whole page, so the accent colour changes gradually, not in one jump. The chrome is
   the same on every page, so it keeps its place while its colours blend. Browsers without cross-document view
   transitions (Firefox) simply load the next page. */
@view-transition { navigation: auto; }
.chrome { view-transition-name: chrome; }
.status { view-transition-name: status; }
.rows { view-transition-name: rows; }
::view-transition-group(*) { animation-duration: .35s; }
.titlebar, .status, .logo, .btn, .pmark, .rtab.file { transition: background-color .3s, color .3s, border-color .3s; }
body {
  margin: 0; color: var(--ink); font: 16px/1.55 var(--body);
  background-color: var(--paper);
  background-image: linear-gradient(var(--gridbg) 1px, transparent 1px), linear-gradient(90deg, var(--gridbg) 1px, transparent 1px);
  background-size: 104px 28px; background-position: var(--g) var(--chrome);  /* row 1 starts under the chrome */
  padding: var(--chrome) 0 26px var(--g);
}
a { color: var(--accent-deep); }
code { font-family: var(--mono); font-size: .9em; }
main { cursor: cell; }
main :is(a, button, input, label, summary) { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* ---------- chrome ---------- */
.chrome { position: fixed; z-index: 30; top: 0; left: var(--g); right: 0; background: var(--sheet); box-shadow: 0 2px 6px -4px rgba(16, 40, 28, .3); }
.titlebar { position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; background: var(--accent); color: var(--accent-ink); }
.titlebar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--stripe); pointer-events: none; }
.logo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 3px; background: var(--sheet); color: var(--accent-deep); text-decoration: none; font: 700 11px var(--mono); flex: none; }
.logo.mark { background: none; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9); }  /* the ink tile keeps a white ring so it shows on every accent */
.logo.mark svg { display: block; border-radius: 3px; }
.doc { color: var(--accent-ink); text-decoration: none; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.doc b { font-weight: 600; }
.docsub { opacity: .85; }
.free { margin-left: auto; font: 500 12px var(--mono); background: rgba(255, 255, 255, .16); border: 1px solid color-mix(in srgb, currentColor 35%, transparent); border-radius: 4px; padding: 3px 10px; white-space: nowrap; }
.gh { color: var(--accent-ink); text-decoration: none; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); border-radius: 3px; padding: 3px 10px; font-size: 12.5px; white-space: nowrap; }
.gh:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 720px) { .docsub, .gh:not(#signin):not(.theme) { display: none; } }
@media (max-width: 520px) { .free { display: none; } }  /* leaves room for the name beside Sign in and the theme toggle */  /* Sign in stays: it is the only way to an account */

.ribbon { display: flex; align-items: flex-end; gap: 2px; height: 36px; padding: 0 8px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.ribbon::-webkit-scrollbar { display: none; }
.rtab { position: relative; padding: 7px 13px 7px; font-size: 13.5px; color: var(--ink); text-decoration: none; white-space: nowrap; transition: background-color .2s, color .2s; }
.rtab:hover { background: var(--head); }
.rtab.cur { color: var(--accent-deep); font-weight: 600; }
.rtab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 2px 2px 0 0; background: var(--accent); transform: scaleX(0); transition: transform .25s ease; }
.rtab.cur::after { transform: scaleX(1); }
.rtab.file { background: var(--accent); color: var(--accent-ink); border-radius: 3px 3px 0 0; margin-right: 6px; font-weight: 600; }
.rtab.file:hover { background: var(--accent-deep); }

.ribbon.sub { height: 30px; background: var(--head); }
.ribbon.sub .rtab { padding: 5px 12px; font-size: 12.5px; }
.ribbon.sub .rtab::after { height: 2px; }
.fbar { display: flex; align-items: stretch; height: 30px; border-bottom: 1px solid var(--rule); font: 13px/29px var(--mono); }
.namebox { width: 96px; flex: none; padding: 0 10px; border-right: 1px solid var(--rule); font-weight: 500; white-space: nowrap; overflow: hidden; }
.fx { flex: none; padding: 0 10px; border-right: 1px solid var(--rule); color: var(--faint); font-style: italic; font-family: Georgia, serif; }
.formula { flex: 1; min-width: 0; padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.formula .op { color: var(--accent-text); font-weight: 600; }
.formula .str { color: var(--in-ink); }
.caret { display: inline-block; width: 1px; height: 15px; margin-left: 1px; vertical-align: -3px; background: var(--ink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cols { position: relative; height: 22px; background: var(--head); border-bottom: 1px solid var(--line2); overflow: hidden; font: 500 11px/22px var(--mono); color: var(--colhd); }
.cols span { position: absolute; top: 0; width: 104px; height: 22px; text-align: center; border-right: 1px solid var(--rule); }
.cols span.on { background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; box-shadow: inset 0 -2px var(--accent); }
.rows { position: fixed; z-index: 31; left: 0; top: 0; bottom: 0; width: var(--g); background: var(--head); border-right: 1px solid var(--line2); overflow: hidden; }
.rows::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: var(--chrome); background: var(--sheet); border-bottom: 1px solid var(--line2); z-index: 1; }
.rows span { position: absolute; left: 0; width: 100%; height: 28px; text-align: center; font: 500 10.5px/28px var(--mono); color: var(--faint); border-bottom: 1px solid var(--grid); }
.rows span.on { background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; box-shadow: inset -2px 0 var(--accent); }
@media (max-width: 639px) { .rows { display: none; } }

.status { position: fixed; z-index: 31; left: var(--g); right: 0; bottom: 0; height: 26px; display: flex; align-items: center; gap: 18px; padding: 0 12px; background: var(--accent); color: var(--accent-ink); font: 12px/26px var(--mono); white-space: nowrap; overflow: hidden; }
.status .sp { margin-left: auto; opacity: .85; }
@media (max-width: 760px) { .status .sp { display: none; } }

/* ---------- sheets ---------- */
main { max-width: 1152px; margin: 0 auto; padding: 8px 24px 72px; }
@media (max-width: 639px) { main { padding-inline: 16px; } }
.sheet { position: relative; background: var(--sheet); border: 1px solid var(--line); box-shadow: 0 18px 40px -26px var(--accent-shadow); padding: 28px; margin-top: 56px; min-width: 0; }
@media (max-width: 639px) { .sheet { padding: 18px 16px; } }
.sheet::before {
  content: attr(data-tab) "   " attr(data-range); white-space: pre; position: absolute; left: -1px; top: -25px; height: 25px;
  display: flex; align-items: center; padding: 0 10px; background: var(--accent); color: var(--accent-ink); font: 500 12px var(--mono); border-radius: 3px 3px 0 0;
}
h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -.035em; line-height: 1.08; font-weight: 700; }
h1 { font-size: clamp(36px, 5.6vw, 62px); }
h2 { font-size: clamp(26px, 3.6vw, 36px); }
h3 { font-size: 19px; letter-spacing: -.012em; }
p { margin: 0; }
.eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.lede { color: var(--muted); font-size: 17.5px; max-width: 62ch; }
.sec-head { display: grid; gap: 10px; margin-bottom: 24px; }
.note { color: var(--muted); font-size: 14px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 2px; padding: 10px 18px; font-weight: 600; text-decoration: none; font-size: 15px; }
.btn:hover { background: var(--accent-deep); }
.btn.ghost { background: transparent; color: var(--accent-deep); }
.btn.ghost:hover { background: var(--accent-soft); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 32px 40px; align-items: start; margin-top: 44px;  /* both columns start at the sheet top, so switching tabs does not move the heading or the demo */ }
.hero-copy { display: grid; gap: 18px; align-content: start; }
.hero h1 em { font-style: normal; position: relative; display: inline-block;  /* one box: an inline one leaves an empty outlined fragment (and the handle) on the next line */ background: var(--accent-tint); outline: 2.5px solid var(--accent); outline-offset: 3px; }
.hero h1 em::after { content: ""; position: absolute; right: -9px; bottom: -9px; width: 9px; height: 9px; background: var(--accent); border: 2px solid var(--sheet); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.35); } }
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); } }

.demo { border: 1px solid var(--line); background: var(--sheet); min-width: 0; box-shadow: 6px 6px 0 var(--accent-soft); }
.demo-bar { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--grid); background: var(--head); flex-wrap: wrap; }
.demo-file { font: 500 12px var(--mono); color: var(--muted); }
.seg { margin-left: auto; display: inline-flex; border: 1px solid var(--line3); border-radius: 3px; overflow: hidden; background: var(--sheet); }
.seg button { border: 0; border-right: 1px solid var(--rule); background: transparent; padding: 4px 11px; font: 13px var(--body); color: var(--ink); }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--accent-soft); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .25); }
.demo-body { min-height: 300px; display: grid; }
.mode { display: grid; align-content: start; min-width: 0; animation: fadein .35s ease; }
@keyframes fadein { from { opacity: .3; transform: translateY(4px); } }
.xlwrap { overflow-x: auto; padding: 14px; }
table.xl { border-collapse: collapse; font: 13px var(--mono); font-variant-numeric: tabular-nums; width: 100%; }
table.xl th { background: var(--head); color: var(--faint); font-weight: 500; padding: 4px 8px; border: 1px solid var(--grid); text-align: center; }
table.xl td { border: 1px solid var(--grid); padding: 5px 9px; text-align: right; white-space: nowrap; }
table.xl td.t { text-align: left; font-family: var(--body); }
table.xl td.h { text-align: right; color: var(--muted); font-weight: 600; }
table.xl td.in { background: var(--in-bg); color: var(--in-ink); font-weight: 600; }
table.xl td.f { color: var(--f-ink); }
table.xl td.ov { position: relative; background: repeating-linear-gradient(135deg, var(--mark) 0 6px, transparent 6px 11px); color: var(--mark-ink); font-weight: 700; outline: 2px dashed var(--warn); outline-offset: -2px; animation: ants 1s linear infinite; }
@keyframes ants { 50% { outline-color: transparent; } }
.flag { margin: 0 14px 14px; padding: 10px 12px; border-left: 4px solid var(--warn); background: var(--warn-soft); font-size: 14.5px; }
.flag.ok { border-left-color: var(--accent); background: var(--accent-soft); }
pre.diffpre, pre.codepre { margin: 14px; background: var(--code-bg); color: var(--code-fg); font: 12.5px/1.65 var(--mono); padding: 12px 14px; overflow-x: auto; white-space: pre; }
pre.codepre.small { margin: 0; align-self: start; }
pre .dm { color: var(--code-dim); }
pre .hd { color: var(--code-hd); font-weight: 700; }
pre .kw { color: var(--code-kw); }
pre .add { color: #8fe0a9; }
pre .del { color: #ff9b8f; }

.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--grid); padding-top: 22px; gap: 24px; }
.stat { display: grid; gap: 4px; align-content: start; }
.stat b { font: 500 30px var(--mono); letter-spacing: -.04em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.stat span { font-size: 14px; color: var(--muted); max-width: 32ch; }
.foot { grid-column: 1 / -1; font: 12px var(--mono); color: var(--faint); margin-top: -18px; }
@media (max-width: 760px) { .stats { grid-template-columns: minmax(0, 1fr); } }

/* ---------- tools (the forms and results are driven by app.js) ---------- */
.sheettabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { border: 1px solid var(--grid); border-bottom: 0; background: var(--head); padding: 7px 16px; font: 14px var(--body); color: var(--muted); }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: inset 0 3px var(--accent); border-color: var(--line); margin-bottom: -1px; }
.toolbody { border: 1px solid var(--line); border-top: 0; padding: 20px; display: grid; gap: 14px; }
@media (max-width: 639px) { .toolbody { padding: 14px; } }
.panel { display: grid; gap: 12px; }
.hint { color: var(--muted); }
.drop { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 128px; padding: 16px; color: var(--muted);
        background: var(--paper); border: 2px dashed var(--line3); font: 14px var(--mono); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.drop.has-file { border: 2px solid var(--accent); color: var(--ink); background: var(--sheet); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .pair { grid-template-columns: 1fr; } }
.go { justify-self: start; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 2px; padding: 11px 22px; font: 600 15px var(--body); }
.go:hover { background: var(--accent-deep); }
.go:disabled { opacity: .6; cursor: progress; }
.meta { display: grid; gap: 4px; }
.quota, .privacy { color: var(--muted); font-size: 13.5px; }
.quota { font-family: var(--mono); color: var(--accent-deep); }
.result:empty { display: none; }
.result { display: grid; gap: 12px; min-width: 0; }
.result .summary { padding: 12px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.result .summary.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.result .error { color: var(--warn); font-weight: 600; }
.result table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.result th, .result td { text-align: left; padding: 6px 10px; border: 1px solid var(--grid); vertical-align: top; }
.result th { background: var(--head); font: 500 12px var(--mono); color: var(--muted); }
.result td code { word-break: break-word; }
.result pre { margin: 0; background: var(--code-bg); color: var(--code-fg); padding: 12px 14px; overflow: auto; max-height: 460px; font: 12.5px/1.6 var(--mono); }
.result details { border: 1px solid var(--grid); }
.result details > summary { padding: 8px 12px; background: var(--head); font-size: 14px; }
.result details pre { border-top: 1px solid var(--grid); }
.result .add { color: #8fe0a9; } .result .del { color: #ff9b8f; }
.copy { justify-self: end; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); border-radius: 2px; padding: 4px 12px; font: 13px var(--body); }

/* ---------- products ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { display: grid; gap: 12px; align-content: start; border: 1px solid var(--grid); padding: 18px; background: var(--sheet); min-width: 0; }
.card:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.card .cell { font: 500 11.5px var(--mono); color: var(--faint); }
.card p { font-size: 15px; }
.mini { display: flex; flex-wrap: wrap; gap: 0; font: 12px var(--mono); border: 1px solid var(--grid); }
.mini span { padding: 6px 8px; border-right: 1px solid var(--grid); white-space: nowrap; }
.mini span:last-child { border-right: 0; }
.m-f { color: var(--f-ink); }
.m-ov { background: repeating-linear-gradient(135deg, var(--mark) 0 6px, transparent 6px 11px); font-weight: 700; outline: 2px solid var(--warn); outline-offset: -2px; }
.m-code { background: var(--code-bg); color: var(--code-kw); }
.m-tok { color: var(--accent-deep); }
.diffmini { flex-direction: column; }
.diffmini span { border-right: 0; }
.diffmini .del { background: var(--del-bg); color: var(--del); }
.diffmini .add { background: var(--add-bg); color: var(--add); }
.how { font-size: 13.5px !important; color: var(--muted); border-top: 1px solid var(--grid); padding-top: 10px; }
.how code { color: var(--accent-deep); }

/* ---------- pricing as a sheet ---------- */
.pricewrap { overflow-x: auto; }
table.price { min-width: 720px; font-size: 13.5px; }
table.price td { text-align: left; font-family: var(--body); white-space: normal; vertical-align: top; }
table.price td.t { color: var(--muted); }
table.price tr.plan td { font: 700 16px var(--body); color: var(--ink); }
table.price tr.amt td { font: 500 22px var(--mono); letter-spacing: -.03em; color: var(--ink); }
table.price tr.amt td.t { font: 14px var(--body); letter-spacing: 0; color: var(--muted); }
table.price small { display: block; font: 12px var(--body); letter-spacing: 0; color: var(--muted); }
table.price .pro { background: var(--accent-tint); box-shadow: inset 2px 0 var(--accent), inset -2px 0 var(--accent); }
table.price thead th.pro { box-shadow: inset 2px 0 var(--accent), inset -2px 0 var(--accent), inset 0 2px var(--accent); color: var(--accent-deep); }
table.price tbody tr:last-child .pro { box-shadow: inset 2px 0 var(--accent), inset -2px 0 var(--accent), inset 0 -2px var(--accent); }
table.price .yes { color: var(--accent-deep); font-weight: 600; }
table.price .no { color: var(--faint); }

/* ---------- open format ---------- */
.format-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.format-grid .sec-head { margin: 0; gap: 14px; }
@media (max-width: 900px) { .format-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- product marks, product pages ---------- */
.pmark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 3px; font: 700 12px var(--mono); flex: none; }
.pmark.audit { background: var(--c-audit); color: #2b2300; }
.pmark.diffs { background: var(--c-diffs); color: #ffffff; }
.pmark.api { background: var(--c-api); color: #ffffff; }
.card .top { display: flex; align-items: center; gap: 12px; }
.card { position: relative; cursor: pointer; }
.card .open { font-weight: 600; text-decoration: none; }
.card .open::after { content: ""; position: absolute; inset: 0; }  /* the whole card opens the tool */
.card .open:hover { text-decoration: underline; }
body[data-brand="home"] .seg button[data-mode="audit"][aria-pressed="true"] { background: var(--c-audit); color: #2b2300; }
body[data-brand="home"] .seg button[data-mode="diff"][aria-pressed="true"] { background: var(--c-diffs); }
body[data-brand="home"] .seg button[data-mode="text"][aria-pressed="true"] { background: var(--c-api); }
.demo.solo .demo-body { min-height: 0; }
.how-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
@media (max-width: 900px) { .how-grid { grid-template-columns: minmax(0, 1fr); } }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; }
.steps li::before { content: counter(step); display: grid; place-items: center; height: 28px; border: 1px solid var(--line); background: var(--head); font: 500 12px var(--mono); color: var(--muted); }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: 15px; }
.how-grid pre.codepre { margin: 0; }
.others { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 700px) { .others { grid-template-columns: minmax(0, 1fr); } }
.other { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--grid); color: var(--ink); text-decoration: none; }
.other:hover { border-color: var(--line); background: var(--head); }
.other b { display: block; font-size: 16px; }
.other span { color: var(--muted); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  @view-transition { navigation: none; }
}

/* ---------- account and sign-in pages ---------- */
body.plain { padding: 74px 0 0;  /* title bar 38 + product ribbon 36 */ background: var(--sheet); }
body.plain .chrome { left: 0; }
.auth { max-width: 460px; margin: 48px auto; padding: 0 16px; }
.auth h1 { margin: 0 0 12px; }
.authform { display: grid; gap: 8px; margin: 16px 0; }
.authform input { padding: 9px 10px; border: 1px solid var(--line2); border-radius: 2px; font: inherit; }
.auth .err { color: #a33; }
.providers { display: grid; gap: 10px; margin: 20px 0 4px; }
.provider { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; border: 1px solid var(--line2);
  border-radius: 2px; background: var(--sheet); color: var(--ink); font-weight: 600; text-decoration: none; }
.provider:hover { background: var(--paper); border-color: var(--line3); }
.provider[hidden], .providers[hidden] { display: none; }
.or { display: flex; align-items: center; gap: 12px; margin: 8px 0 0; color: var(--faint); font-size: 13.5px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.authform label { font-size: 14px; color: var(--muted); }
.authform .btn { justify-content: center; }
.authlinks { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 4px 0 0; font-size: 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent-deep); text-decoration: underline; cursor: pointer; font: inherit; }
.gh.push { margin-left: auto; }  /* a class, since the CSP blocks inline style attributes */
.legal h2 { margin: 24px 0 8px; font-size: 18px; }
.legal { max-width: 640px; }
@media (max-width: 639px) {  /* the pricing table fits the screen instead of hiding the paid plans off to the right */
  .pricewrap { overflow-x: visible; }
  table.price { min-width: 0; table-layout: fixed; font-size: 12.5px; }
  table.price thead, table.price tbody th { display: none; }
  table.price td { padding: 5px 5px; overflow-wrap: anywhere; }
  table.price tr.plan td { font-size: 14px; }
  table.price tr.amt td { font-size: 17px; }
  table.price td.t { width: 22%; }
}
.status .legal-links { opacity: .85; }
.status .legal-links a { color: inherit; }
@media (max-width: 760px) { .status .legal-links { display: none; } }

/* ---------- theme toggle (theme.js adds the button to the title bar) ---------- */
.theme { background: transparent; display: inline-flex; align-items: center; padding: 3px 7px; line-height: 0; cursor: pointer; }
.theme.push { margin-left: auto; }

/* ---------- dark mode: follows the system, and the toggle sets data-theme to override it. The two blocks below are the same rules, once for each way of getting here. ---------- */
:root[data-theme="dark"] {
  --paper: #0f1512; --sheet: #161e19; --grid: #26322b; --gridbg: #1b2520; --line: #34443a; --rule: #2a362f; --line2: #3b4d42; --line3: #4a5f53; --colhd: #8da095;
  --ink: #e6eee9; --muted: #9fb2a8; --faint: #7f948a; --head: #1b2520;
  --accent: #107c41; --accent-deep: #6fd49a; --accent-hover: #0b5a2f; --accent-ink: #ffffff; --accent-soft: rgba(16, 124, 65, .28); --accent-text: #6fd49a;
  --accent-tint: rgba(16, 124, 65, .14); --accent-shadow: rgba(0, 0, 0, .55);
  --mark: #ffe36e; --mark-ink: #2b2300; --warn: #ff8a65; --warn-soft: #3a201a;
  --in-bg: #1c2d52; --in-ink: #9dbcff; --f-ink: #6fd49a;
  --code-bg: #0a100d; --add: #6fd49a; --add-bg: #14301f; --del: #ff9b8f; --del-bg: #3a1a17;
  color-scheme: dark;
}
:root[data-theme="dark"] body[data-brand="home"] { --accent: #2d3b33; --accent-deep: #e6eee9; --accent-hover: #3b4d42; --accent-ink: #ffffff; --accent-soft: rgba(230, 238, 233, .1); --accent-text: #e6eee9; --accent-tint: rgba(255, 255, 255, .05); --accent-shadow: rgba(0, 0, 0, .55); }
:root[data-theme="dark"] body[data-brand="audit"] { --accent: #f2b41c; --accent-deep: #f2b41c; --accent-hover: #d99a0b; --accent-ink: #2b2300; --accent-soft: rgba(242, 180, 28, .16); --accent-text: #f2b41c; --accent-tint: rgba(242, 180, 28, .1); --accent-shadow: rgba(0, 0, 0, .55); }
:root[data-theme="dark"] body[data-brand="diffs"] { --accent: #0f8a8f; --accent-deep: #4fd0d5; --accent-hover: #0a6669; --accent-ink: #ffffff; --accent-soft: rgba(15, 138, 143, .24); --accent-text: #4fd0d5; --accent-tint: rgba(15, 138, 143, .12); --accent-shadow: rgba(0, 0, 0, .55); }
:root[data-theme="dark"] body[data-brand="api"] { --accent: #6b3fc9; --accent-deep: #b79cf5; --accent-hover: #52309c; --accent-ink: #ffffff; --accent-soft: rgba(107, 63, 201, .26); --accent-text: #b79cf5; --accent-tint: rgba(107, 63, 201, .14); --accent-shadow: rgba(0, 0, 0, .55); }
:where(:root[data-theme="dark"]) a { color: var(--accent-text); }
:root[data-theme="dark"] .btn:not(.ghost):hover, :root[data-theme="dark"] .go:hover, :root[data-theme="dark"] .rtab.file:hover { background: var(--accent-hover); }
:root[data-theme="dark"] .logo.mark { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .7); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1512; --sheet: #161e19; --grid: #26322b; --gridbg: #1b2520; --line: #34443a; --rule: #2a362f; --line2: #3b4d42; --line3: #4a5f53; --colhd: #8da095;
    --ink: #e6eee9; --muted: #9fb2a8; --faint: #7f948a; --head: #1b2520;
    --accent: #107c41; --accent-deep: #6fd49a; --accent-hover: #0b5a2f; --accent-ink: #ffffff; --accent-soft: rgba(16, 124, 65, .28); --accent-text: #6fd49a;
    --accent-tint: rgba(16, 124, 65, .14); --accent-shadow: rgba(0, 0, 0, .55);
    --mark: #ffe36e; --mark-ink: #2b2300; --warn: #ff8a65; --warn-soft: #3a201a;
    --in-bg: #1c2d52; --in-ink: #9dbcff; --f-ink: #6fd49a;
    --code-bg: #0a100d; --add: #6fd49a; --add-bg: #14301f; --del: #ff9b8f; --del-bg: #3a1a17;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) body[data-brand="home"] { --accent: #2d3b33; --accent-deep: #e6eee9; --accent-hover: #3b4d42; --accent-ink: #ffffff; --accent-soft: rgba(230, 238, 233, .1); --accent-text: #e6eee9; --accent-tint: rgba(255, 255, 255, .05); --accent-shadow: rgba(0, 0, 0, .55); }
  :root:not([data-theme="light"]) body[data-brand="audit"] { --accent: #f2b41c; --accent-deep: #f2b41c; --accent-hover: #d99a0b; --accent-ink: #2b2300; --accent-soft: rgba(242, 180, 28, .16); --accent-text: #f2b41c; --accent-tint: rgba(242, 180, 28, .1); --accent-shadow: rgba(0, 0, 0, .55); }
  :root:not([data-theme="light"]) body[data-brand="diffs"] { --accent: #0f8a8f; --accent-deep: #4fd0d5; --accent-hover: #0a6669; --accent-ink: #ffffff; --accent-soft: rgba(15, 138, 143, .24); --accent-text: #4fd0d5; --accent-tint: rgba(15, 138, 143, .12); --accent-shadow: rgba(0, 0, 0, .55); }
  :root:not([data-theme="light"]) body[data-brand="api"] { --accent: #6b3fc9; --accent-deep: #b79cf5; --accent-hover: #52309c; --accent-ink: #ffffff; --accent-soft: rgba(107, 63, 201, .26); --accent-text: #b79cf5; --accent-tint: rgba(107, 63, 201, .14); --accent-shadow: rgba(0, 0, 0, .55); }
  :where(:root:not([data-theme="light"])) a { color: var(--accent-text); }
  :root:not([data-theme="light"]) .btn:not(.ghost):hover, :root:not([data-theme="light"]) .go:hover, :root:not([data-theme="light"]) .rtab.file:hover { background: var(--accent-hover); }
  :root:not([data-theme="light"]) .logo.mark { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .7); }
}

/* ---------- account: workspace, history, plan ---------- */
.acct { max-width: 760px; margin: 32px auto 96px; padding: 0 16px; }
.acct h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.02em; }
.acct h2 { margin: 28px 0 8px; font-size: 18px; }
.acct .lede { margin: 0 0 24px; color: var(--muted); }
.acct-top { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.acct-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.acct-nav button { border: 0; background: transparent; color: var(--muted); font: 500 15px var(--body); padding: 8px 14px; min-height: 44px; border-radius: 6px; cursor: pointer; }
.acct-nav button:hover { color: var(--ink); }
@media (max-width: 639px) { .acct-nav button { padding: 8px 10px; white-space: nowrap; } }
/* A new key or token is one long word: wrap it on a phone instead of widening the page. */
#ci-new-token, #api-new-key { white-space: pre-wrap; overflow-wrap: anywhere; }
#ci-snippet, #api-snippet { overflow-x: auto; max-width: 100%; }
.acct-nav button[aria-current="page"] { background: var(--head); color: var(--ink); }
.acct .who { margin: 0; color: var(--muted); font-size: 14px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--head); border-radius: 8px; margin-bottom: 18px; }
.seg .tab { border: 0; border-radius: 6px; background: transparent; padding: 8px 16px; min-height: 40px; margin: 0; cursor: pointer; }
.seg .tab.active { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); margin: 0; }
.acct .toolbody { border: 0; padding: 0; }
.acct .drop { min-height: 180px; border-radius: 12px; }
.runs { list-style: none; margin: 0 0 12px; padding: 0; border-top: 1px solid var(--rule); }
.runs li { padding: 14px 4px; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: center; }
.runs .main { flex: 1 1 260px; min-width: 0; }
.runs .main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.runs .note { margin: 2px 0 0; }
.runs .when { color: var(--muted); font-size: 14px; min-width: 84px; text-align: right; }
.runs .acts { display: flex; gap: 14px; opacity: 0; }
.runs li:hover .acts, .runs li:focus-within .acts { opacity: 1; }
@media (hover: none) { .runs .acts { opacity: 1; } }
.runs .dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px; background: var(--ink); }
.runs .dot.audit { background: #f2b41c; }
.runs .dot.diff { background: #0f8a8f; }
.runs .dot.llm { background: #6b3fc9; }
.runview { margin-top: 24px; }
.upgrade-top { padding: 6px 14px; margin-right: 10px; font-size: 14px; }

/* ---------- pricing cards (yearly/monthly switch in site.js) ---------- */
.plans { display: grid; gap: 20px; }
.billing { display: inline-flex; justify-self: start; gap: 2px; padding: 3px; background: var(--head); border: 1px solid var(--grid); border-radius: 8px; }
.billing button { border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: 500 14px var(--body); padding: 8px 16px; min-height: 40px; cursor: pointer; }
.billing button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.billing .save { font-size: 12px; font-weight: 600; color: var(--f-ink, #107c41); margin-left: 4px; }
.plan-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.plan-cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .plan-cards, .plan-cards.three { grid-template-columns: minmax(0, 1fr); } }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--sheet); }
.plan-card.rec { border: 2px solid var(--accent); }
.plan-card h3 { margin: 0; font-size: 18px; }
.plan-card .badge { position: absolute; top: -12px; left: 20px; margin: 0; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.plan-card .amount { margin: 0; font-size: 36px; font-weight: 700; letter-spacing: -.02em; }
.plan-card .amount small { font-size: 15px; font-weight: 500; color: var(--muted); }
.plan-card .per { margin: 0; color: var(--muted); font-size: 14px; }
.plan-card .btn { justify-content: center; border-radius: 8px; }
.plan-card .plus { margin: 4px 0 0; font-weight: 600; font-size: 14px; }
.plan-card ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14.5px; }
.faq { display: grid; gap: 0; border-top: 1px solid var(--grid); }
.faq details { border-bottom: 1px solid var(--grid); padding: 12px 2px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

/* ---------- account dashboard: sidebar, page header, cards ---------- */
.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; }
body.plain:has(.acct.wide) { background: var(--paper); }
.acct.wide { max-width: 1240px; margin: 0 auto; padding: 0; }
.dash { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.dash-side { position: sticky; top: 74px; align-self: start; height: calc(100vh - 74px); display: flex; flex-direction: column;
  justify-content: space-between; gap: 16px; padding: 24px 14px 18px; border-right: 1px solid var(--grid); background: var(--sheet); }
.dash-nav { display: flex; flex-direction: column; gap: 2px; }
.dash-nav button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border-radius: 8px; padding: 9px 12px; min-height: 40px;
  font: 500 14.5px var(--body); color: var(--muted); }
.dash-nav button svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dash-nav button:hover { background: var(--head); color: var(--ink); }
.dash-nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.dash-group { margin: 18px 12px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint, var(--muted)); }
.dash-user { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: center; padding: 14px 10px 0; border-top: 1px solid var(--grid); }
.dash-avatar { grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.dash-user-text { display: flex; flex-direction: column; min-width: 0; }
.dash-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.dash-plan { color: var(--muted); font-size: 12.5px; }
.dash-user .linkbtn { grid-column: 2; justify-self: start; font-size: 13px; color: var(--muted); }
.dash-main { padding: 32px 40px 96px; min-width: 0; }
.dash-main > section { max-width: 960px; }
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.dash-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.dash-head .lede { margin: 0; max-width: 640px; }
.dash-head .btn { border-radius: 8px; }
.dash-main h2 { margin: 32px 0 12px; font-size: 16px; }
.dcard { padding: 20px 22px; border: 1px solid var(--grid); border-radius: 12px; background: var(--sheet); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.dcard.flush { padding: 0; overflow: hidden; }
.dcard + .dcard { margin-top: 16px; }
.dcard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dcard-head h2 { margin: 0; font-size: 15px; }
.dcard-head a, .dcard-head .linkbtn { font-size: 13.5px; }
.dcard-empty { margin: 0; padding: 28px 20px; color: var(--muted); text-align: center; font-size: 14.5px; }
.dcard .seg { margin-bottom: 16px; }
.dcard.locked { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; background: var(--head); }
.dcard.locked p { margin: 0; max-width: 560px; }
.dcard.locked .btn { border-radius: 8px; }

/* overview */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--grid); border-radius: 12px; background: var(--sheet); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi-sub { color: var(--muted); font-size: 12.5px; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.dash-cols .dcard + .dcard { margin-top: 0; }
.activity { list-style: none; margin: 0 -22px -20px; padding: 0; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-top: 1px solid var(--grid); }
.activity .dot { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--ink); }
.activity .dot.audit { background: var(--c-audit); }
.activity .dot.diff { background: var(--c-diffs); }
.activity .dot.llm { background: var(--c-api); }
.activity .main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.activity .main b { font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity .main span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity .when { color: var(--muted); font-size: 13px; flex: none; }
.actions { display: grid; gap: 10px; }
.action { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--grid); border-radius: 10px; background: var(--sheet);
  color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.action:hover { border-color: var(--line); background: var(--head); }
.action .pmark { border-radius: 8px; }
.action b { display: block; font-size: 14.5px; font-weight: 600; }
.action span span { display: block; color: var(--muted); font-size: 13px; }

/* meters */
.meter { display: block; height: 6px; border-radius: 999px; background: var(--head); overflow: hidden; }
.meter.big { height: 10px; border: 1px solid var(--grid); }
.meter span { display: block; height: 100%; width: 0; background: var(--c-api); border-radius: inherit; transition: width .4s ease; }
.meter.full span { background: var(--warn); }
.usage-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 14px; }
.pill { padding: 3px 10px; border-radius: 999px; background: var(--head); border: 1px solid var(--grid); font-size: 12.5px; font-weight: 600; }
.pill.paid { background: var(--accent-soft); border-color: transparent; color: var(--accent-deep); }
.usage-num { color: var(--muted); font-size: 14.5px; }
.usage-num b { color: var(--ink); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.usage-foot { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

/* forms, secrets, key lists */
.inline-form { display: flex; gap: 8px; margin: 0 0 14px; }
.inline-form input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet);
  color: var(--ink); font: 15px var(--body); }
.inline-form input:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 0; border-color: transparent; }
.inline-form .btn { flex: none; border-radius: 8px; min-height: 44px; }
.secret { margin: 0 0 16px; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.secret p { margin: 0 0 10px; font-size: 14px; }
.secret-row { display: flex; gap: 10px; align-items: center; }
.secret code { flex: 1 1 auto; min-width: 0; padding: 8px 10px; border-radius: 6px; background: var(--sheet); font: 13.5px var(--mono); overflow-wrap: anywhere; white-space: pre-wrap; }
.secret .copy { flex: none; min-height: 36px; border-radius: 6px; cursor: pointer; }
.keys { list-style: none; margin: 0; padding: 0; }
.keys li { display: flex; align-items: center; gap: 8px 20px; padding: 14px 18px; border-top: 1px solid var(--grid); }
.keys li:first-child { border-top: 0; }
.keys .main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.keys .main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keys .main code { color: var(--muted); font: 13px var(--mono); }
.keys .meta { color: var(--muted); font-size: 13px; text-align: right; line-height: 1.45; }
.keys .del, .runs .del { color: var(--warn); }
.dcard.flush .runs { margin: 0; border-top: 0; }
.dcard.flush .runs li { padding: 14px 18px; border-bottom: 0; border-top: 1px solid var(--grid); }
.dcard.flush .runs li:first-child { border-top: 0; }
.btn.danger { color: var(--warn); border-color: var(--warn); border-radius: 8px; }
.btn.danger:hover { background: var(--warn-soft); }
pre.codepre.snippet { margin: 0; border-radius: 10px; }
.api-plans.one { grid-template-columns: minmax(0, 1fr); max-width: 380px; }
.buy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.buy-row .btn { flex: 1 1 auto; }
#view-plan .plan-cards { max-width: 760px; margin-bottom: 12px; }
.runview { margin-top: 16px; }

@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-side { position: static; height: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--grid); }
  .dash-nav { flex-direction: row; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .dash-nav button { width: auto; flex: none; white-space: nowrap; }
  .dash-group, .dash-user { display: none; }
  .dash-main { padding: 22px 16px 72px; }
  .dash-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .inline-form, .secret-row { flex-direction: column; align-items: stretch; }
  .inline-form .btn { justify-content: center; }
  .keys li { flex-wrap: wrap; }
  .keys .meta { text-align: left; flex: 1 1 auto; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
}
/* dashboard polish */
.dash { background: linear-gradient(to right, var(--sheet) 248px, transparent 248px); }
.dash-side { background: transparent; }
.kpi-value { font-variant-numeric: tabular-nums; }
.kpi .meter { margin: 2px 0; }
.usage-foot { margin-top: 12px; }
.dcard.usage .meter.big { margin-top: 4px; }
#api-upgrade .note, #upgrade .note { margin-top: 14px; }
@media (max-width: 900px) { .dash { background: none; } .dash-side { background: var(--sheet); } }
.dcard .seg { margin: 0 0 16px; justify-self: start; align-self: flex-start; width: fit-content; }
.acct.wide { max-width: none; }

/* API reference page and the hosted-or-open cards */
.pmark.fmt { background: var(--head); color: var(--ink); border: 1px solid var(--line); }
div.other { align-items: start; }
.docs h1 { font-size: clamp(30px, 4.4vw, 46px); }
.refdoc { display: grid; gap: 14px; max-width: 920px; min-width: 0; }
.refdoc h3 { font-size: 17px; letter-spacing: -.01em; margin-top: 10px; }
.refdoc p { margin: 0; color: var(--muted); font-size: 15px; }
.refdoc p b { color: var(--ink); }
.refdoc pre.codepre { margin: 0; overflow-x: auto; }
table.ref { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
table.ref th, table.ref td { border: 1px solid var(--grid); padding: 7px 10px; text-align: left; vertical-align: top; }
table.ref th { background: var(--head); color: var(--muted); font-weight: 500; }
.brief { display: grid; gap: 8px; margin-top: 12px; }
.brief .copy { justify-self: start; }

/* /teams: plan cards inside a plain page */
.teams .plan-cards { margin: 2.25rem 0 1.75rem; }
.teams p + p { margin-top: .75rem; }
