/*  ChatBAZ Coder — custom, one-of-a-kind aesthetic.
 *  Aesthetic direction: "night-sky coding spellbook".
 *  Deep indigo void, glass cards float in, warm stars sparkle, soft
 *  lavender-rose typography. Intentional — not generic "AI purple".
 *
 *  Single file. No build step. No CDN CSS frameworks.
 */

/* --- Fonts (Google Fonts, self-contained <link> in base.html) ----------- */

:root {
    /* Palette */
    --ink:        #0b0720;             /* deepest night */
    --ink-2:      #150e34;             /* bg base */
    --ink-3:      #1e1746;             /* elevated surface */
    --lavender:   #d9c8ff;             /* primary text */
    --lavender-2: #a89bd6;             /* secondary text */
    --rose:       #ffc6e3;             /* soft accent */
    --rose-2:     #ff8cc7;             /* strong accent */
    --violet:     #8b5cf6;             /* primary button */
    --violet-2:   #c084fc;             /* hover */
    --sparkle:    #ffdf6a;             /* yellow stars */
    --sparkle-2:  #ffb04f;             /* deep amber */
    --good:       #74e3a9;
    --warn:       #ffc36d;
    --danger:     #ff7a95;
    --border:     rgba(217, 200, 255, 0.14);
    --border-2:   rgba(217, 200, 255, 0.25);
    --surface:    rgba(255, 255, 255, 0.04);
    --surface-2:  rgba(255, 255, 255, 0.07);
    --surface-3:  rgba(255, 255, 255, 0.12);
    --overlay:    rgba(11, 7, 32, 0.72);
    --shadow-lg:  0 30px 80px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 50px rgba(139, 92, 246, 0.28);

    /* Typography */
    --font-display: "Fraunces", "Iowan Old Style", ui-serif, Georgia, serif;
    --font-body:    "DM Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono:    "JetBrains Mono", "SF Mono", Menlo, ui-monospace, monospace;

    /* Shape */
    --radius:      18px;
    --radius-lg:   28px;
    --radius-sm:   12px;

    color-scheme: dark;
}

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

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--ink);
    color: var(--lavender);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    font-feature-settings: "ss01", "cv11", "ss03";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Background starfield + aurora ------------------------------------- */

body::before {
    /* Soft auroras */
    content: "";
    position: fixed;
    inset: -20vmax;
    z-index: -2;
    background:
        radial-gradient(40vmax 28vmax at 15% 10%, rgba(139, 92, 246, 0.55), transparent 62%),
        radial-gradient(36vmax 30vmax at 85% 20%, rgba(255, 140, 199, 0.32), transparent 65%),
        radial-gradient(50vmax 38vmax at 55% 95%, rgba(87, 64, 188, 0.45), transparent 60%),
        linear-gradient(180deg, #0b0720 0%, #0f0a2d 55%, #0b0720 100%);
    filter: saturate(1.15);
    animation: aurora-drift 42s ease-in-out infinite alternate;
}

body::after {
    /* Star layer — rendered via multiple radial-gradient dots. Hand-tuned. */
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(1.2px 1.2px at 5% 12%, rgba(255, 223, 106, 0.85) 45%, transparent 100%),
        radial-gradient(1px 1px at 15% 78%, rgba(217, 200, 255, 0.6) 50%, transparent 100%),
        radial-gradient(1.6px 1.6px at 35% 24%, rgba(255, 223, 106, 0.7) 45%, transparent 100%),
        radial-gradient(1px 1px at 48% 62%, rgba(217, 200, 255, 0.7) 45%, transparent 100%),
        radial-gradient(1.4px 1.4px at 70% 40%, rgba(255, 176, 79, 0.6) 45%, transparent 100%),
        radial-gradient(1px 1px at 82% 18%, rgba(217, 200, 255, 0.7) 45%, transparent 100%),
        radial-gradient(1.6px 1.6px at 92% 68%, rgba(255, 223, 106, 0.8) 45%, transparent 100%),
        radial-gradient(1px 1px at 22% 92%, rgba(217, 200, 255, 0.5) 45%, transparent 100%),
        radial-gradient(1.2px 1.2px at 62% 88%, rgba(255, 223, 106, 0.6) 45%, transparent 100%),
        radial-gradient(1px 1px at 88% 94%, rgba(217, 200, 255, 0.4) 45%, transparent 100%);
    background-repeat: no-repeat;
    animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
    from { transform: translate3d(-1.5vmax, -1vmax, 0) scale(1); }
    to   { transform: translate3d(2vmax, 2vmax, 0) scale(1.05); }
}

@keyframes twinkle {
    from { opacity: 0.65; }
    to   { opacity: 1; }
}

/* --- Typography primitives --------------------------------------------- */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    color: #f5ecff;
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 0;
}

