/* Quiet Interface — minimal chrome, typography-first, progressive disclosure */

:root {
    --bg: #fafafa;
    --fg: #1a1a1a;
    --fg-muted: #666;
    --border: #e5e5e5;
    --accent: #e74c3c;
    --accent-soft: #fdecea;
    --success: #22c55e;
    --input-bg: #fff;
    --msg-user-bg: #f0f0f0;
    --msg-bot-bg: #fff;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --radius: 12px;
    --max-width: 720px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d0d0d;
        --fg: #e5e5e5;
        --fg-muted: #888;
        --border: #2a2a2a;
        --accent: #e74c3c;
        --accent-soft: #2d1515;
        --input-bg: #1a1a1a;
        --msg-user-bg: #1a1a1a;
        --msg-bot-bg: #111;
    }
}

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

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Header */
#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    font-size: 24px;
}

.title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#model-picker {
    font-family: var(--font);
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--fg);
    cursor: pointer;
    outline: none;
}

.header-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--fg);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.header-btn:hover {
    background: var(--border);
}

#btn-new { font-size: 18px; }
#btn-settings { font-size: 14px; }

#btn-logout {
    font-family: var(--font);
    font-size: 13px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--fg);
    cursor: pointer;
}

#btn-logout:hover {
    background: var(--border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.connected { background: #22c55e; }
.status-dot.disconnected { background: #ef4444; }
.status-dot.connecting { background: #f59e0b; }

/* Messages */
#messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--fg-muted);
}

.welcome-logo {
    font-size: 48px;
}

.welcome p {
    font-size: 17px;
}

.message {
    margin-bottom: 16px;
    max-width: 85%;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    margin-left: auto;
}

.message.bot {
    margin-right: auto;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: var(--radius);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-bubble {
    background: var(--msg-user-bg);
    border-bottom-right-radius: 4px;
}

.message.bot .message-bubble {
    background: var(--msg-bot-bg);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.bot .message-bubble.streaming {
    border-color: var(--accent);
    border-style: solid;
}

.tool-hint {
    font-size: 12px;
    color: var(--fg-muted);
    font-family: var(--mono);
    padding: 4px 0;
}

.thinking-content {
    font-size: 13px;
    color: var(--fg-muted);
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 0 8px 8px 0;
    max-height: 200px;
    overflow-y: auto;
}
.thinking-label {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
}
.thinking-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.5;
}

/* Code blocks */
.message-bubble code {
    font-family: var(--mono);
    font-size: 13px;
    background: var(--border);
    padding: 1px 4px;
    border-radius: 3px;
}

.message-bubble pre {
    margin: 8px 0;
    padding: 10px;
    background: var(--border);
    border-radius: 6px;
    overflow-x: auto;
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

/* Images in messages (for screenshots + generated images) */
.message-bubble img {
    max-width: 100%;
    border-radius: 6px;
    margin: 6px 0;
    cursor: pointer;
}

.message-bubble img:hover {
    opacity: 0.9;
}

/* Image lightbox */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

#lightbox.active {
    display: flex;
}

#lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
}

/* File attachment indicator */
.file-attachment {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-bottom: 4px;
    background: var(--border);
    border-radius: 4px;
    font-size: 12px;
    color: var(--fg-muted);
}

.file-attachment .remove {
    cursor: pointer;
    color: var(--accent);
    margin-left: auto;
}

/* Browser action progress */
.browser-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 4px 0;
    background: var(--accent-soft);
    border-radius: 6px;
    font-size: 12px;
    color: var(--fg-muted);
}

.browser-action .spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Input */
#input-area {
    padding: 12px 16px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

#input-area.drag-over {
    background: var(--accent-soft);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    transition: border-color 0.15s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

#btn-attach {
    border: none;
    background: transparent;
    color: var(--fg-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

#btn-attach:hover { color: var(--accent); }

#input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--fg);
    resize: none;
    max-height: 120px;
}

#input::placeholder {
    color: var(--fg-muted);
}

#btn-send {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

#btn-send:hover {
    opacity: 0.85;
}

#btn-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#file-input { display: none; }

/* Scrollbar */
#messages::-webkit-scrollbar {
    width: 6px;
}

#messages::-webkit-scrollbar-track {
    background: transparent;
}

#messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Mobile */
@media (max-width: 600px) {
    :root { --max-width: 100%; }
    #header { padding: 10px 12px; }
    #messages { padding: 12px; }
    .message { max-width: 92%; }
    #input-area { padding: 8px 12px 16px; }
    #input { font-size: 16px; }
    #model-picker { max-width: 100px; font-size: 11px; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #input-area { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ---- Landing Screen ---- */
#app.app-landing {
    max-width: none;
}

.landing-screen {
    overflow-y: auto;
    height: 100%;
}

.landing-nav {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-nav-logo {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.landing-nav-actions {
    display: flex;
    gap: 10px;
}

.btn-outline {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--fg);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-outline:hover {
    background: var(--border);
}

.landing-hero {
    max-width: 700px;
    margin: 0 auto;
    padding: 80px 24px 60px;
    text-align: center;
}

.landing-hero h1 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--fg);
    margin-bottom: 20px;
}

