:root {
    --bg-page: #fafaf7;
    --bg-card: #ffffff;
    --bg-elev: #f4f3ef;
    --text-color: #0d0d0c;
    --text-muted: #6b6a64;
    --text-faint: #9b9a93;
    --primary-color: #0d0d0c;
    --primary-hover: #1f1f1d;
    --surface-color: #f1f0eb;
    --surface-strong: #e7e6e0;
    --line-color: #e7e6e0;
    --line-strong: #d4d3cd;
    --line-faint: #efeee9;
    --accent-positive: #10a37f;
    --accent-warn: #d97706;
    --accent-error: #dc2626;
    --accent-info: #2563eb;
    --shadow-sm: 0 1px 2px rgba(15, 15, 15, 0.04);
    --shadow-md: 0 4px 16px -4px rgba(15, 15, 15, 0.08), 0 1px 2px rgba(15, 15, 15, 0.04);
    --shadow-lg: 0 16px 48px -16px rgba(15, 15, 15, 0.12), 0 4px 12px -4px rgba(15, 15, 15, 0.06);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-serif: "Instrument Serif", serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { background: var(--bg-page); }

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-color);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    font-feature-settings: "ss01", "cv11";
}

::selection { background: var(--primary-color); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 999px;
    border: 2px solid var(--bg-page);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

a { color: inherit; text-decoration: none; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--text-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------- Navbar */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(250, 250, 247, 0.78);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.logo svg { width: 22px; height: 22px; }

.nav-links {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.nav-links > a {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    transition: color 160ms var(--ease), background 160ms var(--ease);
}

.nav-links > a:hover { color: var(--text-color); }
.nav-links > a.active {
    color: var(--text-color);
    background: var(--surface-color);
}

.nav-links .btn { margin-left: 0.4rem; }

/* ---------------------------------------------------------------- Layout */

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 4.5rem 5%;
}

.dashboard-container { padding-top: 3rem; padding-bottom: 5rem; }

/* ---------------------------------------------------------------- Hero */

.hero {
    margin-bottom: 4.5rem;
    max-width: 760px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--line-color);
    border-radius: 999px;
    background: var(--bg-card);
    margin-bottom: 1.5rem;
}

.eyebrow .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent-positive);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.18);
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    font-weight: 400;
    line-height: 1.02;
    letter-spacing: -0.035em;
    margin-bottom: 1.25rem;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 540px;
    line-height: 1.55;
}

.hero-actions {
    margin-top: 1.75rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------- Cards */

.card {
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.card + .card { margin-top: 1.25rem; }

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.card-head .title-block { min-width: 0; }

.card h2 {
    font-family: var(--font-serif);
    font-size: 1.55rem;
    font-weight: 400;
    letter-spacing: -0.015em;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.muted { color: var(--text-muted); font-size: 0.875rem; }
.faint { color: var(--text-faint); }

/* ---------------------------------------------------------------- Dashboard header */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.25rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.dashboard-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.4rem, 4vw, 3.2rem);
    font-weight: 400;
    letter-spacing: -0.025em;
    line-height: 1.02;
    margin-bottom: 0.4rem;
}

.dashboard-header .muted { font-size: 0.95rem; }

.range-tabs {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    box-shadow: var(--shadow-sm);
}

.range-tab {
    border: 0;
    background: transparent;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 180ms var(--ease);
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}

.range-tab:hover { color: var(--text-color); }
.range-tab.is-active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ---------------------------------------------------------------- Activate */

.activate-card {
    margin-bottom: 2rem;
    border: 1px solid var(--text-color);
    background: linear-gradient(180deg, #fff 0%, #fafaf7 100%);
    padding: 2.25rem;
    position: relative;
    overflow: hidden;
}

.activate-card::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -80px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(13,13,12,0.04), transparent 65%);
    pointer-events: none;
}

.activate-card h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.activate-card p { margin-bottom: 1.5rem; max-width: 480px; color: var(--text-muted); }
.activate-card code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: var(--surface-color);
    padding: 0.12rem 0.4rem;
    border-radius: 5px;
}

/* ---------------------------------------------------------------- Stats */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    padding: 1.4rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color 220ms var(--ease);
    display: flex;
    flex-direction: column;
    min-height: 130px;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-range {
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-faint);
    font-weight: 500;
}

.stat-value {
    font-size: 2.15rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
}

.stat-value .unit {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-left: 0.2rem;
    font-weight: 500;
}