h1 {
    font-size: clamp(2.3rem, 5.2vw, 4.2rem);
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    font-weight: 380;
    letter-spacing: -0.03em;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    font-variation-settings: "SOFT" 80, "opsz" 72;
    font-weight: 420;
}

h3 {
    font-size: 1.2rem;
    font-variation-settings: "opsz" 36;
    font-weight: 450;
    color: var(--lavender);
}

p { margin: 0 0 1rem; color: var(--lavender-2); }

a {
    color: var(--rose-2);
    text-decoration: none;
    transition: color 120ms ease;
}
a:hover { color: var(--rose); }

code,
pre,
kbd {
    font-family: var(--font-mono);
    font-size: 0.86em;
    font-feature-settings: "zero", "cv01";
}

code {
    padding: 0.1em 0.4em;
    background: var(--surface-2);
    border-radius: 4px;
    border: 1px solid var(--border);
    color: #eadcff;
}

pre {
    margin: 0;
    padding: 1.1rem 1.3rem;
    background: rgba(8, 4, 24, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: auto;
    line-height: 1.6;
    font-size: 0.85rem;
}

pre code {
    padding: 0;
    background: transparent;
    border: 0;
    color: #ece3ff;
}

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

.container {
    width: min(1240px, 100% - 2.4rem);
    margin-inline: auto;
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row   { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* --- Header ------------------------------------------------------------ */

.top {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    background: linear-gradient(180deg, rgba(11, 7, 32, 0.85) 0%, rgba(11, 7, 32, 0.55) 100%);
    border-bottom: 1px solid var(--border);
}

.top .inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #f5ecff;
    font-weight: 500;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.brand img {
    width: 36px;
    height: 36px;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(139, 92, 246, 0.4));
}

.brand .name {
    font-family: var(--font-display);
    font-size: 1.18rem;
    font-variation-settings: "SOFT" 80, "opsz" 36;
    font-weight: 450;
}

.brand .name em {
    color: var(--rose-2);
    font-style: italic;
    font-variation-settings: "SOFT" 80, "opsz" 36;
}

.top nav {
    display: flex;
    gap: 1.4rem;
    margin-left: 0.5rem;
}

.top nav a {
    color: var(--lavender-2);
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 120ms ease;
    padding: 0.35rem 0;
    position: relative;
}

.top nav a:hover,
.top nav a.active { color: #f5ecff; }

.top nav a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.25rem;
    height: 2px;
    background: linear-gradient(90deg, var(--violet-2), var(--rose-2));
    border-radius: 2px;
}

.top .sign-in {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 999px;
    color: #f5ecff;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 180ms ease;
    margin-left: auto;
}

.top .sign-in:hover {
    background: var(--surface-3);
    border-color: var(--rose-2);
    color: var(--rose);
    transform: translateY(-1px);
}

/* Admin logout button */
.logout-form { margin-left: auto; }
.logout-form button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--lavender-2);
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}
.logout-form button:hover { border-color: var(--rose-2); color: var(--rose); }

/* --- Buttons & forms --------------------------------------------------- */