.landing-hero-sub {
    font-size: 18px;
    color: var(--fg-muted);
    line-height: 1.6;
    max-width: 540px;
    margin: 0 auto 32px;
}

.landing-hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.landing-hero-actions .btn-primary,
.landing-hero-actions .btn-outline {
    padding: 12px 28px;
    font-size: 16px;
    width: auto;
}

/* Features */
.landing-features {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 24px;
}

.landing-features h2,
.landing-capabilities h2,
.landing-steps h2,
.landing-bottom-cta h2 {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    color: var(--fg);
}

.landing-section-sub {
    text-align: center;
    color: var(--fg-muted);
    font-size: 16px;
    margin-bottom: 32px;
}

.landing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.landing-card {
    padding: 28px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-bg);
    transition: transform 0.15s, box-shadow 0.15s;
}

.landing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.landing-card-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.landing-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--fg);
}

.landing-card p {
    font-size: 14px;
    color: var(--fg-muted);
    line-height: 1.6;
}

/* Capabilities */
.landing-capabilities {
    background: var(--accent-soft);
    padding: 60px 24px;
}

.landing-caps-grid {
    max-width: 700px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.landing-cap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--input-bg);
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    color: var(--fg);
    border: 1px solid var(--border);
}

/* Steps */
.landing-steps {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 24px;
}

.landing-steps-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.landing-step {
    text-align: center;
    padding: 24px;
}

.landing-step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.landing-step h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--fg);
}

.landing-step p {
    font-size: 14px;
    color: var(--fg-muted);
    line-height: 1.5;
}

/* Bottom CTA */
.landing-bottom-cta {
    text-align: center;
    padding: 80px 24px;
    border-top: 1px solid var(--border);
}

.landing-bottom-cta p {
    font-size: 16px;
    color: var(--fg-muted);
    margin-bottom: 24px;
}

.landing-bottom-cta .btn-primary {
    width: auto;
    padding: 14px 32px;
    font-size: 16px;
}

/* Footer */
.landing-footer {
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--fg-muted);
    border-top: 1px solid var(--border);
}

/* Use Cases section on landing */
.landing-usecases {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 24px;
}

.landing-usecases-more {
    text-align: center;
    margin-top: 32px;
}

.landing-usecases-more .btn-outline {
    display: inline-block;
    text-decoration: none;
}

/* Use Cases page */
.landing-nav-logo {
    text-decoration: none;
    color: var(--fg);
}

.usecases-hero {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 24px 32px;
    text-align: center;
}

.usecases-hero h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--fg);
    margin-bottom: 12px;
}

.usecases-filter {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.uc-filter {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--fg-muted);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.uc-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.uc-filter.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.usecases-grid-wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

.usecases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.uc-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-bg);
    transition: transform 0.15s, box-shadow 0.15s;
}

.uc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.uc-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.uc-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--fg);
    margin-bottom: 8px;
}

.uc-card p {
    font-size: 14px;
    color: var(--fg-muted);
    line-height: 1.6;
}

/* Landing mobile */
@media (max-width: 600px) {
    .landing-hero { padding: 48px 20px 40px; }
    .landing-hero h1 { font-size: 28px; }
    .landing-hero-sub { font-size: 15px; }
    .landing-hero-actions { flex-direction: column; align-items: center; }
    .landing-hero-actions .btn-primary,
    .landing-hero-actions .btn-outline { width: 100%; max-width: 280px; }
    .landing-features,
    .landing-capabilities,
    .landing-usecases,
    .landing-steps { padding: 40px 20px; }
    .landing-bottom-cta { padding: 48px 20px; }
    .usecases-hero { padding: 40px 20px 24px; }
    .usecases-hero h1 { font-size: 28px; }
    .usecases-grid { grid-template-columns: 1fr; }
}

/* ---- Auth Screen ---- */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    text-align: center;
}

.auth-logo {
    font-size: 64px;
    margin-bottom: 24px;
    display: block;
}

.auth-container h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--fg);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 15px;
    color: var(--fg);
    background: var(--input-bg);
    outline: none;
    transition: border-color 0.15s;
}

.auth-form input:focus {
    border-color: var(--accent);
}

.auth-form input::placeholder {
    color: var(--fg-muted);
}

.auth-form button {
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.auth-switch {
    margin-top: 16px;
    font-size: 13px;
    color: var(--fg-muted);
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-error {
    margin-top: 16px;
    padding: 10px 12px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    color: #c00;
    font-size: 13px;
    display: none;
}

.auth-error.show {
    display: block;
}

/* ---- Chat Screen ---- */
.chat-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* ---- Settings Panel ---- */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow-y: auto;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.settings-content {
    padding: 16px;
    position: relative;
}

.settings-content h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.settings-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--fg);
}

.settings-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section p {
    font-size: 13px;
    color: var(--fg-muted);
    margin-bottom: 8px;
}