.stat-trend {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.stat-spark {
    margin-top: auto;
    height: 36px;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    margin-bottom: -1.4rem;
    position: relative;
}

/* ---------------------------------------------------------------- Grid */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 1.25rem 0;
}

.dashboard-grid.two-col { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) { .dashboard-grid.two-col { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Charts */

.chart-card .chart-wrap {
    position: relative;
    height: 280px;
}

.chart-wrap--donut {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}

.donut-center .num {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.donut-center .lbl {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: 0.15rem;
    font-weight: 600;
}

.legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface-color);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.dot-primary { background: var(--primary-color); }
.dot-grey { background: var(--text-faint); }

.endpoint-legend {
    list-style: none;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.endpoint-legend li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-color);
    padding: 0.35rem 0;
}

.endpoint-legend .swatch {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    flex: none;
}

.endpoint-legend .label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-color);
}

.endpoint-legend .count {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Custom chart tooltip */
.chartjs-tt {
    position: absolute;
    pointer-events: none;
    background: var(--primary-color);
    color: #fff;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-family: var(--font-sans);
    box-shadow: var(--shadow-md);
    transform: translate(-50%, -110%);
    transition: opacity 120ms var(--ease), transform 120ms var(--ease);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.chartjs-tt .tt-label {
    color: rgba(255,255,255,0.65);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.1rem;
    font-weight: 600;
}

.chartjs-tt .tt-value { font-weight: 600; font-size: 0.95rem; }

/* ---------------------------------------------------------------- Tables */

.table-wrap { overflow-x: auto; margin: 0 -0.5rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    text-align: left;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--line-color);
}

.data-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--line-faint);
    vertical-align: middle;
    color: var(--text-color);
}

.data-table tr:last-child td { border-bottom: 0; }

.data-table tbody tr {
    transition: background 140ms var(--ease);
}

.data-table tbody tr:hover {
    background: var(--bg-page);
}

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.data-table .empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 0.75rem;
    font-size: 0.875rem;
}

.data-table code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: var(--surface-color);
    padding: 0.18rem 0.5rem;
    border-radius: 5px;
    color: var(--text-color);
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--line-color);
    color: var(--text-muted);
    background: var(--bg-card);
    line-height: 1;
}

.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}

.badge-success { color: var(--accent-positive); border-color: rgba(16,163,127,0.25); background: rgba(16,163,127,0.07); }
.badge-error   { color: var(--accent-error);    border-color: rgba(220,38,38,0.25);   background: rgba(220,38,38,0.07); }
.badge-warn    { color: var(--accent-warn);     border-color: rgba(217,119,6,0.25);   background: rgba(217,119,6,0.07); }

/* ---------------------------------------------------------------- Forms */

.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--line-color);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    background: var(--bg-card);
    color: var(--text-color);
    outline: none;
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: var(--text-color);
    box-shadow: 0 0 0 4px rgba(13,13,12,0.06);
}

.inline-input { max-width: 220px; }

.key-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.new-key-banner {
    margin-bottom: 1.5rem;
    padding: 1rem 1.1rem;
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px dashed var(--line-strong);
}

.banner-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.banner-row { display: flex; gap: 0.5rem; }
.banner-row input {
    font-family: var(--font-mono);
    background: #fff;
    font-size: 0.82rem;
}

/* ---------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.86rem;
    cursor: pointer;
    transition: transform 120ms var(--ease), background 160ms var(--ease), box-shadow 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
    border: 1px solid transparent;
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 1px 2px rgba(0,0,0,0.15);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 2px 6px rgba(0,0,0,0.2); }
.btn-primary:active { transform: translateY(1px); }

.btn-outline {
    background: var(--bg-card);
    border-color: var(--line-strong);
    color: var(--text-color);
}
.btn-outline:hover { border-color: var(--text-color); background: var(--bg-page); }
.btn-outline:active { transform: translateY(1px); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover { color: var(--text-color); }

.btn-danger-ghost {
    background: transparent;
    color: var(--accent-error);
    border-color: transparent;
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
}
.btn-danger-ghost:hover { background: rgba(220,38,38,0.07); }

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.8rem; }

/* ---------------------------------------------------------------- Landing feature grid */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.feature-tile {
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color 220ms var(--ease);
    box-shadow: var(--shadow-sm);
}

.feature-tile:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.feature-tile .icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.feature-tile h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    letter-spacing: -0.005em;
}

.feature-tile p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ---------------------------------------------------------------- Utility */

.mt-4 { margin-top: 1rem; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- Docs */

.docs-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 5% 6rem;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 3rem;
    align-items: flex-start;
}