button,
.btn {
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.55rem 1.2rem;
    border-radius: 10px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--violet), var(--violet-2));
    color: #13072d;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 180ms ease, opacity 140ms ease;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
    letter-spacing: -0.005em;
}

button:hover:not(:disabled),
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(192, 132, 252, 0.35);
}

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

.btn-ghost {
    background: transparent;
    color: var(--lavender);
    border-color: var(--border-2);
    box-shadow: none;
}
.btn-ghost:hover {
    background: var(--surface-2);
    border-color: var(--rose-2);
    color: #f5ecff;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(255, 122, 149, 0.4);
    box-shadow: none;
}
.btn-danger:hover {
    background: rgba(255, 122, 149, 0.12);
    color: #ffa5b8;
    box-shadow: 0 8px 22px rgba(255, 122, 149, 0.2);
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    border-radius: 8px;
}

input,
select,
textarea {
    font: inherit;
    font-size: 0.92rem;
    color: var(--lavender);
    background: rgba(8, 4, 24, 0.55);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    width: 100%;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--violet-2);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--lavender-2);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

label input,
label select,
label textarea {
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--lavender);
}

/* --- Cards + glass ----------------------------------------------------- */

.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1.6rem;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card.elevated {
    background: var(--surface-2);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-variation-settings: "opsz" 36;
    font-weight: 450;
    color: #f5ecff;
    margin: 0 0 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-title .badge {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--surface-3);
    color: var(--lavender-2);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.muted { color: var(--lavender-2); }
.tiny  { font-size: 0.82rem; }

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

.table-wrap {
    overflow-x: auto;
    margin: 0 -1.6rem -1.4rem;
    padding: 0 1.6rem 1.4rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th {
    text-align: left;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--lavender-2);
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.85rem 0.7rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--lavender);
}

tr:last-child td { border-bottom: none; }
tr.dim td { opacity: 0.5; }

td code { font-size: 0.78rem; }

.actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

/* --- State pills ------------------------------------------------------- */

.state {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.state::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.state-active   { color: var(--good); }
.state-cooldown { color: var(--warn); }
.state-expired,
.state-banned   { color: var(--danger); }
.state-pending  { color: var(--rose-2); }

/* --- Alerts ------------------------------------------------------------ */

.alert {
    border: 1px solid var(--border);
    background: rgba(255, 122, 149, 0.08);
    color: var(--danger);
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}
.alert.success {
    background: rgba(116, 227, 169, 0.08);
    color: var(--good);
    border-color: rgba(116, 227, 169, 0.3);
}

/* --- Events list (admin) ---------------------------------------------- */

.events { list-style: none; padding: 0; margin: 0; }
.events li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.55rem 0;
    font-size: 0.86rem;
    border-bottom: 1px dashed var(--border);
}
.events li:last-child { border-bottom: none; }
.events time { color: var(--lavender-2); min-width: 150px; font-variant-numeric: tabular-nums; }
.events .cat {
    min-width: 70px;
    color: var(--lavender-2);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
}
.level-warning .cat { color: var(--warn); }
.level-error   .cat { color: var(--danger); }

/* =========================================================================
 *  ADMIN SHELL
 * ========================================================================= */

.admin-shell {
    padding: 2rem 0 4rem;
}

.admin-shell h1 {
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    font-variation-settings: "SOFT" 100, "opsz" 72;
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.admin-shell .eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rose-2);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

.stat {
    padding: 1.1rem 1.4rem;
}

.stat .label {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--lavender-2);
}

.stat .value {
    font-family: var(--font-display);
    font-variation-settings: "opsz" 120;
    font-weight: 350;
    font-size: 2.2rem;
    color: #f5ecff;
    line-height: 1;
    margin-top: 0.4rem;
}

.stat .sub {
    margin-top: 0.4rem;
    color: var(--lavender-2);
    font-size: 0.82rem;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.admin-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 2rem 0 1rem;
    flex-wrap: wrap;
    gap: 0.8rem;
}

