/* ShareAI — modern design system
   Single shared stylesheet. Class names are kept stable so every template
   (public, auth, chat, contributor, admin) keeps working without markup churn. */

:root {
    /* Palette */
    --bg: #06070d;
    --bg-2: #080a13;
    --surface: rgba(255, 255, 255, .035);
    --surface-2: rgba(255, 255, 255, .055);
    --panel: rgba(17, 20, 32, .62);
    --panel-strong: rgba(20, 24, 38, .9);
    --text: #f4f6fc;
    --muted: #98a1ba;
    --faint: #6b7390;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);

    /* Accents */
    --primary: #7c5cff;
    --primary-2: #a78bfa;
    --indigo: #6366f1;
    --cyan: #22d3ee;
    --green: #34e0a1;
    --yellow: #f7c65c;
    --red: #ff6b7a;

    /* Gradients */
    --grad-primary: linear-gradient(135deg, #a78bfa 0%, #7c5cff 45%, #6366f1 100%);
    --grad-accent: linear-gradient(135deg, #a78bfa, #22d3ee);
    --grad-text: linear-gradient(120deg, #ffffff 0%, #d6ccff 45%, #9fb8ff 100%);

    /* Elevation */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .25);
    --shadow: 0 24px 70px rgba(0, 0, 0, .45);
    --shadow-glow: 0 18px 50px rgba(124, 92, 255, .28);

    /* Shape & motion */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Sora", var(--font);
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-family: var(--font);

    color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    position: relative;
    overflow-x: hidden;
}

/* Aurora background — soft drifting orbs + faint grid, fixed behind everything. */
body::before {
    content: "";
    position: fixed;
    inset: -20vmax;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(38vmax 38vmax at 12% -5%, rgba(124, 92, 255, .26), transparent 60%),
        radial-gradient(32vmax 32vmax at 92% 8%, rgba(34, 211, 238, .12), transparent 60%),
        radial-gradient(40vmax 40vmax at 75% 95%, rgba(99, 102, 241, .16), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    animation: aurora 24s var(--ease) infinite alternate;
}

/* Fine grain + subtle grid overlay for depth. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .5;
    background-image:
        linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 70%);
    mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 70%);
}

@keyframes aurora {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(0, -3%, 0) scale(1.08); }
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(124, 92, 255, .4); color: #fff; }

/* Custom scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 100px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .24); background-clip: content-box; }

/* ───────────────────────── Header / nav ───────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(16px, 4vw, 40px);
    transition: padding .3s var(--ease), background .3s var(--ease), border-color .3s var(--ease);
    border-bottom: 1px solid transparent;
}
.site-header.scrolled {
    padding-top: 10px;
    padding-bottom: 10px;
    background: rgba(8, 10, 19, .72);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-bottom-color: var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.02em; font-size: 1.1rem; font-family: var(--font-display); }
.brand-mark {
    width: 34px; height: 34px; border-radius: 11px;
    display: grid; place-items: center;
    background: var(--grad-primary);
    color: #fff; font-weight: 900;
    box-shadow: 0 8px 22px rgba(124, 92, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-mark.large { width: 56px; height: 56px; border-radius: 18px; font-size: 1.4rem; }
.site-header nav { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.site-header nav a, .site-header nav .link-button {
    padding: 8px 13px; border-radius: 100px; transition: .18s var(--ease);
    font-weight: 550;
}
.site-header nav a:hover, .link-button:hover { color: var(--text); background: var(--surface); }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; color: var(--muted); }

.page-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; min-height: calc(100vh - 220px); }

.site-footer {
    width: min(1180px, calc(100% - 36px));
    margin: 80px auto 0; padding: 28px 0 40px;
    border-top: 1px solid var(--line);
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
    color: var(--muted); font-size: .82rem;
}
.site-footer a:hover { color: var(--text); }

/* ───────────────────────── Glass surfaces ───────────────────────── */
.glass {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
}

/* ───────────────────────── Typography ───────────────────────── */
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--primary-2); font-size: .72rem; font-weight: 700;
    letter-spacing: .18em; text-transform: uppercase; margin-bottom: 18px;
}
.eyebrow::before {
    content: ""; width: 22px; height: 1px;
    background: linear-gradient(90deg, var(--primary-2), transparent);
}
.section-heading.centered .eyebrow { justify-content: center; }
.section-heading.centered .eyebrow::before { display: none; }

h1 {
    font-size: clamp(2.6rem, 6vw, 5rem); line-height: 1; letter-spacing: -.045em; margin-bottom: 24px;
    font-weight: 800;
    background: var(--grad-text);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); letter-spacing: -.035em; line-height: 1.06; font-weight: 750; }