@media (max-width: 900px) {
    .docs-container { grid-template-columns: 1fr; gap: 1.5rem; }
    .docs-sidebar { position: relative !important; top: 0 !important; max-height: none !important; padding-right: 0 !important; }
}

.docs-sidebar {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    padding-right: 0.5rem;
    font-size: 0.86rem;
}

.docs-sidebar h3 {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
    margin: 1.6rem 0 0.5rem;
    font-weight: 600;
}

.docs-sidebar h3:first-child { margin-top: 0; }

.docs-sidebar a {
    display: block;
    padding: 0.32rem 0.6rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.86rem;
    border-radius: 6px;
    margin-left: -0.6rem;
    transition: color 140ms var(--ease), background 140ms var(--ease);
}

.docs-sidebar a:hover { color: var(--text-color); background: var(--surface-color); }
.docs-sidebar a.is-active {
    color: var(--text-color);
    background: var(--surface-color);
    font-weight: 500;
}

.docs-content { min-width: 0; }

.docs-content > h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 4.5vw, 3.6rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 0.85rem;
}

.docs-content > p.lede {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 60ch;
    margin-bottom: 3.5rem;
    line-height: 1.6;
}

.docs-section {
    padding-top: 2.5rem;
    margin-bottom: 2rem;
    scroll-margin-top: 5.5rem;
}

.docs-section + .docs-section { border-top: 1px solid var(--line-color); }

.docs-section h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 0.9rem;
    line-height: 1.1;
    position: relative;
}

.docs-section h2 .anchor {
    opacity: 0;
    color: var(--text-faint);
    margin-left: 0.4rem;
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: opacity 160ms var(--ease), color 160ms var(--ease);
}

.docs-section h2:hover .anchor { opacity: 1; }
.docs-section h2 .anchor:hover { color: var(--text-color); }

.docs-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 1.85rem 0 0.6rem;
    letter-spacing: -0.005em;
}

.docs-section p,
.docs-section li {
    color: var(--text-color);
    font-size: 0.94rem;
    line-height: 1.7;
}

.docs-section p { margin-bottom: 1rem; max-width: 68ch; }

.docs-section ul,
.docs-section ol { padding-left: 1.5rem; margin-bottom: 1rem; max-width: 68ch; }
.docs-section li { margin-bottom: 0.35rem; }

.docs-section code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--surface-color);
    padding: 0.08rem 0.4rem;
    border-radius: 5px;
}

.docs-section a {
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--line-strong);
    transition: text-decoration-color 140ms var(--ease);
}
.docs-section a:hover { text-decoration-color: var(--text-color); }

/* Code blocks */
.code-block {
    border: 1px solid #1a1a1a;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 1.1rem 0 1.6rem;
    background: #0c0c0c;
    box-shadow: var(--shadow-md);
}

.code-tabs {
    display: flex;
    align-items: center;
    background: #131313;
    border-bottom: 1px solid #1f1f1f;
    padding: 0 0.4rem 0 0.8rem;
    gap: 0.1rem;
    min-height: 38px;
}

.code-tabs .traffic {
    display: inline-flex;
    gap: 6px;
    margin-right: 0.6rem;
}

.code-tabs .traffic span {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #2a2a2a;
}

.code-tab {
    background: transparent;
    color: #8b8b8b;
    border: 0;
    padding: 0.55rem 0.85rem;
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
    letter-spacing: 0.02em;
    transition: color 140ms var(--ease), background 140ms var(--ease);
}