/* Usage meter */
.meter {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.4rem;
    position: relative;
}
.meter > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--violet), var(--rose-2));
    border-radius: inherit;
    transition: width 400ms ease;
}
.meter.danger > span { background: linear-gradient(90deg, var(--danger), #ffb04f); }
.meter.warn   > span { background: linear-gradient(90deg, var(--sparkle-2), var(--sparkle)); }

/* Empty state */
.empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--lavender-2);
    font-family: var(--font-display);
    font-variation-settings: "opsz" 48;
    font-size: 1.1rem;
    font-style: italic;
}

/* =========================================================================
 *  LOGIN
 * ========================================================================= */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.login-card {
    position: relative;
    width: min(420px, 100%);
    padding: 2.4rem 2.2rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--border-2);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    box-shadow: var(--shadow-lg), 0 0 80px rgba(139, 92, 246, 0.12);
}

.login-card .brand-lg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1.4rem;
}
.login-card .brand-lg img {
    width: 74px;
    height: 74px;
    filter: drop-shadow(0 10px 28px rgba(139, 92, 246, 0.45));
}
.login-card h1 {
    font-size: 1.6rem;
    text-align: center;
    font-variation-settings: "SOFT" 100, "opsz" 72;
    font-weight: 420;
}
.login-card .hello {
    text-align: center;
    color: var(--lavender-2);
    font-size: 0.92rem;
    margin-bottom: 1.4rem;
}
.login-card label { margin-bottom: 0.8rem; }
.login-card button { width: 100%; padding: 0.7rem 1.2rem; margin-top: 0.5rem; }

/* =========================================================================
 *  LANDING
 * ========================================================================= */

.hero {
    padding: clamp(3.5rem, 8vh, 6rem) 0 clamp(2.5rem, 6vh, 4.5rem);
    position: relative;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.8rem;
    align-items: center;
}

@media (min-width: 960px) {
    .hero-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr);
        gap: 4rem;
    }
}

.hero-content { min-width: 0; }
.hero-preview { min-width: 0; }

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.9rem;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 999px;
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rose-2);
    margin-bottom: 1.4rem;
    font-weight: 600;
}
.hero-eyebrow svg { width: 14px; height: 14px; }

.hero h1 {
    max-width: 17ch;
    font-size: clamp(2.4rem, 6vw, 4.6rem);
    font-variation-settings: "SOFT" 120, "WONK" 1, "opsz" 144;
    font-weight: 340;
    letter-spacing: -0.035em;
    line-height: 1.02;
    color: #faf5ff;
}

.hero h1 .gradient {
    background: linear-gradient(130deg, var(--rose), var(--sparkle));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-style: italic;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}

.hero .lead {
    margin-top: 1.4rem;
    max-width: 52ch;
    font-size: clamp(1rem, 1.1vw, 1.1rem);
    color: var(--lavender-2);
    line-height: 1.6;
}

.hero-cta { margin-top: 2rem; display: flex; gap: 0.7rem; flex-wrap: wrap; }

/* Hero preview: endpoint-cycling code card */

.preview-card {
    position: relative;
    background: linear-gradient(180deg, rgba(12, 8, 36, 0.94), rgba(8, 4, 24, 0.86));
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(139, 92, 246, 0.22);
    overflow: hidden;
}
.preview-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.45), transparent 45%, rgba(255, 140, 199, 0.4));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.preview-card .pc-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1.1rem;
    border-bottom: 1px solid var(--border);
    color: var(--lavender-2);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}