h3 { letter-spacing: -.02em; }

/* ───────────────────────── Hero ───────────────────────── */
.hero { padding: clamp(56px, 9vw, 96px) 0 72px; display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(36px, 6vw, 72px); align-items: center; }
.hero-copy > p { color: var(--muted); font-size: 1.16rem; line-height: 1.7; max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 24px; }
.trust-row { display: flex; gap: 10px 22px; flex-wrap: wrap; color: var(--muted); font-size: .84rem; }
.trust-row span { display: inline-flex; align-items: center; gap: 6px; }
.live-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; margin-bottom: 22px; border-radius: 100px;
    font-size: .76rem; font-weight: 600; color: #d7cdff;
    background: rgba(124, 92, 255, .1); border: 1px solid rgba(124, 92, 255, .28);
    backdrop-filter: blur(8px);
}
.hero-stats { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 30px 0 22px; }
.hero-stats > div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--font-display); font-size: 1.7rem; letter-spacing: -.03em; line-height: 1; }
.hero-stats span { color: var(--muted); font-size: .8rem; margin-top: 6px; }

/* ───────────────────────── Buttons ───────────────────────── */
.button {
    position: relative; overflow: hidden;
    min-height: 48px; border-radius: var(--r-md); padding: 0 22px;
    border: 1px solid transparent;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 650; font-size: .95rem; letter-spacing: -.01em;
    transition: transform .2s var(--ease-out), box-shadow .25s var(--ease), background .2s var(--ease);
}
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0); }
.button-primary {
    background: var(--grad-primary); background-size: 160% 160%; color: #fff;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.button-primary:hover { box-shadow: 0 22px 60px rgba(124, 92, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .3); }
/* Shine sweep */
.button-primary::after {
    content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent);
    transform: skewX(-18deg); transition: left .6s var(--ease);
}
.button-primary:hover::after { left: 140%; }
.button-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.button-secondary:hover { background: var(--surface-2); border-color: rgba(167, 139, 250, .5); }
.full { width: 100%; }

/* ───────────────────────── Demo mini window ───────────────────────── */
.hero-panel { border-radius: var(--r-xl); padding: 18px; transform: rotate(1.2deg); animation: float 7s var(--ease) infinite alternate; }
@keyframes float { from { transform: rotate(1.2deg) translateY(0); } to { transform: rotate(1.2deg) translateY(-12px); } }
.mini-window { background: linear-gradient(180deg, rgba(14, 17, 25, .9), rgba(10, 12, 19, .9)); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.window-top { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .73rem; margin-bottom: 22px; }
.window-top i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.window-top i:nth-child(1) { background: #ff6b7a; } .window-top i:nth-child(2) { background: #f7c65c; } .window-top i:nth-child(3) { background: #34e0a1; }
.window-top span { margin-left: auto; }
.demo-bubble { border-radius: var(--r-md); padding: 13px 16px; line-height: 1.5; margin: 12px 0; max-width: 86%; font-size: .92rem; }
.user-bubble { margin-left: auto; background: var(--grad-primary); box-shadow: var(--shadow-glow); }
.ai-bubble { background: var(--surface-2); border: 1px solid var(--line); }
.route-line { color: var(--muted); font-size: .78rem; margin: 18px 0; display: flex; gap: 9px; align-items: center; }
.pulse { width: 9px; height: 9px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 0 rgba(52, 224, 161, .5); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 224, 161, .5); } 70% { box-shadow: 0 0 0 9px rgba(52, 224, 161, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 224, 161, 0); } }
.cost-line { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.cost-line strong { color: var(--green); }

/* ───────────────────────── Sections ───────────────────────── */
.section { padding: clamp(56px, 8vw, 84px) 0; }
.section-heading { max-width: 720px; margin-bottom: 40px; }
.section-heading.centered { margin-left: auto; margin-right: auto; text-align: center; }
.section-heading p { color: var(--muted); font-size: 1.05rem; line-height: 1.65; }

/* ───────────────────────── Cards / grids ───────────────────────── */
.feature-grid, .pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.path-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.path-grid .feature-card { display: flex; flex-direction: column; }
.path-grid .feature-card .hero-actions { margin-top: auto; }
.feature-card, .price-card {
    position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px;
    background: var(--surface);
    transition: transform .3s var(--ease-out), border-color .3s var(--ease), background .3s var(--ease);
}
/* Gradient halo border on hover */
.feature-card::before, .price-card::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
    background: var(--grad-accent);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity .3s var(--ease); pointer-events: none;
}
.feature-card:hover, .price-card:hover { transform: translateY(-4px); background: var(--surface-2); }
.feature-card:hover::before, .price-card:hover::before { opacity: .7; }
.feature-card > span {
    display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
    background: rgba(124, 92, 255, .14); color: var(--primary-2); font-weight: 800; font-size: .9rem;
    border: 1px solid rgba(124, 92, 255, .25);
}
.feature-card h3 { margin: 20px 0 10px; font-size: 1.18rem; }
.feature-card p, .price-card p, .price-card li { color: var(--muted); line-height: 1.6; }