.settings-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    color: var(--fg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close:hover {
    background: var(--border);
}

/* ---- Usage / Quota Bars ---- */
.usage-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0;
}

.usage-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.usage-fill.danger {
    background: var(--accent);
}

.quota-section {
    margin-bottom: 4px;
}

.quota-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--fg);
    margin-bottom: 8px;
}

.quota-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.quota-left {
    flex: 0 0 auto;
    min-width: 110px;
}

.quota-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    display: block;
    line-height: 1.2;
}

.quota-sub {
    font-size: 11px;
    color: var(--fg-muted);
    display: block;
    line-height: 1.3;
}

.quota-right {
    flex: 1;
    min-width: 0;
}

.quota-pct {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--fg-muted);
    white-space: nowrap;
}

.quota-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.usage-info-text {
    font-size: 13px;
    color: var(--fg-muted);
    padding: 4px 0;
}

/* ---- API Key Input ---- */
.settings-hint {
    font-size: 12px;
    color: var(--fg-muted);
    margin-bottom: 8px;
}

.key-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.key-input-row input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--fg);
    background: var(--input-bg);
    outline: none;
}

.key-input-row input:focus {
    border-color: var(--accent);
}

.btn-small {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-small:hover { opacity: 0.85; }

.key-status {
    font-size: 12px;
    color: var(--fg-muted);
    margin-top: 6px;
    min-height: 16px;
}

.key-status.success { color: var(--success); }
.key-status.error { color: var(--accent); }

/* ---- Buttons ---- */
.btn-primary {
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    width: 100%;
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--border);
    color: var(--fg);
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
}

.btn-secondary:hover {
    background: #ddd;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    color: var(--fg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border);
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* ---- Pricing Cards ---- */
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.pricing-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    background: var(--input-bg);
}

.pricing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pricing-card.popular {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.pricing-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.pricing-card .price {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.pricing-card .price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--fg-muted);
}

.pricing-card .tokens {
    font-size: 13px;
    color: var(--fg-muted);
    margin-bottom: 6px;
}

.pricing-card .models {
    font-size: 13px;
    color: var(--fg-muted);
    margin-bottom: 16px;
}

.btn-subscribe {
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.15s;
}

.btn-subscribe:hover {
    opacity: 0.85;
}

.pricing-card.popular .btn-subscribe {
    background: var(--accent);
}

/* ---- Model Picker Disabled State ---- */
#model-picker option:disabled {
    color: var(--fg-muted);
}

/* ---- Mobile Settings ---- */
@media (max-width: 600px) {
    .settings-panel {
        width: 100%;
        height: auto;
        position: absolute;
        top: 100%;
        right: 0;
        border-left: none;
        border-bottom: 1px solid var(--border);
    }

    .auth-container {
        padding: 24px;
    }

    .pricing-cards {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }
}

.live-cursor{display:inline-block;width:2px;height:1em;background:#10b981;border-radius:1px;margin-left:2px;vertical-align:text-bottom;animation:cursor-blink .8s ease-in-out infinite}@keyframes cursor-blink{0%,100%{opacity:1}50%{opacity:0}}.typing-dots{display:flex;align-items:center;gap:4px;padding:12px 18px;border-radius:16px;border-bottom-left-radius:4px;background:var(--msg-bot-bg,#1e2939);width:fit-content}.typing-dots span{width:6px;height:6px;background:#6b7280;border-radius:50%;animation:typing-bounce 1.2s ease-in-out infinite}.typing-dots span:nth-child(2){animation-delay:.15s}.typing-dots span:nth-child(3){animation-delay:.3s}@keyframes typing-bounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-6px)}}.think-spinner{display:inline-block;width:14px;height:14px;border:2px solid #10b981;border-top-color:transparent;border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.thinking-block{margin-bottom:8px;border-radius:10px;background:rgba(16,185,129,.06);border:1px solid rgba(16,185,129,.15);overflow:hidden}.thinking-block summary{display:flex;align-items:center;gap:8px;padding:8px 12px;cursor:pointer;font-size:12px;color:#6ee7b7;font-style:italic;user-select:none;list-style:none}.thinking-block summary::-webkit-details-marker{display:none}.thinking-block .thinking-text{padding:8px 14px 12px;font-size:12px;line-height:1.6;color:#9ca3af;font-style:italic;white-space:pre-wrap;max-height:50vh;overflow-y:auto}.chat-media-img{max-width:100%;max-height:400px;border-radius:10px;border:1px solid rgba(255,255,255,.1);margin:8px 0;cursor:pointer;display:block}.chat-media-video{max-width:100%;max-height:400px;border-radius:10px;border:1px solid rgba(255,255,255,.1);margin:8px 0;display:block}.message-bubble pre{background:rgba(0,0,0,.3);border-radius:8px;padding:12px;overflow-x:auto;margin:8px 0}.message-bubble code{background:rgba(0,0,0,.25);border-radius:3px;padding:1px 5px;font-size:.9em}.message-bubble pre code{background:none;padding:0}