:root {
    color-scheme: light dark;
    --bg: #f7f7f4;
    --surface: #ffffff;
    --surface-2: #efefea;
    --fg: #1c1c1a;
    --fg-2: #4d4d48;
    --muted: #6b6b65;
    --line: #d9d9d2;
    --line-2: #c6c6be;
    --accent: #1f4f8f;
    --accent-2: #173d70;
    --on-accent: #ffffff;
    --accent-soft: #e3ecf8;
    --danger: #a12a2a;
    --danger-soft: #f8e5e5;
    --ok: #1f6b3a;
    --ok-soft: #e1f1e6;
    --warn: #8a5a00;
    --warn-soft: #f9ecd2;
    --code-bg: #f0f0eb;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.05);
    --radius: 10px;
    --radius-s: 6px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --measure: 72ch;
    --wide: 1120px;
    --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141413;
        --surface: #1d1d1b;
        --surface-2: #262623;
        --fg: #ebebe6;
        --fg-2: #c3c3bc;
        --muted: #9d9d96;
        --line: #33332f;
        --line-2: #44443f;
        --accent: #8db7f0;
        --accent-2: #a9c9f5;
        --on-accent: #0f1a2a;
        --accent-soft: #1d2b40;
        --danger: #f09a9a;
        --danger-soft: #3a1f1f;
        --ok: #8fd4a6;
        --ok-soft: #1c3324;
        --warn: #e8c070;
        --warn-soft: #3a2e14;
        --code-bg: #232321;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    }
}

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

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.6 var(--font);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; color: var(--fg); }
h1 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem); margin: 0 0 12px; }
h2 { font-size: 1.35rem; margin: 40px 0 12px; padding-top: 4px; }
h3 { font-size: 1.1rem; margin: 28px 0 8px; }
h4 { font-size: 1rem; margin: 20px 0 6px; }
p { margin: 0 0 14px; }
main ul, main ol { padding-left: 1.4rem; margin: 0 0 14px; }
main li { margin-bottom: 6px; }
main li > ul, main li > ol { margin-top: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
small, .small { font-size: 0.88rem; }
.muted { color: var(--muted); }
.lead { font-size: 1.12rem; color: var(--fg-2); max-width: var(--measure); }
.error { color: var(--danger); }
strong { font-weight: 650; }

code, pre, kbd, samp { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); word-break: break-word; }
pre {
    overflow-x: auto;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: var(--code-bg);
    line-height: 1.5;
    margin: 0 0 18px;
    tab-size: 2;
}
pre code { background: none; border: 0; padding: 0; font-size: 0.86rem; }
.pre-title { display: block; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin: 0 0 -12px; padding: 6px 12px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-s) var(--radius-s) 0 0; background: var(--surface-2); }
.pre-title + pre { border-top-left-radius: 0; border-top-right-radius: 0; }

/* Layout */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 12px; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-s); text-decoration: none; }
.skip:focus { top: 8px; }
.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }

.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
.brand { font-weight: 700; font-size: 1.08rem; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 8px; }
.brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; font-size: 0.78rem; font-weight: 800; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-left: auto; }
.top nav a, .top nav button.link {
    display: inline-block; padding: 6px 10px; border-radius: var(--radius-s); color: var(--fg-2); text-decoration: none; font-size: 0.95rem; font-weight: 500;
}
.top nav a:hover, .top nav button.link:hover { background: var(--surface-2); color: var(--fg); }
.top nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.top nav .cta { color: var(--on-accent); background: var(--accent); }
.top nav .cta:hover { background: var(--accent-2); color: var(--on-accent); }
.top nav form { display: inline; }

main { flex: 1; }
main > .wrap { padding-top: 28px; padding-bottom: 64px; }
.page-head { margin-bottom: 24px; }
.page-head .lead { margin-top: 4px; }
.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose table { font-size: 0.92rem; }

