/* ==========================================================================
   OpenGray design system
   Typography follows the Segoe UI document stack; surfaces stay flat with
   hairline rules so dense billing and usage tables read cleanly.
   ========================================================================== */

:root {
  --font-sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI", -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SF Mono", "Liberation Mono", Menlo, monospace;

  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --bg-inset: #eef0f4;
  --surface: #ffffff;
  --border: #e1e4ea;
  --border-strong: #c8ced8;
  --ink: #16181d;
  --ink-soft: #454c59;
  --ink-muted: #6c7482;
  --accent: #5b3ff0;
  --accent-hover: #4a30d8;
  --accent-ink: #ffffff;
  --accent-soft: #f2eefe;
  --accent-border: #d9cffb;
  --link: #2c62d0;
  --success: #12734a;
  --success-soft: #e8f5ee;
  --warn: #8a5300;
  --warn-soft: #fdf3e3;
  --danger: #b62439;
  --danger-soft: #fdeef0;
  --focus: #9c85ff;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 18, 27, .06);
  --shadow: 0 2px 8px rgba(16, 18, 27, .08);
  --shadow-lg: 0 12px 32px rgba(16, 18, 27, .12);
  --header-h: 56px;
}

[data-theme="dark"] {
  --bg: #15171c;
  --bg-subtle: #1b1e24;
  --bg-inset: #22262e;
  --surface: #1b1e24;
  --border: #2c313a;
  --border-strong: #3d434f;
  --ink: #e9ebef;
  --ink-soft: #b6bcc8;
  --ink-muted: #8b93a1;
  --accent: #8b74ff;
  --accent-hover: #9d8aff;
  --accent-ink: #14121f;
  --accent-soft: #241f3d;
  --accent-border: #3b3168;
  --link: #7fa8f5;
  --success: #4ac088;
  --success-soft: #16281f;
  --warn: #e0a44a;
  --warn-soft: #2a2113;
  --danger: #f2788b;
  --danger-soft: #2c1a1f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.011em;
  color: var(--ink);
  margin: 0 0 .5em;
  line-height: 1.25;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: .8125rem; }
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

code, kbd, pre, .mono, .num {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.num { font-variant-numeric: tabular-nums; }

code {
  font-size: .875em;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .1em .35em;
}

pre {
  margin: 0;
  font-size: .8125rem;
  line-height: 1.6;
  overflow-x: auto;
}

pre code { background: none; border: 0; padding: 0; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection { background: var(--accent-soft); color: var(--ink); }

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 860px; }
.section { padding: 72px 0; }
.section-sm { padding: 44px 0; }
.section-tint { background: var(--bg-subtle); border-block: 1px solid var(--border); }

.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.row-wrap { flex-wrap: wrap; }
.push { margin-left: auto; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.eyebrow {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 .75rem;
}

.lead { font-size: 1.0625rem; color: var(--ink-soft); }
.muted { color: var(--ink-muted); }
.soft { color: var(--ink-soft); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.section-head { max-width: 640px; margin-bottom: 32px; }
.section-head.center { margin-inline: auto; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 100%; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
  flex: none;
}
.brand:hover { text-decoration: none; }
.brand img { width: 24px; height: 24px; display: block; }
.brand-sub { color: var(--ink-muted); font-weight: 400; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  padding: 6px 10px;
  border-radius: var(--r);
  color: var(--ink-soft);
  font-size: .875rem;
  font-weight: 500;
}
.nav a:hover { background: var(--bg-inset); color: var(--ink); text-decoration: none; }
.nav a.is-active { color: var(--ink); background: var(--bg-inset); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--bg-inset); color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle { display: none; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn:hover { background: var(--bg-inset); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg-inset); color: var(--ink); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-lg { height: 40px; padding: 0 20px; font-size: .9375rem; }
.btn-sm { height: 28px; padding: 0 10px; font-size: .8125rem; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   Cards, panels, tables
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card-hover { transition: border-color .12s ease, box-shadow .12s ease; }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: .9375rem; }
.panel-body { padding: 18px; }
.panel-body + .panel-body { border-top: 1px solid var(--border); }
.panel-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: .8125rem;
  color: var(--ink-muted);
}

.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
table.data th {
  text-align: left;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  white-space: nowrap;
}
table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--bg-subtle); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-muted);
}
.empty h3 { color: var(--ink-soft); }

