:root {
    --accent: #e85d4c;
    --accent-hover: #d14a3a;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-page: #fafafa;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #22c55e;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    margin: 0;
}

/* ── Public layout (landing) ── */

.public-body {
    background: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.public-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    max-width: 1200px;
}

.brand {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand:hover {
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a,
.btn-link-nav {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-links a:hover,
.btn-link-nav:hover {
    color: var(--text-primary);
}

.btn-primary-outline {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary-outline:hover {
    background: var(--accent);
    color: white;
}

.public-footer {
    margin-top: auto;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Hero ── */

.hero {
    padding: 5rem 0 4rem;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    background: var(--border-light);
    color: var(--text-secondary);
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.25rem;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.btn-hero-primary {
    background: var(--text-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-hero-primary:hover {
    background: #333;
    color: white;
}

.btn-hero-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    cursor: pointer;
}

.btn-hero-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.hero-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--danger); }

.status-sep { color: var(--border); }

/* ── Features ── */

.features {
    padding: 3rem 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    height: 100%;
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.5;
}

/* ── Models section ── */

.models-section {
    padding: 3rem 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.models-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.model-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.625rem 1rem;
}

.model-name {
    font-family: ui-monospace, monospace;
    font-size: 0.875rem;
}

.model-tag {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--border-light);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

/* ── CTA ── */

.cta-section {
    padding: 4rem 0 5rem;
}

.cta-section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cta-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ── Auth modal ── */

.auth-modal .modal-content {
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 0.5rem;
}

.auth-tabs {
    border: none;
    gap: 0.25rem;
}

.auth-tabs .nav-link {
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.auth-tabs .nav-link.active {
    background: var(--border-light);
    color: var(--text-primary);
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.btn-auth {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.btn-auth:hover {
    background: var(--accent-hover);
    color: white;
}

/* ── App layout (dashboard) ── */

.app-body {
    background: var(--bg-page);
    min-height: 100vh;
}

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.app-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}

.breadcrumb-nav {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.breadcrumb-nav .sep {
    margin: 0 0.375rem;
}

.app-nav-links {
    display: flex;
    gap: 1.5rem;
}

.app-nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding-bottom: 0.25rem;
}

.app-nav-links a:hover {
    color: var(--text-primary);
}

.app-nav-links a.active {
    color: var(--accent);
}

.app-nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #86efac;
    color: #166534;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.app-main {
    max-width: 1200px;
}

/* ── Page components ── */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.page-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
    max-width: 600px;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.panel-title {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-value-sm {
    font-size: 0.875rem;
    font-weight: 500;
}

.quick-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn-accent-outline {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-accent-outline:hover {
    background: var(--accent);
    color: white;
}

.model-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.model-list li {
    padding: 0.375rem 0;
}

.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.6;
    margin: 0;
}

.code-block code {
    font-family: ui-monospace, 'Cascadia Code', monospace;
}

/* ── API Keys table (Groq-style) ── */

.api-keys-table {
    width: 100%;
}

.api-keys-header,
.api-keys-row {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 0.9fr 0.9fr 0.8fr 1fr 80px;
    align-items: center;
    padding: 0.875rem 1.5rem;
    gap: 0.5rem;
}

.api-keys-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.api-keys-row {
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.api-keys-row:last-child {
    border-bottom: none;
}

.api-keys-row .col-name {
    color: var(--text-primary);
    font-weight: 500;
}

.api-keys-row code {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.col-actions {
    display: flex;
    gap: 0.375rem;
    justify-content: flex-end;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--border-light);
}

.btn-icon.btn-delete:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--accent);
}

.api-keys-empty {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.key-reveal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--border-light);
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-top: 0.75rem;
}

.key-reveal code {
    flex: 1;
    word-break: break-all;
    font-size: 0.8125rem;
}

/* ── Docs ── */

.docs-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
}

.docs-nav {
    position: sticky;
    top: 5rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.docs-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.375rem 0;
}

.docs-nav a:hover {
    color: var(--accent);
}

.docs-section {
    margin-bottom: 3rem;
}

.docs-section h2 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-top: 0.5rem;
}

.docs-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem;
}

.docs-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.endpoint-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.endpoint-badge .method {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.endpoint-badge .method.post {
    background: #dbeafe;
    color: #1d4ed8;
}

.endpoint-badge .method.get {
    background: #dcfce7;
    color: #15803d;
}

.docs-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* ── Chat (existing) ── */

html {
    font-size: 14px;
}

.chat-card {
    max-width: 900px;
    margin: 0 auto;
}

.chat-messages {
    min-height: 420px;
    max-height: 60vh;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-message {
    display: flex;
    margin-bottom: 1rem;
}

.chat-message-user {
    justify-content: flex-end;
}

.chat-message-assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message-user .chat-bubble {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-assistant .chat-bubble {
    background: #fff;
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.25rem;
}

.chat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    padding-left: 0.25rem;
}

pre code {
    font-size: 0.85rem;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .api-keys-header {
        display: none;
    }

    .api-keys-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
        padding: 1rem 1.5rem;
    }

    .col-actions {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .app-nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}