.code-tab:hover { color: #fff; }
.code-tab.is-active { color: #fff; background: rgba(255,255,255,0.06); }

.code-copy {
    margin-left: auto;
    background: transparent;
    color: #8b8b8b;
    border: 0;
    padding: 0.4rem 0.7rem;
    font-size: 0.68rem;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    transition: color 140ms var(--ease);
}

.code-copy:hover { color: #fff; }

.code-panel {
    display: none;
    margin: 0;
    padding: 1.2rem 1.25rem;
    overflow-x: auto;
}

.code-panel.is-active { display: block; }

.code-panel pre {
    margin: 0;
    color: #ececec;
    font-family: var(--font-mono);
    font-size: 0.815rem;
    line-height: 1.65;
    white-space: pre;
}

.code-panel .tk-key     { color: #c4b5fd; }
.code-panel .tk-string  { color: #86efac; }
.code-panel .tk-comment { color: #6b7280; font-style: italic; }
.code-panel .tk-flag    { color: #fbbf24; }

/* Endpoint blocks */
.endpoint {
    border: 1px solid var(--line-color);
    border-radius: var(--radius-md);
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.25rem;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: border-color 160ms var(--ease);
}

.endpoint:hover { border-color: var(--line-strong); }

.endpoint-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
    flex-wrap: wrap;
}

.method {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0.22rem 0.55rem;
    border-radius: 5px;
    background: var(--surface-color);
    color: var(--text-color);
}

.method.method-get    { background: rgba(16,163,127,0.1);  color: var(--accent-positive); }
.method.method-post   { background: rgba(37,99,235,0.1);   color: var(--accent-info); }
.method.method-delete { background: rgba(220,38,38,0.1);   color: var(--accent-error); }

.endpoint-path {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 500;
}

.endpoint-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.params-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.params-table th,
.params-table td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--line-faint);
    font-size: 0.86rem;
    vertical-align: top;
}

.params-table tr:last-child td { border-bottom: 0; }

.params-table th {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--line-color);
}

.params-table .req {
    color: var(--accent-error);
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.params-table code {
    font-family: var(--font-mono);
    font-size: 0.8em;
    background: var(--surface-color);
    padding: 0.1rem 0.38rem;
    border-radius: 4px;
}

.callout {
    border: 1px solid var(--line-color);
    border-left: 3px solid var(--text-color);
    padding: 0.95rem 1.2rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--surface-color);
    margin: 1rem 0 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.callout.callout-warn { border-left-color: var(--accent-warn); }
.callout.callout-info { border-left-color: var(--accent-info); }
.callout strong { font-weight: 600; }

/* ---------------------------------------------------------------- Nav balance pill */

.nav-balance {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    border-radius: 999px;
    margin-left: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.nav-balance-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    font-weight: 600;
}

.nav-balance-value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-color);
}

/* ---------------------------------------------------------------- Paywall */

.paywall-card {
    margin-bottom: 2rem;
    background: linear-gradient(180deg, #fff 0%, var(--bg-page) 100%);
    border: 1px solid var(--text-color);
    padding: 2.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.paywall-card::after {
    content: "";
    position: absolute;
    right: -120px;
    top: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(13,13,12,0.05), transparent 65%);
    pointer-events: none;
}

.paywall-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 2.5rem;
    position: relative;
}

@media (max-width: 900px) {
    .paywall-grid { grid-template-columns: 1fr; gap: 2rem; }
}

.paywall-card h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.85rem, 3vw, 2.4rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0.5rem 0 0.75rem;
}

.paywall-lede {
    margin-bottom: 1.75rem;
    max-width: 56ch;
    line-height: 1.6;
}

.paywall-lede strong { color: var(--text-color); font-weight: 600; }

.balance-progress { margin-bottom: 1.75rem; }
.balance-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.45rem;
    font-variant-numeric: tabular-nums;
}

.balance-progress-meta strong { font-weight: 600; color: var(--text-color); }
.balance-progress-meta.faint { color: var(--text-faint); margin-top: 0.45rem; margin-bottom: 0; font-size: 0.78rem; }

.balance-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-strong);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.balance-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--text-color), #444);
    border-radius: 999px;
    transition: width 600ms var(--ease);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04) inset;
}

.paywall-tiers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.tier {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 160ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease);
    font-family: inherit;
    text-align: left;
    color: var(--text-color);
}

