/* MD3 components, hand-built (no JS framework, no CDN scripts). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--md-sys-color-surface); color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-font); font-size: 16px; line-height: 1.5;
}
a { color: var(--md-sys-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--md-sys-typescale-mono); font-size: .9em; }
pre {
  background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface);
  padding: calc(var(--sp)*4); border-radius: var(--md-sys-shape-md); overflow-x: auto; line-height: 1.45;
}
code:not(pre code) { background: var(--md-sys-color-surface-container-high); padding: 1px 6px; border-radius: var(--md-sys-shape-xs); }
img, svg { max-width: 100%; }
/* type scale */
.display-lg { font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.1; font-weight: 500; letter-spacing: -.02em; margin: 0 0 calc(var(--sp)*4); }
.headline-lg { font-size: 2rem; line-height: 1.25; font-weight: 500; margin: 0 0 calc(var(--sp)*3); }
.headline-md { font-size: 1.75rem; line-height: 1.3; font-weight: 500; margin: 0 0 calc(var(--sp)*3); }
.headline-sm { font-size: 1.5rem; line-height: 1.3; font-weight: 500; margin: 0 0 calc(var(--sp)*2); }
.title-lg { font-size: 1.375rem; font-weight: 500; margin: 0 0 var(--sp); }
.title-md { font-size: 1rem; font-weight: 500; letter-spacing: .01em; margin: 0 0 var(--sp); }
.body-lg { font-size: 1.0625rem; }
.body-md { font-size: .9375rem; }
.label-md { font-size: .75rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant); }
.muted { color: var(--md-sys-color-on-surface-variant); }
/* layout */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.section { padding: calc(var(--sp)*12) 0; }
.grid { display: grid; gap: calc(var(--sp)*4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: calc(var(--sp)*3); align-items: center; }
.stack > * + * { margin-top: calc(var(--sp)*4); }
/* material symbols */
.material-symbols-outlined { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; font-size: 24px;
  line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr;
  vertical-align: middle; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; }
.icon-sm { font-size: 18px; }
/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 24px; border-radius: 20px;
  border: none; font: inherit; font-weight: 500; font-size: .9375rem; cursor: pointer; text-decoration: none !important;
  transition: box-shadow .15s, background .15s; white-space: nowrap; }
.btn:focus-visible { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; }
.btn-filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.btn-filled:hover { box-shadow: var(--md-sys-elevation-1); filter: brightness(1.08); }
.btn-tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn-outlined { background: transparent; color: var(--md-sys-color-primary); border: 1px solid var(--md-sys-color-outline); }
.btn-text { background: transparent; color: var(--md-sys-color-primary); padding: 0 12px; }
.btn-danger { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.btn[disabled] { opacity: .38; cursor: default; }
/* cards */
.card { background: var(--md-sys-color-surface-container-low); border-radius: var(--md-sys-shape-md); padding: calc(var(--sp)*5); }
.card-outlined { background: var(--md-sys-color-surface); border: 1px solid var(--md-sys-color-outline-variant); }
.card-elevated { background: var(--md-sys-color-surface-container-lowest); box-shadow: var(--md-sys-elevation-1); }
.card-filled { background: var(--md-sys-color-surface-container-highest); }
/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline); font-size: .875rem; font-weight: 500; cursor: pointer; background: transparent; color: inherit; }
.chip.selected, .chip:has(input:checked) { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border-color: transparent; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip-set { display: flex; flex-wrap: wrap; gap: 8px; }
/* text fields (outlined) */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: .8125rem; color: var(--md-sys-color-on-surface-variant); }
.field input[type=text], .field input[type=email], .field input[type=number], .field select, .field textarea {
  font: inherit; color: inherit; background: transparent; border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-xs); padding: 12px 14px; min-height: 48px; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--md-sys-color-primary); border-color: transparent; }
.field .error { color: var(--md-sys-color-error); font-size: .8125rem; }
.radio, .check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.radio input, .check input { width: 20px; height: 20px; accent-color: var(--md-sys-color-primary); margin-top: 2px; }
/* app bar + nav */
.top-bar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.top-bar .container { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.125rem; color: inherit; text-decoration: none !important; }
.brand .mark { width: 28px; height: 28px; display: block; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { padding: 8px 12px; border-radius: 20px; color: var(--md-sys-color-on-surface-variant); font-weight: 500; text-decoration: none !important; }
.nav a:hover, .nav a.active { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }
.nav a.btn-filled, .nav a.btn-filled:hover { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
@media (max-width: 720px) { .nav a.hide-sm { display: none; } }
/* navigation rail (docs / account) */
.with-rail { display: grid; grid-template-columns: 240px 1fr; gap: calc(var(--sp)*8); }
.rail { position: sticky; top: 80px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.rail a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 24px; color: var(--md-sys-color-on-surface-variant); text-decoration: none !important; font-weight: 500; font-size: .9375rem; }
.rail a.active, .rail a:hover { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
@media (max-width: 860px) { .with-rail { grid-template-columns: 1fr; } .rail { position: static; flex-direction: row; flex-wrap: wrap; } }
/* tables */
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--md-sys-color-outline-variant); vertical-align: top; }
.table th { color: var(--md-sys-color-on-surface-variant); font-weight: 500; font-size: .8125rem; }
.table-wrap { overflow-x: auto; }
/* misc */
.banner { padding: 12px 16px; border-radius: var(--md-sys-shape-sm); background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.banner-error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.banner-ok { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 2rem; font-weight: 500; letter-spacing: -.01em; }
.progress { height: 6px; border-radius: 3px; background: var(--md-sys-color-surface-container-highest); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--md-sys-color-primary); }
.key-box { font-family: var(--md-sys-typescale-mono); word-break: break-all; padding: 14px; border-radius: var(--md-sys-shape-sm);
  background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.footer { border-top: 1px solid var(--md-sys-color-outline-variant); padding: calc(var(--sp)*8) 0; color: var(--md-sys-color-on-surface-variant); font-size: .875rem; }
.footer .row { justify-content: space-between; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.checklist .done { color: var(--md-sys-color-tertiary); }
.hero-art { border-radius: var(--md-sys-shape-xl); background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container)); min-height: 260px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