.pricing-grid { grid-template-columns: repeat(4, 1fr); align-items: stretch; }
.price-card { display: flex; flex-direction: column; }
.price-card.featured {
    border-color: rgba(124, 92, 255, .55);
    background: linear-gradient(180deg, rgba(124, 92, 255, .14), var(--surface));
    box-shadow: var(--shadow-glow);
}
.price-card.featured::before { opacity: .6; }
.popular { position: absolute; top: 14px; right: 14px; font-size: .64rem; color: var(--primary-2); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 100px; background: rgba(124, 92, 255, .14); border: 1px solid rgba(124, 92, 255, .3); }
.price { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 8px; }
.price strong { font-size: 3.2rem; letter-spacing: -.05em; font-family: var(--font-display); font-weight: 800; }
.price span { color: var(--muted); }
.price-card ul { list-style: none; padding: 0; margin: 18px 0 26px; }
.price-card li { padding: 7px 0; display: flex; align-items: center; }
.price-card li::before { content: "✓"; color: var(--green); margin-right: 10px; font-weight: 800; }
.price-card .button { margin-top: auto; }

.split-section { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(36px, 6vw, 70px); align-items: center; }
.mode-list { display: grid; gap: 12px; }
.mode-list > div { border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 18px 16px 50px; position: relative; background: var(--surface); transition: border-color .25s var(--ease), background .25s var(--ease); }
.mode-list > div:hover { background: var(--surface-2); border-color: var(--line-strong); }
.mode-list p { color: var(--muted); margin: 5px 0 0; }
.mode-dot { position: absolute; left: 20px; top: 23px; width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.mode-dot.eco { background: var(--green); color: var(--green); }
.mode-dot.smart { background: var(--primary-2); color: var(--primary-2); }
.mode-dot.pro { background: var(--yellow); color: var(--yellow); }

/* ───────────────────────── Alerts ───────────────────────── */
.alert { margin: 18px 0 0; border-radius: var(--r-md); padding: 13px 16px; border: 1px solid var(--line); font-size: .92rem; backdrop-filter: blur(8px); }
.alert-success { background: rgba(52, 224, 161, .1); color: #8ef0ce; border-color: rgba(52, 224, 161, .25); }
.alert-danger { background: rgba(255, 107, 122, .1); color: #ff9ea8; border-color: rgba(255, 107, 122, .25); }
.alert-warning { background: rgba(247, 198, 92, .1); color: #ffe0a0; border-color: rgba(247, 198, 92, .25); }
.alert-info { background: rgba(124, 92, 255, .1); color: #c9bcff; border-color: rgba(124, 92, 255, .25); }

/* ───────────────────────── Auth / payment ───────────────────────── */
.auth-wrap, .payment-wrap { min-height: 72vh; display: grid; place-items: center; padding: 56px 0; }
.auth-card, .payment-card { width: min(500px, 100%); border-radius: var(--r-xl); padding: 38px; }
.auth-card .brand-mark { margin-bottom: 22px; }
.auth-card h1, .payment-card h1 { font-size: clamp(2rem, 4vw, 2.5rem); margin-bottom: 12px; }
.auth-card p, .payment-card > p { color: var(--muted); line-height: 1.6; }
label { display: block; font-size: .82rem; color: var(--muted); margin: 20px 0 8px; font-weight: 550; }
.text-input, textarea, select {
    width: 100%; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .03); color: var(--text);
    border-radius: var(--r-md); outline: none; padding: 14px 15px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.text-input::placeholder, textarea::placeholder { color: var(--faint); }
.text-input:focus, textarea:focus, select:focus { border-color: rgba(124, 92, 255, .8); box-shadow: 0 0 0 4px rgba(124, 92, 255, .14); background: rgba(255, 255, 255, .05); }
.code-input { letter-spacing: .1em; text-transform: uppercase; font-family: var(--font-mono); }
.auth-card .button { margin-top: 18px; }
.subtle-link { display: block; color: var(--muted); font-size: .84rem; text-align: center; margin-top: 18px; }
.subtle-link:hover { color: var(--text); }

/* ───────────────────────── Dashboard ───────────────────────── */
.dashboard-head { display: flex; align-items: flex-end; justify-content: space-between; padding: clamp(40px, 6vw, 60px) 0 26px; gap: 24px; }
.dashboard-head h1 { font-size: clamp(2.6rem, 6vw, 3.6rem); margin: 0; }
.dashboard-head p { color: var(--muted); }
.balance-card { min-width: 220px; border: 1px solid var(--line); padding: 18px; border-radius: var(--r-lg); background: var(--surface); }
.balance-card > span, .compact-balance span { color: var(--muted); display: block; font-size: .72rem; letter-spacing: .04em; }
.balance-card strong { display: block; margin: 6px 0 12px; font-size: 1.4rem; font-family: var(--font-display); }
.small-button { border: 0; border-radius: var(--r-sm); background: rgba(124, 92, 255, .2); color: #cfc5ff; padding: 8px 12px; font-size: .76rem; font-weight: 700; transition: .18s var(--ease); }
.small-button:hover { background: rgba(124, 92, 255, .32); }
.small-button.muted { background: var(--surface-2); color: var(--muted); }
.small-button.muted:hover { background: rgba(255, 255, 255, .1); }

.chat-list-panel { border-radius: var(--r-xl); padding: 24px; }
.chat-list { display: grid; gap: 8px; margin-top: 18px; }
.chat-list-item { display: flex; align-items: center; justify-content: space-between; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); transition: .2s var(--ease); }
.chat-list-item:hover { background: var(--surface-2); border-color: var(--line-strong); transform: translateX(3px); }
.chat-list-item strong, .chat-list-item span { display: block; }
.chat-list-item span { color: var(--muted); font-size: .76rem; margin-top: 5px; }
.chat-list-item .arrow { font-size: 1.2rem; color: var(--primary-2); }
.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-state > div { font-size: 2.2rem; color: var(--primary-2); }
.empty-state h3 { color: var(--text); margin: 12px 0 7px; }

/* ───────────────────────── Chat ───────────────────────── */
.chat-layout { display: grid; grid-template-columns: 256px 1fr; gap: 16px; padding: 24px 0 0; min-height: calc(100vh - 200px); }
.chat-sidebar, .chat-main { border-radius: var(--r-xl); }
.chat-sidebar { padding: 20px; height: fit-content; position: sticky; top: 88px; }
.back-link { color: var(--muted); font-size: .82rem; transition: color .18s var(--ease); }
.back-link:hover { color: var(--text); }
.sidebar-title { margin: 30px 0; }
.sidebar-title span { display: block; color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 7px; }
.sidebar-title strong { display: block; line-height: 1.35; }
.compact-balance { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; }
.compact-balance strong { display: block; margin-top: 4px; font-family: var(--font-display); }
.danger-link { border: 0; background: none; color: var(--red); font-size: .78rem; width: 100%; margin-top: 18px; transition: opacity .18s var(--ease); }
.danger-link:hover { opacity: .75; }

.chat-main { overflow: hidden; display: flex; flex-direction: column; min-height: calc(100vh - 190px); }
.mode-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px; border-bottom: 1px solid var(--line); }
.mode-bar label { margin: 0; cursor: pointer; }
.mode-bar input { display: none; }
.mode-bar span { display: block; border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 13px; background: var(--surface); transition: .2s var(--ease); }
.mode-bar label:hover span { border-color: var(--line-strong); }
.mode-bar input:checked + span { border-color: rgba(124, 92, 255, .7); background: rgba(124, 92, 255, .12); box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .3); }
.mode-bar b, .mode-bar small { display: block; }
.mode-bar small { color: var(--muted); margin-top: 3px; font-size: .72rem; }
/* Unified model picker (SmartSave + every active model) */
.model-picker { display: flex; gap: 8px; padding: 16px 16px 0; flex-wrap: wrap; }
.model-opt { margin: 0; cursor: pointer; }
.model-opt input { display: none; }
.model-opt-inner { display: block; border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 14px; background: var(--surface); transition: .18s var(--ease); min-width: 120px; }
.model-opt:hover .model-opt-inner { border-color: var(--line-strong); }
.model-opt input:checked + .model-opt-inner { border-color: rgba(124, 92, 255, .7); background: rgba(124, 92, 255, .12); box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .3); }
.model-opt-inner b { display: block; font-size: .92rem; }
.model-opt-inner small { display: block; color: var(--muted); margin-top: 2px; font-size: .72rem; }

.provider-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; padding: 0 16px 14px; }
.model-search-wrap { position: relative; flex: 1 1 320px; min-width: 240px; }
.model-search-wrap .text-input { width: 100%; padding: 9px 13px; }
.model-results { position: absolute; z-index: 30; top: 100%; left: 0; right: 0; margin-top: 6px; max-height: 280px; overflow-y: auto; background: var(--panel-strong); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.model-result { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 11px 14px; color: var(--text); }
.model-result:hover { background: var(--surface-2); }
.model-result code { color: var(--primary-2); font-size: .78rem; margin-left: 6px; }
.model-result span { display: block; color: var(--muted); font-size: .72rem; margin-top: 3px; }
.model-result.muted { color: var(--muted); }
.provider-field { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: .8rem; }
.provider-field select { width: auto; min-width: 240px; padding: 8px 12px; }
.confidential-field { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: .8rem; cursor: pointer; }
.confidential-field input { width: auto; }

.messages { flex: 1; overflow-y: auto; padding: 28px; min-height: 420px; max-height: calc(100vh - 320px); }
.message-row { display: flex; gap: 13px; max-width: 850px; margin: 0 auto 24px; animation: msg-in .35s var(--ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.message-row.user { flex-direction: row-reverse; }
.message-avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: .68rem; font-weight: 800; }
.message-row.assistant .message-avatar { background: var(--grad-primary); border-color: transparent; box-shadow: 0 6px 18px rgba(124, 92, 255, .4); }
.message-body { max-width: min(78%, 720px); }
.message-content { white-space: pre-wrap; line-height: 1.7; background: var(--surface); border: 1px solid var(--line); border-radius: 5px 16px 16px 16px; padding: 14px 17px; }
.message-row.user .message-content { background: var(--grad-primary); border-color: transparent; border-radius: 16px 5px 16px 16px; box-shadow: var(--shadow-glow); }
.message-meta { color: var(--muted); font-size: .68rem; margin-top: 7px; }
.welcome-chat { height: 100%; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.welcome-chat h2 { color: var(--text); font-size: 2rem; margin: 20px 0 8px; }
.composer { padding: 16px; border-top: 1px solid var(--line); position: relative; }
.composer textarea { resize: none; min-height: 54px; max-height: 180px; padding-right: 64px; }
.composer > button { position: absolute; right: 27px; top: 26px; width: 36px; height: 36px; border-radius: 11px; border: 0; background: var(--grad-primary); color: #fff; font-weight: 900; display: grid; place-items: center; transition: .18s var(--ease); box-shadow: 0 6px 16px rgba(124, 92, 255, .4); }
.composer > button:hover:not(:disabled) { transform: translateY(-1px); }
.composer > button:disabled { opacity: .4; cursor: default; }
.composer-foot { color: var(--muted); font-size: .68rem; display: flex; justify-content: space-between; margin-top: 8px; padding: 0 4px; }
.typing .message-content::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary-2); box-shadow: 12px 0 var(--primary-2), 24px 0 var(--primary-2); animation: blink 1.1s infinite; margin: 0 24px 2px 4px; }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* ───────────────────────── Misc components ───────────────────────── */
.step-badge { display: inline-flex; border: 1px solid rgba(124, 92, 255, .45); color: var(--primary-2); border-radius: 100px; padding: 6px 12px; font-size: .68rem; font-weight: 800; letter-spacing: .08em; margin-bottom: 18px; background: rgba(124, 92, 255, .1); }
.code-save-box { border: 1px solid rgba(52, 224, 161, .3); background: rgba(52, 224, 161, .07); border-radius: var(--r-md); padding: 16px; margin: 22px 0; }
.code-save-box span, .code-save-box small { display: block; color: var(--muted); }
.code-save-box strong { display: block; margin: 8px 0; letter-spacing: .08em; word-break: break-all; font-family: var(--font-mono); font-size: 1.05rem; }
.copy-button { border: 0; color: #b7f4df; background: rgba(52, 224, 161, .14); border-radius: var(--r-sm); padding: 7px 11px; font-size: .74rem; font-weight: 650; transition: .18s var(--ease); }
.copy-button:hover { background: rgba(52, 224, 161, .24); }
.copy-button.mini { margin-left: auto; }
.payment-details { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin: 22px 0; background: var(--line); }
.payment-details > div { background: rgba(20, 24, 38, .6); padding: 14px 15px; }
.payment-details span { display: block; color: var(--muted); font-size: .7rem; margin-bottom: 4px; }
.payment-details code { font-size: .74rem; word-break: break-all; font-family: var(--font-mono); }
.address-row { position: relative; }
.warning-box { color: #ffe0a0; background: rgba(247, 198, 92, .08); border: 1px solid rgba(247, 198, 92, .22); border-radius: var(--r-md); padding: 13px 15px; font-size: .8rem; line-height: 1.5; }
.verify-form { margin-top: 22px; }
.verify-form .button { margin-top: 12px; }
.dev-note { color: var(--yellow) !important; font-size: .74rem; text-align: center; margin-top: 14px !important; }
.success-card { text-align: center; }
.success-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: 0 auto 22px; background: rgba(52, 224, 161, .12); color: var(--green); border: 1px solid rgba(52, 224, 161, .35); border-radius: 50%; font-size: 1.7rem; box-shadow: 0 0 30px rgba(52, 224, 161, .25); }
.text-page { max-width: 820px; margin: 56px auto; border-radius: var(--r-xl); padding: 40px; }
.text-page h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
.text-page h2 { font-size: 1.4rem; margin-top: 34px; }
.text-page p, .text-page li { color: var(--muted); line-height: 1.75; }

/* ───────────────────────── Tables ───────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 14px 14px; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover { background: var(--surface); }
th { color: var(--muted); font-weight: 600; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
code { color: #c9c1ff; font-family: var(--font-mono); }
.model-price-table strong { font-family: var(--font-display); }

.market-search { display: flex; gap: 10px; margin-bottom: 10px; }
.market-search .text-input { flex: 1; }
.market-search .button { flex: 0 0 auto; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin-top: 20px; }

.cost-hint { color: var(--muted); font-size: .78rem; padding: 14px 4px 0; margin: 0; line-height: 1.55; }
.cost-hint a { color: var(--primary-2); }
.cost-hint a:hover { text-decoration: underline; }

.status { display: inline-block; border-radius: 100px; padding: 4px 10px; font-size: .68rem; font-weight: 650; }
.status-paid { color: #8ef0ce; background: rgba(52, 224, 161, .12); }
.status-pending { color: #ffe0a0; background: rgba(247, 198, 92, .12); }
.status-failed { color: #ff9ea8; background: rgba(255, 107, 122, .12); }
tr.leaderboard-you { background: rgba(124, 92, 255, .1); }
tr.leaderboard-you td:first-child { box-shadow: inset 3px 0 0 var(--primary-2); }

/* ───────────────────────── Markdown ───────────────────────── */
.markdown-body { line-height: 1.65; }
.markdown-body p { margin: 0 0 10px; }
.markdown-body ul, .markdown-body ol { padding-left: 22px; margin: 0 0 10px; }
.markdown-body pre { position: relative; background: #0a0d16; border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; overflow-x: auto; margin: 12px 0; }
.markdown-body code { font-family: var(--font-mono); font-size: .82rem; }
.markdown-body :not(pre) > code { background: rgba(255, 255, 255, .07); border-radius: 6px; padding: 2px 6px; }
.code-copy-button { position: absolute; top: 8px; right: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text); border-radius: var(--r-sm); padding: 5px 10px; font-size: .68rem; transition: .15s var(--ease); }
.code-copy-button:hover { background: rgba(255, 255, 255, .12); }
.billing-history { display: grid; gap: 8px; }
.billing-history table { width: 100%; }

/* ───────────────────────── Bar chart (analytics) ───────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 200px; margin-top: 16px; padding-bottom: 22px; overflow-x: auto; }
.bar-col { flex: 1 1 0; min-width: 14px; display: flex; flex-direction: column; align-items: center; height: 100%; position: relative; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--grad-primary); min-height: 2px; transition: height .6s var(--ease-out); box-shadow: 0 0 14px rgba(124, 92, 255, .35); }
.bar-fill.empty { background: var(--surface-2); box-shadow: none; min-height: 2px; }
.bar-col:hover .bar-fill:not(.empty) { background: var(--grad-accent); }
.bar-label { position: absolute; bottom: -20px; font-size: .58rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 600px) { .bar-label { display: none; } .bar-chart { padding-bottom: 0; } }

/* ───────────────────────── Admin ───────────────────────── */
.admin-nav { margin-top: 22px; border-radius: var(--r-md); padding: 12px 16px; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .84rem; flex-wrap: wrap; }
.admin-nav a { padding: 7px 12px; border-radius: 100px; transition: .15s var(--ease); }
.admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav form { margin-left: auto; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 20px; transition: .25s var(--ease); }
.metric:hover { border-color: var(--line-strong); background: var(--surface-2); }
.metric span { color: var(--muted); font-size: .72rem; display: block; letter-spacing: .03em; }
.metric strong { font-size: 1.5rem; display: block; margin-top: 10px; font-family: var(--font-display); }
.admin-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 14px; }
.admin-panel { border-radius: var(--r-lg); padding: 22px; }
.admin-panel h2 { font-size: 1.25rem; }
.event-list { display: grid; gap: 8px; }
.event-list > div { border-bottom: 1px solid var(--line); padding: 10px 0; }
.event-list span, .event-list strong, .event-list small { display: block; }
.event-list span { color: var(--primary-2); font-size: .7rem; }
.event-list strong { margin: 3px 0; }
.event-list small { color: var(--muted); }
.action-stack { display: flex; gap: 6px; align-items: center; }
.action-stack form { display: flex; gap: 5px; }
.tiny-input { width: 84px; border: 1px solid var(--line-strong); color: var(--text); background: rgba(255, 255, 255, .04); border-radius: var(--r-sm); padding: 7px; }
.model-admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.model-card { border-radius: var(--r-lg); padding: 24px; }
.model-card h2 { font-size: 1.5rem; }
.model-key { color: var(--primary-2); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; }
.checkbox-line { display: flex; align-items: center; gap: 8px; }
.scope-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 4px; }
.scope-checks .checkbox-line { font-size: .85rem; color: var(--text); }
.small-button.danger { color: #ff9ea8; background: rgba(255, 107, 122, .12); }
.small-button.danger:hover { background: rgba(255, 107, 122, .2); }
.settings-form { display: grid; gap: 16px; max-width: 480px; }
.settings-form label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; margin: 0; }
.settings-form small { color: var(--muted); font-size: .7rem; }

/* ───────────────────────── Scroll reveal ───────────────────────── */
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); will-change: opacity, transform; }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ───────────────────────── Responsive ───────────────────────── */
@media (max-width: 900px) {
    .hero, .split-section, .chat-layout, .admin-grid, .path-grid { grid-template-columns: 1fr; }
    .pricing-grid, .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .feature-grid, .model-admin-grid { grid-template-columns: 1fr; }
    .chat-sidebar { position: static; }
    .chat-main { min-height: 70vh; }
    .messages { max-height: 60vh; }
}
@media (max-width: 600px) {
    .page-shell, .site-footer { width: min(100% - 24px, 1180px); }
    .site-header { padding: 12px 16px; }
    .site-header nav { gap: 2px; font-size: .86rem; }
    .site-header nav a, .site-header nav .link-button { padding: 7px 9px; }
    .hero { padding-top: 40px; gap: 32px; }
    .hero-panel { transform: none; animation: none; }
    .pricing-grid, .feature-grid, .metric-grid { grid-template-columns: 1fr; }
    .dashboard-head { align-items: stretch; flex-direction: column; }
    .balance-card { width: 100%; }
    .chat-layout { padding-top: 12px; }
    .chat-sidebar { display: none; }
    .mode-bar small { display: none; }
    .mode-bar span { text-align: center; padding: 9px 5px; }
    .messages { padding: 18px 12px; }
    .message-body { max-width: 88%; }
    .auth-card, .payment-card, .text-page { padding: 26px 20px; }
    .admin-nav { overflow-x: auto; }
    .admin-nav form { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
    [data-reveal] { opacity: 1; transform: none; }
}