.tier:hover {
    border-color: var(--text-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tier:active { transform: translateY(0); }
.tier:disabled { opacity: 0.5; cursor: not-allowed; }

.tier-amount {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.tier-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.tier.is-loading { opacity: 0.6; pointer-events: none; }

.paywall-custom { margin-top: 0.5rem; }
.paywall-custom label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.paywall-custom-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.paywall-custom-row input {
    flex: 1;
    max-width: 200px;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.paywall-custom-hint {
    font-size: 0.78rem;
    margin-top: 0.55rem;
}

.paywall-aside {
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    border-radius: var(--radius-md);
    padding: 1.4rem 1.5rem;
    align-self: start;
    box-shadow: var(--shadow-sm);
}

.paywall-aside h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.85rem;
}

.paywall-pricing-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.paywall-pricing-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line-faint);
    font-size: 0.88rem;
}

.paywall-pricing-list li:last-child { border-bottom: 0; }
.paywall-pricing-list li code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: transparent;
    padding: 0;
    color: var(--text-color);
}
.paywall-pricing-list li .rate {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.paywall-aside-footnote {
    font-size: 0.76rem;
    line-height: 1.5;
    border-top: 1px solid var(--line-faint);
    padding-top: 0.9rem;
}

/* ---------------------------------------------------------------- Balance widget (in dashboard) */

.balance-widget {
    margin-bottom: 1.25rem;
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: linear-gradient(180deg, #fff 0%, #fcfcf9 100%);
}

.balance-widget-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.balance-value {
    font-family: var(--font-sans);
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    margin-top: 0.3rem;
    line-height: 1;
}

.balance-value.balance-low { color: var(--accent-warn); }
.balance-value.balance-empty { color: var(--accent-error); }

.balance-widget-actions { display: flex; gap: 0.5rem; align-items: center; }

.balance-widget-bar {
    width: 100%;
    height: 4px;
    background: var(--surface-strong);
    border-radius: 999px;
    overflow: hidden;
}

.balance-widget-bar-fill {
    height: 100%;
    background: var(--text-color);
    border-radius: 999px;
    transition: width 600ms var(--ease);
}

.balance-widget-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Banners */

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--line-color);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.banner > div { display: flex; flex-direction: column; gap: 0.15rem; }
.banner strong { font-weight: 600; }

.banner-warn {
    border-left: 3px solid var(--accent-warn);
    background: linear-gradient(180deg, rgba(217,119,6,0.03) 0%, #fff 100%);
}

/* ---------------------------------------------------------------- Modal */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 180ms var(--ease);
}

.modal.is-open { opacity: 1; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(250, 250, 247, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-panel {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--line-color);
    box-shadow: var(--shadow-lg);
    padding: 2.25rem 2.25rem 1.75rem;
    width: min(560px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    transform: translateY(8px) scale(0.99);
    transition: transform 180ms var(--ease);
}

.modal.is-open .modal-panel { transform: translateY(0) scale(1); }

.modal-panel h2 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin: 0.5rem 0 0.6rem;
}

.modal-lede { margin-bottom: 1.5rem; max-width: 50ch; line-height: 1.55; }
.modal-lede strong { font-weight: 600; color: var(--text-color); }

.modal-close {
    position: absolute;
    top: 0.8rem;
    right: 0.9rem;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background 140ms var(--ease), color 140ms var(--ease);
}

.modal-close:hover { background: var(--surface-color); color: var(--text-color); }

.modal-error {
    color: var(--accent-error);
    font-size: 0.82rem;
    margin-top: 0.55rem;
    font-weight: 500;
}

/* ---------------------------------------------------------------- Transactions */

.amt-credit { color: var(--accent-positive); font-weight: 500; }
.amt-debit  { color: var(--text-color); font-weight: 500; }

/* ---------------------------------------------------------------- Toast */

.toast {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    padding: 0.7rem 1.1rem;
    background: var(--primary-color);
    color: #fff;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    opacity: 0;
    transition: opacity 180ms var(--ease), transform 180ms var(--ease);
    pointer-events: none;
    max-width: calc(100% - 2rem);
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success { background: var(--accent-positive); }
.toast-error   { background: var(--accent-error); }
.toast-info    { background: var(--primary-color); }

/* ---------------------------------------------------------------- Legal pages */

.legal-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 4rem 5% 6rem;
}

.legal-container > header { margin-bottom: 2.5rem; }

.legal-container > header h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 5vw, 3.6rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.02;
    margin-bottom: 0.6rem;
}

.legal-container > header .legal-updated {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.legal-body p,
.legal-body li {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.7;
}

.legal-body h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin: 2.5rem 0 0.75rem;
    line-height: 1.15;
}

.legal-body h2:first-child { margin-top: 0; }

.legal-body h3 {
    font-size: 0.98rem;
    font-weight: 600;
    margin: 1.75rem 0 0.5rem;
}

.legal-body p { margin-bottom: 1rem; }

.legal-body ul,
.legal-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }

.legal-body li { margin-bottom: 0.4rem; }

.legal-body a {
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-body a:hover { color: var(--text-muted); }

.legal-body strong { color: var(--text-color); font-weight: 600; }

.legal-body code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--surface-color);
    padding: 0.08rem 0.4rem;
    border-radius: 5px;
}

/* ---------------------------------------------------------------- Site footer */

.site-footer {
    border-top: 1px solid var(--line-color);
    background: var(--bg-card);
    padding: 2rem 5%;
    margin-top: 4rem;
}

.site-footer-inner {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.site-footer-links a {
    color: var(--text-muted);
    transition: color 140ms var(--ease);
}

.site-footer-links a:hover { color: var(--text-color); }