/* --------------------------------------------------------------------------
   Badges, pills, alerts
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  font-size: .75rem;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.badge-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); color: var(--success); }
.badge-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); color: var(--warn); }
.badge-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); color: var(--danger); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--r);
  background: var(--bg-subtle);
  font-size: .875rem;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, var(--border)); border-left-color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); border-left-color: var(--danger); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, var(--border)); border-left-color: var(--warn); }
.alert-info { border-left-color: var(--accent); }
.alert p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label, .label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field-hint { font-size: .75rem; color: var(--ink-muted); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: .9375rem;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  outline-offset: 0;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--ink-muted); }
.input-mono { font-family: var(--font-mono); font-size: .8125rem; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236c7482' d='M4.2 6.2 8 10l3.8-3.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 30px;
}

.checkline { display: flex; align-items: flex-start; gap: 9px; font-size: .875rem; color: var(--ink-soft); }
.checkline input { margin-top: 3px; }

.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* --------------------------------------------------------------------------
   Auth screens
   -------------------------------------------------------------------------- */
.auth-shell {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-aside {
  border-left: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-points { list-style: none; margin: 0; padding: 0; }
.auth-points li { display: flex; gap: 10px; padding: 10px 0; font-size: .9375rem; color: var(--ink-soft); }
.auth-points svg { width: 17px; height: 17px; flex: none; margin-top: 3px; color: var(--accent); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-muted); font-size: .75rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* --------------------------------------------------------------------------
   Hero and marketing
   -------------------------------------------------------------------------- */
.hero { padding: 88px 0 64px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px; align-items: center; }
.hero h1 { font-size: 3rem; line-height: 1.08; letter-spacing: -.03em; margin-bottom: 18px; }
.hero p.lead { font-size: 1.125rem; max-width: 34em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.hero-note { margin-top: 18px; font-size: .8125rem; color: var(--ink-muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: .8125rem;
  color: var(--ink-soft);
  margin-bottom: 20px;
}
.chip b { color: var(--ink); font-weight: 600; }
.chip .badge { padding: 1px 7px; font-size: .6875rem; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}
.stat-strip > div { padding: 16px 18px; border-right: 1px solid var(--border); }
.stat-strip > div:last-child { border-right: 0; }
.stat-value { font-family: var(--font-display); font-size: 1.375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .75rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .06em; }

.feature { padding: 0; }
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--accent-border);
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
}
.feature-icon svg { width: 17px; height: 17px; }
.feature h3 { font-size: .9375rem; margin-bottom: .35em; }
.feature p { font-size: .875rem; color: var(--ink-soft); margin: 0; }

/* --------------------------------------------------------------------------
   Code sample
   -------------------------------------------------------------------------- */
.code-window {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.code-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.code-tab {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: .8125rem;
  color: var(--ink-muted);
  cursor: pointer;
}
.code-tab:hover { color: var(--ink); background: var(--bg-inset); }
.code-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.code-body { padding: 16px 18px; background: var(--surface); }
.code-body pre { color: var(--ink-soft); }
.code-body .k { color: #a03cb8; }
.code-body .s { color: #0a6b4f; }
.code-body .c { color: var(--ink-muted); font-style: italic; }
.code-body .n { color: #1d5cc0; }
[data-theme="dark"] .code-body .k { color: #d8a0ff; }
[data-theme="dark"] .code-body .s { color: #7fdcb4; }
[data-theme="dark"] .code-body .n { color: #8fb8ff; }
.code-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: .75rem;
  color: var(--ink-muted);
}

.copy-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 3px 9px;
  font-family: inherit;
  font-size: .75rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.copy-btn:hover { background: var(--bg-inset); color: var(--ink); }

/* --------------------------------------------------------------------------
   Model cards
   -------------------------------------------------------------------------- */
.model-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.model-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.model-top { display: flex; align-items: flex-start; gap: 12px; }
.model-logo {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-subtle);
}
.model-logo img { width: 19px; height: 19px; opacity: .88; }
[data-theme="dark"] .model-logo img { filter: invert(1) brightness(1.6); }
.model-title { margin: 0; font-size: 1rem; }
.model-title a { color: var(--ink); }
.model-vendor { font-size: .75rem; color: var(--ink-muted); }
.model-desc { font-size: .875rem; color: var(--ink-soft); margin: 0; }
.model-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.model-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-top: auto;
}
.model-prices > div { background: var(--surface); padding: 10px 12px; }
.model-prices dt { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin: 0 0 2px; }
.model-prices dd { margin: 0; font-family: var(--font-mono); font-size: .8125rem; font-weight: 600; }
.model-prices dd span { font-weight: 400; color: var(--ink-muted); font-size: .75rem; }

/* --------------------------------------------------------------------------
   Pricing
   -------------------------------------------------------------------------- */
.pack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.pack.is-popular { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pack-flag {
  position: absolute;
  top: -10px;
  right: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
}
.pack-price { font-family: var(--font-display); font-size: 2.25rem; font-weight: 600; line-height: 1; letter-spacing: -.03em; }
.pack-price sup { font-size: 1rem; font-weight: 500; top: -1em; margin-right: 2px; }
.pack-credits { font-size: .9375rem; color: var(--ink-soft); }
.pack ul { list-style: none; margin: 0; padding: 0; font-size: .875rem; color: var(--ink-soft); }
.pack ul li { padding: 4px 0 4px 20px; position: relative; }
.pack ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 11px;
  width: 9px;
  height: 5px;
  border-left: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(-45deg);
}

.rate-table td.rate { font-family: var(--font-mono); font-size: .8125rem; }

/* --------------------------------------------------------------------------
   Document sheet (docs and legal pages, Word-style page)
   -------------------------------------------------------------------------- */
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.doc-nav { position: sticky; top: calc(var(--header-h) + 24px); font-size: .875rem; }
.doc-nav p { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 18px 0 6px; }
.doc-nav a { display: block; padding: 5px 10px; border-radius: var(--r-sm); color: var(--ink-soft); }
.doc-nav a:hover { background: var(--bg-inset); color: var(--ink); text-decoration: none; }
.doc-nav a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 56px 64px;
  max-width: 780px;
}
.sheet h1 { font-size: 1.75rem; padding-bottom: .4em; border-bottom: 1px solid var(--border); }
.sheet h2 { font-size: 1.1875rem; margin-top: 2em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.sheet h3 { font-size: 1rem; margin-top: 1.6em; }
.sheet p, .sheet li { color: var(--ink-soft); }
.sheet ul, .sheet ol { padding-left: 22px; margin: 0 0 1em; }
.sheet li { margin-bottom: .35em; }
.sheet table.data { margin: 1em 0; border: 1px solid var(--border); }
.sheet .code-window { margin: 1.25em 0; }
.doc-updated { font-size: .8125rem; color: var(--ink-muted); margin-bottom: 2em; }

/* --------------------------------------------------------------------------
   App shell (dashboard and admin)
   -------------------------------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.app-side {
  border-right: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 22px 14px;
}
.app-side-inner { position: sticky; top: calc(var(--header-h) + 22px); }
.side-group + .side-group { margin-top: 22px; }
.side-group p {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 6px 10px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r);
  font-size: .875rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.side-link:hover { background: var(--bg-inset); color: var(--ink); text-decoration: none; }
.side-link.is-active { background: var(--surface); border: 1px solid var(--border); color: var(--ink); box-shadow: var(--shadow-sm); }
.side-link svg { width: 16px; height: 16px; flex: none; color: var(--ink-muted); }
.side-link.is-active svg { color: var(--accent); }
.side-link .push { font-size: .75rem; color: var(--ink-muted); font-weight: 400; }

.app-main { padding: 28px 32px 64px; min-width: 0; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 1.5rem; margin-bottom: .25em; }
.page-head p { color: var(--ink-muted); font-size: .9375rem; margin: 0; }

.metric {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.metric-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-bottom: 6px; }
.metric-value { font-family: var(--font-display); font-size: 1.625rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-sub { font-size: .8125rem; color: var(--ink-muted); margin-top: 4px; }

.balance-card {
  border: 1px solid var(--accent-border);
  background: linear-gradient(140deg, var(--accent-soft), var(--surface) 70%);
  border-radius: var(--r-lg);
  padding: 20px;
}
.balance-value { font-family: var(--font-display); font-size: 2.125rem; font-weight: 600; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bars > div { flex: 1; background: var(--accent-soft); border: 1px solid var(--accent-border); border-bottom: 0; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars > div:hover { background: var(--accent); }
.bars-axis { display: flex; justify-content: space-between; font-size: .6875rem; color: var(--ink-muted); margin-top: 6px; }

.key-reveal {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border: 1px dashed var(--accent-border);
  background: var(--accent-soft);
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: .8125rem;
  word-break: break-all;
}

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tabs a {
  padding: 8px 12px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 16px; font-size: .8125rem; }

/* Playground */
.pg-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.pg-output {
  min-height: 220px;
  max-height: 460px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: .8125rem;
  white-space: pre-wrap;
  line-height: 1.6;
}
.pg-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .75rem; color: var(--ink-muted); margin-top: 10px; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-subtle); padding: 48px 0 32px; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.footer-col h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); margin-bottom: 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 7px; }
.footer-col a { font-size: .875rem; color: var(--ink-soft); }
.footer-col a:hover { color: var(--ink); }
.footer-about p { font-size: .875rem; color: var(--ink-muted); max-width: 34ch; }
.footer-contact { font-size: .8125rem; color: var(--ink-muted); font-style: normal; line-height: 1.7; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 36px;
  padding-top: 20px;
  font-size: .8125rem;
  color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   Error pages
   -------------------------------------------------------------------------- */
.page-error { display: grid; place-items: center; min-height: 100vh; }
.error-shell { text-align: center; padding: 40px 24px; max-width: 520px; }
.error-code { font-family: var(--font-display); font-size: 4rem; font-weight: 600; color: var(--ink-muted); margin: 0; line-height: 1; }
.error-detail {
  text-align: left;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  font-size: .75rem;
  white-space: pre-wrap;
  margin: 20px 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 12px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1040px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
  .doc-nav p { width: 100%; margin: 8px 0 2px; }
  .pg-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .app-side { border-right: 0; border-bottom: 1px solid var(--border); padding: 14px; }
  .app-side-inner { position: static; }
  .side-group { display: flex; flex-wrap: wrap; gap: 4px; }
  .side-group p { width: 100%; margin-left: 4px; }
  .app-main { padding: 22px 18px 48px; }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    margin-left: auto;
  }
  .nav-toggle svg { width: 17px; height: 17px; }
  .site-header .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .site-header.is-open .nav { display: flex; }
  .site-header .nav a { padding: 10px 12px; }
  .header-actions { margin-left: 0; }
  .hero { padding: 56px 0 40px; }
  .hero h1 { font-size: 2.125rem; }
  .section { padding: 48px 0; }
  .sheet { padding: 28px 22px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .wrap { padding: 0 18px; }
}

@media print {
  .site-header, .site-footer, .doc-nav, .btn { display: none !important; }
  .sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
  body { font-size: 11pt; }
}