.preview-card .dots { display: inline-flex; gap: 0.3rem; flex-shrink: 0; }
.preview-card .dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--surface-3);
}
.preview-card .dots span:nth-child(1) { background: #ff7a95; }
.preview-card .dots span:nth-child(2) { background: var(--sparkle); }
.preview-card .dots span:nth-child(3) { background: var(--good); }

.preview-card .pc-endpoint {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--lavender-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.preview-card .pc-endpoint::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 8px rgba(116, 227, 169, 0.55);
    flex-shrink: 0;
}

.pc-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.pc-tabs::-webkit-scrollbar { display: none; }
.pc-tabs button {
    background: transparent;
    color: var(--lavender-2);
    border: 1px solid transparent;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    box-shadow: none;
    white-space: nowrap;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.pc-tabs button:hover { color: #f5ecff; transform: none; box-shadow: none; }
.pc-tabs button[aria-selected="true"] {
    color: #faf5ff;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-2);
}

.pc-panels {
    position: relative;
    min-height: 250px;
    padding: 1rem 0 1.1rem;
}
.pc-panel { display: none; padding: 0 1.2rem; }
.pc-panel.active { display: block; }
.pc-panel pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 0.8rem;
    line-height: 1.7;
    overflow-x: auto;
    color: #ece3ff;
}

/* Sections */
.section { padding: clamp(3rem, 7vh, 5rem) 0; }
.section h2 {
    font-size: clamp(1.7rem, 3.4vw, 2.5rem);
    font-variation-settings: "SOFT" 100, "opsz" 120;
    font-weight: 380;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}
.section-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--rose-2);
    font-weight: 600;
    margin-bottom: 0.55rem;
}
.section-lead {
    max-width: 55ch;
    font-size: 1rem;
    color: var(--lavender-2);
    margin-bottom: 2.2rem;
}

/* Model grid — explicit column counts so 4 cards never orphan */
.model-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}
@media (max-width: 1080px) { .model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .model-grid { grid-template-columns: 1fr; } }

.model-card {
    padding: 1.6rem 1.55rem 1.5rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 280ms ease;
}
.model-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-2);
}
.model-card::after {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    background: radial-gradient(closest-side, rgba(255, 140, 199, 0.2), transparent);
    filter: blur(8px);
    pointer-events: none;
}

.model-card .kicker {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--lavender-2);
    margin-bottom: 0.55rem;
}

.model-card h3 {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 1.6vw, 1.55rem);
    font-variation-settings: "SOFT" 100, "opsz" 72;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: #faf5ff;
    margin-bottom: 0.2rem;
}

.model-card .tag {
    color: var(--rose-2);
    font-size: 0.86rem;
    margin-bottom: 0.85rem;
    font-style: italic;
    font-family: var(--font-display);
    font-variation-settings: "opsz" 36;
}

.model-card .desc {
    color: var(--lavender-2);
    margin-bottom: 1.1rem;
    font-size: 0.92rem;
    flex: 1;
}

.model-card .meta {
    display: flex;
    gap: 1.2rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--lavender-2);
    flex-wrap: wrap;
}
.model-card .meta b    { color: #f5ecff; font-weight: 600; }
.model-card .meta code { font-size: 0.78rem; }

/* Features — explicit column counts down to single column */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}
@media (max-width: 1040px) { .feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 440px)  { .feature-grid { grid-template-columns: 1fr; } }

.feature { padding: 1.15rem 1.2rem 1.1rem; }
.feature .icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.22), rgba(255, 140, 199, 0.15));
    display: grid;
    place-items: center;
    color: #faf5ff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.65rem;
    border: 1px solid var(--border-2);
}
.feature h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: #f5ecff;
    margin-bottom: 0.2rem;
    font-weight: 450;
}
.feature p { margin: 0; font-size: 0.88rem; }