.crumbs { font-size: 0.88rem; color: var(--muted); margin: 0 0 12px; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li + li::before { content: "›"; margin: 0 6px 0 2px; color: var(--line-2); }
.crumbs a { color: var(--muted); }
.crumbs [aria-current] { color: var(--fg-2); }

.foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.88rem; margin-top: auto; }
.foot .wrap { padding-top: 28px; padding-bottom: 36px; display: grid; gap: 24px; grid-template-columns: 1fr; }
.foot h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-2); margin: 0 0 8px; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin: 0 0 4px; }
.foot a { color: var(--fg-2); text-decoration: none; }
.foot a:hover { color: var(--accent); text-decoration: underline; }
.foot .notice { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 16px; }
.foot .notice p { margin: 0 0 6px; }
@media (min-width: 640px) { .foot .wrap { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .foot .wrap { grid-template-columns: 1.3fr 1fr 1fr 1fr; } }

/* Hero and sections */
.hero { padding: 8px 0 24px; max-width: 780px; }
.hero h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.8rem); margin-bottom: 14px; }
.hero .lead { font-size: 1.18rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.kicker { display: inline-block; font-size: 0.78rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 8px; }
.section { margin-top: 44px; }
.section > h2 { margin-top: 0; }

/* Buttons */
.btn, button, input[type="submit"] {
    font: inherit; font-weight: 550; line-height: 1.2;
    padding: 9px 16px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
    border-radius: var(--radius-s); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
    transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover, button:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.btn.secondary, button.secondary { background: transparent; color: var(--accent); }
.btn.secondary:hover, button.secondary:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn.danger, button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover, button.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; font-weight: inherit; }
button.link:hover { background: none; color: var(--accent-2); }
.btn.small, button.small { padding: 5px 10px; font-size: 0.88rem; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Forms */
form.stack { display: grid; gap: 14px; max-width: 460px; }
form.stack button, form.stack .btn { justify-self: start; }
form.inline { display: inline; }
label { display: grid; gap: 5px; font-weight: 550; font-size: 0.95rem; }
label .hint { font-weight: 400; color: var(--muted); font-size: 0.86rem; }
input, select, textarea {
    font: inherit; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-s);
    background: var(--surface); color: var(--fg); width: 100%; min-width: 0;
}
input[type="file"] { padding: 7px; }
input[type="checkbox"], input[type="radio"] { width: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row label { min-width: 160px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.filters label { min-width: 150px; flex: 1 1 150px; }
.filters .search { flex: 2 1 260px; }
.filters .toolbar { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; flex-basis: 100%; }
.filters .toolbar a { font-size: 0.92rem; }
.filters .toolbar .spacer { flex: 1; }

/* Alerts */
.alert { padding: 12px 14px; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-s); background: var(--surface); margin: 0 0 16px; }
.alert p:last-child { margin-bottom: 0; }
.alert.error { border-left-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.alert.success { border-left-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.alert.info { border-left-color: var(--accent); background: var(--accent-soft); color: var(--fg); }
.alert.warn { border-left-color: var(--warn); background: var(--warn-soft); color: var(--fg); }
.notice-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); color: var(--fg-2); font-size: 0.94rem; }
.notice-box p:last-child { margin-bottom: 0; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 0.78rem; font-weight: 550; line-height: 1.5; white-space: nowrap; color: var(--fg-2); background: var(--surface-2); vertical-align: middle; }
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.info { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tag { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.8rem; color: var(--muted); }

/* Tables */
.overflow { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 16px; }
.overflow table { margin: 0; border: 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 0 0 16px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
.prose table th, .prose table td { padding: 8px 10px; }
.prose .overflow { background: var(--surface); }

/* Cards and grids */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 20px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.card strong { display: block; font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.card .label { color: var(--muted); font-size: 0.88rem; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 0 0 20px; }
@media (min-width: 700px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.tile h2, .tile h3 { margin: 0; font-size: 1.05rem; }
.tile p { margin: 0; color: var(--fg-2); font-size: 0.95rem; }
.tile a.more { margin-top: auto; padding-top: 8px; font-weight: 550; text-decoration: none; }
.tile a.more:hover { text-decoration: underline; }
a.tile { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
a.tile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
a.tile .more { color: var(--accent); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 20px; }
.facts div { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.facts dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 16px; }
dl.kv dt { color: var(--muted); font-weight: 500; }
dl.kv dd { margin: 0; }
@media (max-width: 480px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 8px; } }

/* Steps */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.steps > li { counter-increment: step; position: relative; padding: 14px 16px 14px 56px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0; }
.steps > li::before { content: counter(step); position: absolute; left: 14px; top: 13px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; }
.steps > li h3 { margin: 0 0 4px; font-size: 1.02rem; }
.steps > li p:last-child { margin-bottom: 0; }
.flow { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 0 0 20px; }
@media (min-width: 760px) { .flow { grid-template-columns: repeat(4, 1fr); } }
.flow div { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.flow .n { font-size: 0.78rem; color: var(--accent); font-weight: 700; letter-spacing: 0.06em; }
.flow h3 { margin: 2px 0 4px; font-size: 1rem; }
.flow p { margin: 0; font-size: 0.92rem; color: var(--fg-2); }

/* FAQ */
details { border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); margin: 0 0 10px; }
details summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details[open] summary::after { content: "–"; }
details > :not(summary) { padding: 0 14px; }
details > p:last-child { padding-bottom: 12px; }
details > ul:last-child, details > ol:last-child, details > pre:last-child { margin-bottom: 12px; margin-left: 14px; margin-right: 14px; padding-left: 1.4rem; }
details > pre:last-child { padding: 12px 14px; }
details > table { width: calc(100% - 28px); margin: 0 14px 12px; }
details summary h2, details summary h3 { margin: 0; padding: 0; font-size: inherit; font-weight: inherit; }

/* Next steps */
.next { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.next h2 { margin-top: 0; font-size: 1.1rem; }
.next ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .next ul { grid-template-columns: repeat(2, 1fr); } }
.next li { margin: 0; }
.next a { display: block; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); text-decoration: none; background: var(--surface); color: var(--fg); }
.next a:hover { border-color: var(--accent); color: var(--accent); }
.next a span { display: block; font-size: 0.86rem; color: var(--muted); }

/* Table of contents */
.toc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; margin: 0 0 24px; font-size: 0.92rem; }
.toc strong { display: block; margin-bottom: 6px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 1; }
@media (min-width: 700px) { .toc ol { columns: 2; column-gap: 24px; } }
.toc li { margin-bottom: 3px; break-inside: avoid; }

/* Endpoint blocks */
.endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 24px 0 8px; font-family: var(--mono); font-size: 0.95rem; }
.endpoint .method { font-weight: 700; font-size: 0.78rem; padding: 2px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); letter-spacing: 0.04em; }
.endpoint .method.post { background: var(--ok-soft); color: var(--ok); }
.endpoint code { font-size: 1rem; }
.cost { font-family: var(--font); font-size: 0.8rem; color: var(--muted); }

/* Area layout with side nav (account, supplier, admin) */
.area { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .area { grid-template-columns: 200px minmax(0, 1fr); } }
.side { font-size: 0.94rem; }
.side ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
@media (min-width: 860px) { .side { position: sticky; top: 72px; } .side ul { flex-direction: column; } }
.side a { display: block; padding: 6px 10px; border-radius: var(--radius-s); color: var(--fg-2); text-decoration: none; }
.side a:hover { background: var(--surface-2); color: var(--fg); }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side .side-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 10px 6px; font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; font-size: 0.92rem; }
.pager .row { align-items: center; }
.pager a { padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); text-decoration: none; background: var(--surface); }
.pager a:hover { border-color: var(--accent); }
.back { display: inline-block; margin: 0 0 12px; font-size: 0.92rem; text-decoration: none; }
.back:hover { text-decoration: underline; }
.key-reveal { border: 1px solid var(--ok); background: var(--ok-soft); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
.key-reveal code { display: block; font-size: 1rem; padding: 8px 10px; margin-top: 6px; background: var(--surface); user-select: all; word-break: break-all; }
.meta-line { color: var(--muted); font-size: 0.92rem; margin: -4px 0 16px; }
.meta-line .badge { margin-left: 2px; }
.quota { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 0 0 16px; }
@media (min-width: 560px) { .quota { grid-template-columns: 1fr 1fr; } }
.quota div { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); }
.quota .label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.quota .value { font-size: 1.2rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.quota .value small { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar span.p0 { width: 0; } .bar span.p10 { width: 10%; } .bar span.p20 { width: 20%; } .bar span.p30 { width: 30%; } .bar span.p40 { width: 40%; } .bar span.p50 { width: 50%; }
.bar span.p60 { width: 60%; } .bar span.p70 { width: 70%; } .bar span.p80 { width: 80%; } .bar span.p90 { width: 90%; } .bar span.p100 { width: 100%; background: var(--danger); }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); margin: 0 0 16px; }
.proposal { margin: 0 0 12px; }
.proposal ul { margin: 6px 0 10px; }
.proposal form { margin-top: 8px; }
.status-page .facts dd { font-size: 1.1rem; }

@media print {
    .top, .foot, .skip, .next { display: none; }
    body { background: #fff; color: #000; }
    a { color: inherit; text-decoration: none; }
}
