/* Factwire account pages, in the design language of factwire.dev
   (factwire/site/index.html): white page, near-black ink, hairline rules,
   square corners, no shadows; Newsreader for reading, Hanken Grotesk for
   headings and controls, Geist Mono for code; one blue accent for links. */
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(newsreader-latin.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 400 500; font-display: swap; src: url(hanken-grotesk-latin.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(geist-mono-latin.woff2) format('woff2'); }

:root {
  --bg: #FFFFFF; --fg: #111113; --muted: #6B6B66; --line: #E6E5E3; --line-soft: #EFEEEC;
  --accent: #1A44E0; --wash: rgba(32, 32, 32, 0.03); --hover: rgba(32, 32, 32, 0.05); --current: rgba(32, 32, 32, 0.08); --bad: #B42318; --bad-wash: rgba(180, 35, 24, 0.06); --ink-hover: #2E2E33;
  --sans: Newsreader, Georgia, serif;
  --tight: 'Hanken Grotesk', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header: the site's mobile bar. */
header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font: 15px/1.5 var(--tight); text-decoration: none; }
.brand .mark { width: 16px; height: 16px; }
.who { display: flex; align-items: center; gap: 16px; font: 13px/1.5 var(--tight); color: var(--muted); }
.who form { margin: 0; }

/* Page: one column. */
main { flex: 1; width: 100%; max-width: 780px; margin: 0 auto; padding: 36px 24px 24px; }
main.narrow { max-width: 480px; padding-left: 24px; }

/* Signed in: the app shell of Saldo's app. No top bar: the brand, the
   account navigation and the account sit in a sidebar on the left, on the
   page's own surface with no rule beside it; the page and the footer take
   the rest. Rows are 36px with an 18px icon; hover and the current page are
   a soft fill. The page sits in a frame of one width, left-aligned in it,
   so a click between pages moves nothing. */
.app { flex: 1; display: flex; min-height: 100vh; }
.side { position: sticky; top: 0; flex: none; display: flex; flex-direction: column; width: 232px; height: 100vh; padding: 12px; font: 14px/20px var(--tight); }
.side .brand { height: 36px; padding: 0 8px; margin-bottom: 20px; }
.side .brand .mark { width: 20px; height: 20px; }
.side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side nav a, .side-foot button.plain { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; height: 36px; padding: 0 8px; color: var(--muted); text-decoration: none; }
.side nav a:hover, .side-foot button.plain:hover { background: var(--hover); color: var(--fg); }
.side nav a[aria-current] { background: var(--current); color: var(--fg); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; }
.side-foot .email { padding: 0 8px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.side-foot form { margin: 0; }
.side-foot button.plain { font: inherit; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.frame { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1020px; margin: 0 auto; }
.frame main { flex: 1; margin: 0; padding: 56px 48px 72px; }
.frame footer { border: 0; padding: 0 48px 32px; text-align: left; }
.frame footer a:hover { background: none; color: var(--fg); }

/* The page's sections: no box, a hairline above, a quiet title and its
   line of help, the content below. The signed-out pages keep their card. */
.frame h1 { font-size: 32px; line-height: 1.15; margin-bottom: 10px; }
.frame .lede { margin-bottom: 48px; color: var(--muted); }
.frame .card { border: 0; border-top: 1px solid var(--line); padding: 24px 0 0; margin: 0 0 56px; }
.frame .card h2 { font: 500 15px/1.4 var(--tight); letter-spacing: 0; }
.frame .card > h2 + .small, .frame .card > h2 + .spaced, .frame .card-head .small { margin: 4px 0 0; }
.frame .card-head { display: block; }

h1 { margin: 0 0 12px; font: 400 36px/1.1 var(--tight); letter-spacing: -0.02em; }
h1.h-sm { font-size: 28px; }
h2 { margin: 0 0 4px; font: 400 20px/1.3 var(--tight); letter-spacing: -0.01em; }
h3.label { margin: 24px 0 8px; font: 500 13px/1.5 var(--tight); color: var(--muted); }
p { margin: 0 0 16px; }
.lede { margin-bottom: 28px; max-width: 560px; }
.muted { color: var(--muted); }
.small { font: 13px/1.5 var(--tight); color: var(--muted); }
.card > h2 + .small { margin: 0; }
.center { text-align: center; }
.spaced { margin-top: 20px; }

.card { position: relative; border: 1px solid var(--line); padding: 24px; margin-bottom: 20px; background: var(--bg); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .small { margin: 0; }
h2.ruled { padding-bottom: 16px; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.frame h2.ruled { padding: 0; border: 0; }
.card > :last-child { margin-bottom: 0; }

/* Buttons: the site's, square; filled ink or a ruled outline that fills on hover. */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 12px; border: 1px solid var(--fg); border-radius: 0; cursor: pointer;
  font: 15px/1.3 var(--tight); text-decoration: none; background: var(--fg); color: var(--bg);
}
button:hover, .button:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: var(--bg); }
button:active, .button:active { background: #000; }
.big { height: 48px; padding: 0 18px; font-size: 16px; }
.wide { width: 100%; }
.button.connect, button.secondary, .button.secondary { background: var(--bg); color: var(--fg); border-color: var(--line); }
.button.connect:hover, button.secondary:hover, .button.secondary:hover { background: var(--bg); border-color: var(--fg); color: var(--fg); }
.button.connect:active, button.secondary:active, .button.secondary:active { background: var(--wash); }
.button.connect { justify-content: flex-start; gap: 12px; height: 52px; padding: 0 16px; font-size: 15px; }
.icon { width: 18px; height: 18px; flex: none; }
.big .icon { width: 20px; height: 20px; }
button.plain { height: auto; padding: 0; border: 0; background: none; color: var(--fg); font: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
button.plain:hover { background: none; color: var(--accent); }
button.danger { height: 30px; padding: 0 10px; background: none; color: var(--muted); border-color: transparent; font-size: 13px; }
button.danger:hover { color: var(--bad); border-color: transparent; background: var(--bad-wash); }
button.danger:active { background: var(--bad-wash); }

.create-key { display: flex; align-items: flex-end; gap: 12px; margin: 20px 0 0; }
.create-key .grow { flex: 1; min-width: 0; }
.create-key button { height: 44px; }
.add { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0 0; }

/* Fields. */
label { display: block; margin: 0 0 6px; font: 13px/1.5 var(--tight); color: var(--muted); }
input[type=email], input[type=text] {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 0;
  font: 16px var(--tight); color: var(--fg); background: var(--bg); outline: none;
}
input:focus { border-color: var(--fg); }
input.code { height: 56px; font: 26px var(--mono); letter-spacing: 0.4em; text-align: center; padding-left: 0.4em; }
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code-boxes input[type=text] { height: 56px; padding: 0; font: 26px var(--mono); text-align: center; }
.stack > * + * { margin-top: 12px; }
.error { margin: 0; font: 13px/1.5 var(--tight); color: var(--bad); }

/* Balance: one big figure, then the packs as the site's plans strip. */
.balance { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 20px 0 0; }
.balance .small { margin-top: 8px; }
.balance .pace { text-align: right; }
.figure { font: 400 56px/1 var(--tight); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.more { margin: 0; padding-top: 16px; }
.buy { margin: 0; }
.packs { margin: 28px 0 0; padding: 24px 0 0; border: 0; border-top: 1px solid var(--line-soft); min-width: 0; }
/* A floated legend sits in the flow, so its margin holds. */
.packs legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font: 500 14px/1.5 var(--tight); }
.pack-grid { clear: both; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pack { position: relative; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 14px; border: 1px solid var(--line); cursor: pointer; color: var(--fg); }
.pack:hover { border-color: var(--muted); }
.pack:has(input:checked) { border-color: var(--fg); background: var(--wash); }
.pack:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pack input { position: absolute; opacity: 0; pointer-events: none; }
.pack .credits { font: 400 20px/1.3 var(--tight); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pack .price { font: 12px/1.5 var(--tight); color: var(--muted); font-variant-numeric: tabular-nums; }
.checkout { display: flex; align-items: center; gap: 16px; padding: 24px 0 0; }
.checkout .what { flex: 1; font: 13px/1.5 var(--tight); color: var(--muted); }
.checkout .what strong { display: block; font: 500 17px/1.4 var(--tight); letter-spacing: -0.01em; color: var(--fg); }
.checkout button { min-width: 140px; }

/* Rows, as the site's rules. */
.list { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.frame .list { margin-top: 16px; border-top: 0; }
.frame .list li { gap: 14px; padding: 14px 0; border-bottom: 0; }
.frame .list li + li { border-top: 1px solid var(--line-soft); }
.frame .list form { margin-right: -10px; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font: 15px/1.5 var(--tight); }
.list form { margin: 0; }
h2.ruled + .list { margin-top: 0; border-top: 0; }
.appicon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); flex: none; }
.frame .appicon { border-color: var(--line-soft); }
.appicon .icon { width: 16px; height: 16px; }
.glyph { font: 16px var(--tight); color: var(--muted); }

/* Inference usage (/inference/account): a period switch, figures, a bar chart
   (inline SVG: the CSP allows no inline style) and ruled tables. */
.periods { display: flex; gap: 2px; margin: -24px 0 32px; width: fit-content; }
.periods a { padding: 5px 10px; font: 13px/1.5 var(--tight); color: var(--muted); text-decoration: none; }
.periods a:hover { background: var(--hover); color: var(--fg); }
.periods a[aria-current] { background: var(--current); color: var(--fg); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line-soft); }
.stats div { margin: 0; }
.stats dt { font: 13px/1.5 var(--tight); color: var(--muted); }
.stats dd { margin: 2px 0 0; font: 400 17px/1.3 var(--tight); font-variant-numeric: tabular-nums; }
.chart { margin: 20px 0 0; }
.chart svg { display: block; width: 100%; height: 160px; }
.chart rect { fill: var(--fg); }
.chart rect:hover { fill: var(--accent); }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart-max { margin: 0 0 4px; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; }
.chart + details { margin-top: 16px; }
.table { width: 100%; border-collapse: collapse; margin: 16px 0 0; font: 13px/1.5 var(--tight); }
.table th, .table td { padding: 10px 12px 10px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); font-weight: 400; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table thead th { border-bottom-color: var(--line); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table thead th { color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow-x: auto; }
.mono { font-family: var(--mono); font-size: 11px; }
.tag { display: inline-block; padding: 0 6px; border: 1px solid var(--line); font: 11px/1.6 var(--tight); color: var(--muted); }
.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; }

/* Notices and code. */
.notice { padding: 14px 16px; margin: 16px 0; background: var(--wash); font: 14px/1.5 var(--tight); }
.notice strong { font-weight: 500; }
.secret { display: block; margin: 8px 0; padding: 10px 12px; background: var(--wash); font: 13px/1.6 var(--mono); word-break: break-all; user-select: all; }
code { font: 13px var(--mono); }
pre { margin: 0 0 16px; padding: 12px; background: var(--wash); font: 13px/1.7 var(--mono); overflow-x: auto; }
.notice .secret { background: var(--bg); border: 1px solid var(--line); }
.secret-row { display: flex; align-items: stretch; gap: 8px; margin-top: 10px; }
.secret-row .secret { flex: 1; min-width: 0; margin: 0; }
.secret-row button { height: auto; flex: none; }
.hint { display: none; }
.hint.show { display: block; }

/* For developers: a disclosure, as the site's FAQ. */
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2 { margin: 0; }
details > summary::after { content: '+'; font: 20px/1 var(--tight); color: var(--muted); }
details[open] > summary::after { content: '−'; }
details[open] > summary { margin-bottom: 12px; }

/* Consent: two marks, joined. */
.pair { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 20px; }
.pair .appicon { width: 56px; height: 56px; }
.pair .appicon .icon, .pair .appicon .mark { width: 28px; height: 28px; }
.dots { font: 13px var(--mono); color: var(--muted); letter-spacing: 2px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); opacity: 0; transition: opacity 0.2s, transform 0.2s;
  padding: 10px 14px; background: var(--fg); color: var(--bg); font: 14px/1.4 var(--tight); max-width: min(520px, 90vw); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Footer: the site's mono links. */
footer { border-top: 1px solid var(--line); padding: 16px 24px; text-align: center; font: 12px/1.3 var(--mono); color: var(--muted); }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { background: var(--accent); color: var(--bg); }

@media (max-width: 720px) {
  main, .frame main { padding: 32px 20px 56px; }
  .frame footer { padding: 0 20px 24px; }
  .frame .lede { margin-bottom: 32px; }
  .frame .card { margin-bottom: 44px; }
  /* The sidebar becomes a bar: the brand and Sign out, the pages below. */
  .app { flex-direction: column; }
  .side { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; width: auto; height: auto; padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .side .brand { margin: 0; }
  .side nav { order: 2; flex-basis: 100%; overflow-x: auto; padding-top: 4px; }
  .side ul { flex-direction: row; }
  .side nav a { white-space: nowrap; }
  .side-foot { order: 1; margin: 0 0 0 auto; padding: 0; }
  .side-foot .email { display: none; }
  .add { grid-template-columns: 1fr; }
  .create-key { flex-direction: column; align-items: stretch; }
  .pack-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .figure { font-size: 44px; }
  .balance { flex-direction: column; align-items: flex-start; gap: 4px; }
  .balance .pace { text-align: left; }
  .checkout { flex-wrap: wrap; }
  .checkout .what { flex-basis: 100%; }
  .checkout button { width: 100%; }
  h1, .frame h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; transform: translate(-50%, 0); }
}