/* Quick-start code tabs */
.snippet-card {
    padding: 0;
    overflow: hidden;
}
.snippet-tabs {
    display: flex;
    gap: 0.3rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(8, 4, 24, 0.3);
    overflow-x: auto;
    scrollbar-width: none;
}
.snippet-tabs::-webkit-scrollbar { display: none; }
.snippet-tabs button {
    background: transparent;
    color: var(--lavender-2);
    border: 1px solid transparent;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    box-shadow: none;
    white-space: nowrap;
}
.snippet-tabs button:hover { color: #f5ecff; transform: none; }
.snippet-tabs button[aria-selected="true"] {
    color: #f5ecff;
    background: var(--surface-3);
    border-color: var(--border-2);
    box-shadow: inset 0 -1px 0 var(--rose-2);
}
.snippet-body {
    padding: 1.2rem 1.3rem 1.4rem;
    min-height: 320px;
}
.snippet-body pre {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.7;
}
.snippet-panel { display: none; }
.snippet-panel.active { display: block; }

.quickstart-foot { margin-top: 1.2rem; font-size: 0.9rem; }

/* Footer */
footer.site-foot {
    padding: 2.5rem 0 3.5rem;
    border-top: 1px solid var(--border);
    margin-top: 3.5rem;
    color: var(--lavender-2);
    font-size: 0.86rem;
}
footer.site-foot .row {
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
footer.site-foot .logo-row {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-variation-settings: "opsz" 48;
    font-size: 0.98rem;
    color: #f5ecff;
}
footer.site-foot img { width: 22px; height: 22px; }

/* =========================================================================
 *  KEY DASHBOARD (public, user-facing)
 * ========================================================================= */

.keydash {
    padding: 3rem 0;
}

.keydash-prompt {
    max-width: 640px;
    margin: 3rem auto;
    padding: 2.4rem 2.2rem;
}
.keydash-prompt h2 { margin-bottom: 0.8rem; font-weight: 400; }
.keydash-prompt p { margin-bottom: 1.4rem; }
.keydash-prompt .row { gap: 0.7rem; }
.keydash-prompt .row input { flex: 1; }

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

.keydash-meta {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-end;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.keydash-meta h1 {
    font-size: clamp(1.7rem, 3.5vw, 2.5rem);
    font-weight: 400;
    font-variation-settings: "SOFT" 120, "opsz" 120;
    margin: 0;
}
.keydash-meta .prefix {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--lavender-2);
}

/* =========================================================================
 *  RESPONSIVE
 * ========================================================================= */

@media (max-width: 760px) {
    .top .inner { flex-wrap: wrap; gap: 0.6rem; }
    .top nav { order: 3; flex-basis: 100%; gap: 1rem; overflow-x: auto; padding-bottom: 0.2rem; }
    .top nav::-webkit-scrollbar { display: none; }
    .top .sign-in { margin-left: auto; }

    .two-col { grid-template-columns: 1fr; }

    /* Tables become card stacks */
    table, thead, tbody, tr, td, th { display: block; }
    thead { display: none; }
    tr {
        display: block;
        padding: 0.9rem 1rem;
        margin-bottom: 0.7rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
    }
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        border: none;
        padding: 0.35rem 0;
        text-align: right;
    }
    td:before {
        content: attr(data-label);
        color: var(--lavender-2);
        font-size: 0.74rem;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        text-align: left;
        flex-shrink: 0;
    }
    td.actions { justify-content: flex-end; padding-top: 0.7rem; }
    .table-wrap { overflow: visible; margin: 0; padding: 0; }
}

@media (max-width: 480px) {
    .card { padding: 1.1rem 1.2rem; }
    .stat { padding: 0.9rem 1.1rem; }
    .stat .value { font-size: 1.8rem; }
    .login-card { padding: 2rem 1.5rem; }
    .hero-eyebrow { font-size: 0.68rem; letter-spacing: 0.12em; }
    .hero h1 { max-width: 14ch; }
    .snippet-body { min-height: 280px; padding: 1rem 1.1rem 1.2rem; }
    .pc-panels { min-height: 220px; }
    .pc-panel { padding: 0 1rem; }
}

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    body::before, body::after { animation: none; }
    .model-card:hover { transform: none; }
    * { transition: none !important; }
}

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
    background: rgba(217, 200, 255, 0.12);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(217, 200, 255, 0.22); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Selection */
::selection { background: rgba(192, 132, 252, 0.35); color: #faf5ff; }
