/* =========================================================
   Rota AI — design tokens
   Warm paper + ink, one accent (route orange). No gradients.
   ========================================================= */
:root {
  --bg: #f6f4ef;
  --bg-2: #efece5;
  --surface: #fffefb;
  --surface-2: #faf8f3;
  --surface-3: #f1eee7;
  --line: #e4e0d6;
  --line-strong: #d4cfc2;
  --hover: rgba(20, 18, 14, 0.045);
  --text: #191814;
  --text-2: #5c5a52;
  --text-3: #8d8a7f;
  --ink: #191814;
  --on-ink: #fbfaf6;
  --accent: #e2531f;
  --accent-ink: #b8400f;
  --accent-soft: #fbe9df;
  --success: #2f7d4f;
  --success-soft: #e3f1e7;
  --warning: #9a6a00;
  --warning-soft: #f8eed2;
  --danger: #b4321f;
  --danger-soft: #f8e3dd;
  --code-bg: #1c1b18;
  --shadow-sm: 0 1px 2px rgba(25, 24, 20, 0.06);
  --shadow: 0 12px 32px -12px rgba(25, 24, 20, 0.22), 0 2px 6px rgba(25, 24, 20, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311;
    --bg-2: #1a1916;
    --surface: #1c1b18;
    --surface-2: #211f1c;
    --surface-3: #2a2824;
    --line: #2f2d28;
    --line-strong: #3d3a34;
    --hover: rgba(255, 250, 240, 0.05);
    --text: #f1eee7;
    --text-2: #b4b0a5;
    --text-3: #847f74;
    --ink: #f1eee7;
    --on-ink: #191814;
    --accent: #f06a34;
    --accent-ink: #f58a5c;
    --accent-soft: #3a2117;
    --success: #6fc28f;
    --success-soft: #1d3326;
    --warning: #e0b44a;
    --warning-soft: #352b14;
    --danger: #ef7d68;
    --danger-soft: #3a1d17;
    --code-bg: #0f0e0c;
    --shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311; --bg-2: #1a1916; --surface: #1c1b18; --surface-2: #211f1c; --surface-3: #2a2824;
  --line: #2f2d28; --line-strong: #3d3a34; --hover: rgba(255, 250, 240, 0.05);
  --text: #f1eee7; --text-2: #b4b0a5; --text-3: #847f74; --ink: #f1eee7; --on-ink: #191814;
  --accent: #f06a34; --accent-ink: #f58a5c; --accent-soft: #3a2117;
  --success: #6fc28f; --success-soft: #1d3326; --warning: #e0b44a; --warning-soft: #352b14;
  --danger: #ef7d68; --danger-soft: #3a1d17; --code-bg: #0f0e0c;
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-soft); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); }
.grad-text { color: var(--accent); } /* kept for old markup: plain accent, no gradient */
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ Brand ============ */
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 16px; letter-spacing: -0.02em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; flex-shrink: 0;
}
.brand-mark svg { width: 15px; height: 15px; color: var(--accent); }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); line-height: 1; margin-top: 3px; letter-spacing: 0; }

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px; font-weight: 550; font-size: 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s; white-space: nowrap;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); }
.btn-ghost { border-color: var(--line-strong); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 9px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 7px; display: inline-grid; place-items: center;
  color: var(--text-3); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg, .btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 550; color: var(--text); }
.input {
  height: 42px; padding: 0 12px; border-radius: 8px; width: 100%;
  background: var(--surface); border: 1px solid var(--line-strong); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hover); }
.input:disabled { background: var(--surface-3); color: var(--text-2); }
.input.code-input { font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; font-size: 16px; text-align: center; height: 52px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 5px; font-size: 12px; font-weight: 550; border: 1px solid var(--line);
  color: var(--text-2); background: var(--surface-2); white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-claude { color: var(--text-2); }
.badge-claude svg { color: var(--accent); }
.badge-ok { color: var(--success); border-color: transparent; background: var(--success-soft); }
.badge-warn { color: var(--warning); border-color: transparent; background: var(--warning-soft); }
.badge-danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }

/* ============ Toast, modal, dropdown ============ */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); animation: rise 0.2s ease; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 18, 14, 0.42); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade 0.15s; }
.modal { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: calc(100vh - 32px); overflow: auto; animation: rise 0.18s ease; }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.modal-body { padding: 16px 20px 20px; }
@keyframes fade { from { opacity: 0; } }

.dropdown { position: fixed; z-index: 120; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; animation: rise 0.12s ease; }
.dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; color: var(--text); text-align: left; }
.dropdown button:hover { background: var(--hover); }
.dropdown button.danger { color: var(--danger); }
.dropdown button svg { width: 15px; height: 15px; color: var(--text-3); }
.dropdown button.danger svg { color: var(--danger); }
.dropdown hr { border: none; border-top: 1px solid var(--line); margin: 4px 0; }

/* ============ Marketing pages ============ */
.container { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
.nav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.nav.scrolled { border-bottom-color: var(--line); }
.nav .container { display: flex; align-items: center; gap: 40px; height: 64px; }
.nav-links { display: flex; gap: 28px; font-size: 14px; color: var(--text-2); flex: 1; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.nav-actions .link { font-size: 14px; color: var(--text-2); padding: 0 12px; }
.nav-actions .link:hover { color: var(--text); }

.hero { padding: 88px 0 0; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 64px; align-items: center; }
.kicker { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 6.2vw, 76px); line-height: 1; letter-spacing: -0.025em; margin-bottom: 24px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lead { font-size: 18px; color: var(--text-2); max-width: 470px; margin-bottom: 32px; line-height: 1.55; }
.hero-ctas { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-note { font-size: 13px; color: var(--text-3); margin-top: 18px; }

/* Product mock — a real slice of the chat UI, not an illustration */
.mock { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; font-size: 13.5px; }
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.mock-bar span { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.mock-bar b { margin-left: 10px; font-size: 12px; font-weight: 550; color: var(--text-3); }
.mock-body { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 16px; }
.mock-user { align-self: flex-end; max-width: 82%; background: var(--surface-3); padding: 9px 13px; border-radius: 12px 12px 3px 12px; }
.mock-ai { line-height: 1.6; color: var(--text); }
.mock-ai table { width: 100%; border-collapse: collapse; margin: 10px 0 12px; font-size: 12.5px; }
.mock-ai th, .mock-ai td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mock-ai th { color: var(--text-3); font-weight: 550; }
.mock-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-3); }
.mock-input { margin: 0 14px 14px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; color: var(--text-3); }
.mock-input .send { width: 26px; height: 26px; border-radius: 6px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; }
.mock-input .send svg { width: 14px; height: 14px; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 96px; }
.fact { padding: 26px 24px; border-left: 1px solid var(--line); }
.fact:first-child { border-left: none; padding-left: 0; }
.fact b { display: block; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; letter-spacing: -0.02em; }
.fact span { font-size: 13.5px; color: var(--text-2); }

.section { padding: 110px 0; }
.section-head { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; margin-bottom: 52px; align-items: end; }
.section-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4.2vw, 50px); line-height: 1.05; letter-spacing: -0.02em; }
.section-head p { color: var(--text-2); font-size: 16.5px; max-width: 460px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; margin-bottom: 14px; display: block; }

/* Model comparison table */
.models-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.models-table th { text-align: left; font-size: 12.5px; font-weight: 550; color: var(--text-3); padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.models-table td { padding: 20px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14.5px; }
.models-table tr:last-child td { border-bottom: none; }
.models-table .m-name { font-weight: 650; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.models-table .m-name small { font-weight: 500; font-size: 12px; color: var(--text-3); }
.models-table .m-desc { color: var(--text-2); }
.models-table .m-cost { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

.meter { display: inline-flex; gap: 3px; vertical-align: middle; }
.meter i { width: 14px; height: 5px; border-radius: 2px; background: var(--line-strong); }
.meter i.on { background: var(--accent); }

/* Route steps — stops on a line */
.route { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; padding-top: 34px; }
.route::before { content: ""; position: absolute; top: 9px; left: 9px; right: 9px; border-top: 2px dashed var(--line-strong); }
.stop { position: relative; }
.stop::before { content: ""; position: absolute; top: -34px; left: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); border: 2px solid var(--ink); box-sizing: border-box; }
.stop:last-child::before { background: var(--accent); border-color: var(--accent); }
.stop .n { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }
.stop h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; margin: 6px 0 8px; }
.stop p { color: var(--text-2); font-size: 15px; max-width: 300px; }

/* Feature list — two columns, text first */
.feature-list { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.feature-item { padding: 28px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 28px 1fr; gap: 16px; }
.feature-item:nth-child(odd) { padding-right: 40px; }
.feature-item:nth-child(even) { padding-left: 40px; border-left: 1px solid var(--line); }
.feature-item svg { width: 20px; height: 20px; color: var(--text-2); margin-top: 2px; }
.feature-item h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.feature-item p { color: var(--text-2); font-size: 14.5px; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 22px 0; font-weight: 550; font-size: 16px; display: flex; justify-content: space-between; gap: 24px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--text-3); font-weight: 300; transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 60px 24px 0; color: var(--text-2); font-size: 15px; max-width: 720px; }

.cta { background: var(--ink); color: var(--on-ink); border-radius: 16px; padding: 64px 56px; display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap; }
.cta h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4vw, 46px); line-height: 1.05; letter-spacing: -0.02em; max-width: 560px; }
.cta h2 em { color: var(--accent); }
.cta .btn { background: var(--on-ink); color: var(--ink); }
.cta .btn:hover { opacity: 0.9; }

.footer { padding: 48px 0 40px; margin-top: 80px; border-top: 1px solid var(--line); }
.footer .container { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 24px; font-size: 13.5px; color: var(--text-2); }
.footer-links a:hover { color: var(--text); }
.footer small { color: var(--text-3); font-size: 13px; }

.prose { max-width: 720px; padding-top: 64px; padding-bottom: 80px; }
.prose h1, .md.prose h1 { font-family: var(--serif); font-weight: 400; font-size: 46px; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 24px; }

/* ============ Auth ============ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--ink); color: var(--on-ink); padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand-mark { background: var(--on-ink); }
.auth-art blockquote { font-family: var(--serif); font-size: 38px; line-height: 1.12; letter-spacing: -0.015em; max-width: 460px; }
.auth-art blockquote em { color: var(--accent); }
.auth-art .points { list-style: none; display: grid; gap: 10px; margin-top: 30px; font-size: 14.5px; opacity: 0.75; }
.auth-art .points li { display: flex; gap: 10px; align-items: center; }
.auth-art .points li::before { content: ""; width: 14px; border-top: 1.5px solid var(--accent); }
.auth-art small { opacity: 0.5; font-size: 13px; }
.auth-form-side { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card > .brand { display: none; margin-bottom: 36px; }
.auth-card h1 { font-family: var(--serif); font-weight: 400; font-size: 38px; letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 6px; }
.auth-card > p { color: var(--text-2); margin-bottom: 26px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border-radius: 9px; padding: 3px; margin-bottom: 24px; }
.tabs button { height: 34px; border-radius: 7px; font-weight: 550; font-size: 13.5px; color: var(--text-2); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.form-error { color: var(--danger); font-size: 13.5px; min-height: 20px; margin-bottom: 8px; }
.auth-foot { margin-top: 20px; font-size: 12.5px; color: var(--text-3); }
.auth-foot a { text-decoration: underline; text-underline-offset: 2px; }

/* ============ App shell ============ */
.app { display: grid; grid-template-columns: 272px 1fr; height: 100vh; height: 100dvh; overflow: hidden; }
.sb-overlay { display: none; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sb-head { padding: 16px 16px 14px; }
.sb-actions { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.new-chat { height: 38px; border-radius: 8px; display: flex; align-items: center; gap: 9px; padding: 0 12px; font-weight: 550; font-size: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.new-chat:hover { border-color: var(--line-strong); }
.new-chat svg { width: 16px; height: 16px; }
.new-chat kbd { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.search input { height: 34px; padding-left: 33px; font-size: 13.5px; background: transparent; border-color: transparent; }
.search input:focus { background: var(--surface); border-color: var(--line-strong); box-shadow: none; }
.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; min-height: 0; }
.conv-group { font-size: 12px; font-weight: 550; color: var(--text-3); padding: 14px 10px 4px; }
.conv { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px 0 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.conv:hover { background: var(--hover); color: var(--text); }
.conv.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.conv .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .pin { width: 12px; height: 12px; color: var(--accent); flex-shrink: 0; display: inline-flex; }
.conv .pin svg { width: 12px; height: 12px; }
.conv .more { opacity: 0; width: 26px; height: 26px; }
.conv:hover .more, .conv.active .more { opacity: 1; }
.empty-list { padding: 28px 12px; color: var(--text-3); font-size: 13.5px; }

.sb-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.balance-card { padding: 12px; border-radius: 10px; margin-bottom: 6px; background: var(--surface); border: 1px solid var(--line); }
.balance-card .bc-label { font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.balance-card .bc-value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.balance-card .bc-value small { font-size: 12.5px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-2); width: 100%; text-align: left; }
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item svg { width: 16px; height: 16px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 4px 2px 6px; margin-top: 4px; border-top: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--on-ink); flex-shrink: 0; }
.user-chip .uc-name { font-size: 13.5px; font-weight: 550; line-height: 1.25; }
.user-chip .uc-mail { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg); }
.topbar { height: 54px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.topbar .t-title { font-weight: 550; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.menu-toggle { display: none; }
.demo-banner { background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid var(--line); font-size: 13px; text-align: center; padding: 7px 16px; }

.messages { flex: 1; overflow-y: auto; min-height: 0; }
.messages-inner { max-width: 760px; margin: 0 auto; padding: 32px 24px 40px; display: flex; flex-direction: column; gap: 28px; }
.msg { display: flex; flex-direction: column; gap: 8px; }
.msg.fresh { animation: rise 0.2s ease; }
.msg.user { align-items: flex-end; }
.msg.user .bubble { background: var(--surface-3); padding: 10px 15px; border-radius: 14px 14px 4px 14px; max-width: 82%; white-space: pre-wrap; word-wrap: break-word; }
.msg.user .attachments { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.att-thumb { width: 120px; height: 90px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.att-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.att-file svg { width: 16px; height: 16px; color: var(--danger); }
.msg.ai { flex-direction: row; gap: 14px; align-items: flex-start; }
.ai-avatar { width: 26px; height: 26px; border-radius: 6px; background: var(--ink); display: grid; place-items: center; flex-shrink: 0; margin-top: 2px; }
.ai-avatar svg { width: 13px; height: 13px; color: var(--accent); }
.ai-body { flex: 1; min-width: 0; }
.ai-actions { display: flex; gap: 2px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ai-actions .badge { margin-right: 6px; }
.ai-actions .icon-btn { width: 28px; height: 28px; }
.ai-actions .icon-btn svg { width: 15px; height: 15px; }
.ai-actions .cost { font-size: 12px; color: var(--text-3); margin-left: 6px; font-variant-numeric: tabular-nums; }
.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 14px; padding: 3px 0; }
.thinking .orb { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: beat 1.1s ease-in-out infinite; }
@keyframes beat { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.shimmer { color: var(--text-3); }
.msg-error { color: var(--danger); font-size: 14px; padding: 10px 14px; border-radius: 8px; background: var(--danger-soft); margin-top: 6px; }

/* Markdown */
.md { word-wrap: break-word; line-height: 1.7; }
.md > *:first-child { margin-top: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md table { margin: 0 0 14px; }
.md > *:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 24px 0 10px; letter-spacing: -0.015em; line-height: 1.3; font-weight: 650; }
.md h1 { font-size: 21px; } .md h2 { font-size: 18.5px; } .md h3 { font-size: 16.5px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--text-3); }
.md a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.md strong { font-weight: 650; }
.md blockquote { border-left: 2px solid var(--line-strong); padding: 2px 0 2px 14px; color: var(--text-2); }
.md hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.md :not(pre) > code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-3); padding: 2px 5px; border-radius: 4px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 8px 12px 8px 0; text-align: left; }
.md th { font-weight: 600; color: var(--text-2); font-size: 13px; }
.code-block { border-radius: 10px; overflow: hidden; margin: 0 0 14px; background: var(--code-bg); }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 6px 5px 14px; border-bottom: 1px solid rgba(255,255,255,0.07); font-size: 12px; color: #9a968b; font-family: var(--mono); }
.code-head button { font-size: 12px; color: #c9c5ba; padding: 3px 8px; border-radius: 5px; display: inline-flex; gap: 5px; align-items: center; font-family: var(--font); }
.code-head button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.code-head button svg { width: 13px; height: 13px; }
.md pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.6; color: #e8e4da; }
.md pre code { font-family: var(--mono); background: none !important; padding: 0 !important; }
.cursor::after { content: ""; display: inline-block; width: 7px; height: 15px; background: var(--accent); margin-left: 3px; vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { to { opacity: 0; } }

/* Welcome */
.welcome { max-width: 680px; margin: 0 auto; padding: 12vh 24px 30px; }
.welcome .brand-mark { display: none; }
.welcome h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4.4vw, 44px); letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 8px; }
.welcome p { color: var(--text-2); margin-bottom: 30px; }
.suggestions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.suggestion { text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); transition: border-color 0.15s; }
.suggestion:hover { border-color: var(--line-strong); }
.suggestion b { display: block; font-size: 14px; font-weight: 550; margin-bottom: 1px; }
.suggestion span { font-size: 13px; color: var(--text-3); }

/* Composer */
.composer-wrap { padding: 0 24px 16px; flex-shrink: 0; }
.composer { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-sm); transition: border-color 0.15s; position: relative; }
.composer:focus-within { border-color: var(--text-3); }
.composer.dragging { border-color: var(--accent); border-style: dashed; }
.composer textarea { width: 100%; resize: none; border: none; outline: none; background: transparent; padding: 14px 16px 4px; max-height: 220px; min-height: 52px; line-height: 1.5; font-size: 15px; }
.composer textarea::placeholder { color: var(--text-3); }
.composer-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; }
.composer-bar .spacer { flex: 1; }
.model-btn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.model-btn:hover { background: var(--hover); color: var(--text); }
.model-btn .dot { display: inline-flex; color: var(--accent); }
.model-btn .dot svg { width: 13px; height: 13px; }
.model-btn .chev { width: 13px; height: 13px; display: inline-flex; color: var(--text-3); }
.model-btn .chev svg { width: 13px; height: 13px; }
.send-btn { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); transition: opacity 0.15s; }
.send-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.send-btn svg { width: 16px; height: 16px; }
.send-btn.stop { background: var(--accent); color: #fff; }
.composer-note { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 8px; }
.pending-files { display: flex; gap: 8px; padding: 12px 12px 0; flex-wrap: wrap; }
.pending-file { position: relative; }
.pending-file img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.pending-file .att-file { height: 60px; }
.pending-file button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; }
.pending-file button svg { width: 11px; height: 11px; }

/* Model picker */
.picker { max-height: min(72vh, 600px); overflow-y: auto; position: absolute; bottom: calc(100% + 8px); left: 0; width: min(420px, calc(100vw - 24px)); z-index: 40; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; animation: rise 0.14s ease; }
.picker-head { padding: 8px 10px 6px; font-size: 12px; font-weight: 550; color: var(--text-3); }
.picker-head .dot { display: none; }
.picker-head span { font-weight: 500; }
.picker-grid { display: flex; flex-direction: column; }
.pick { text-align: left; padding: 9px 10px; border-radius: 8px; display: grid; grid-template-columns: 1fr auto; gap: 1px 16px; align-items: center; }
.pick:hover { background: var(--hover); }
.pick.active { background: var(--surface-3); }
.pick .p-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.pick .p-name svg { width: 14px; height: 14px; color: var(--accent); }
.pick .p-tag { font-size: 12.5px; color: var(--text-3); grid-column: 1; }
.pick .p-cost { grid-column: 2; grid-row: 1 / span 2; font-size: 12px; color: var(--text-2); font-family: var(--mono); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.picker-note { font-size: 12px; color: var(--text-3); padding: 8px 10px 6px; border-top: 1px solid var(--line); margin-top: 4px; }

/* Usage & misc */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 22px; }
.stat { padding: 14px; background: var(--surface); }
.stat .s-label { font-size: 12.5px; color: var(--text-3); }
.stat .s-value { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 100px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.bars div { flex: 1; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 2px; opacity: 0.85; }
.bars div:hover { background: var(--accent); opacity: 1; }
.bars-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-bottom: 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 550; color: var(--text-3); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: none; }
.h-title { font-size: 13px; font-weight: 600; margin: 4px 0 10px; }
.redeem-hero { padding: 0 0 16px; }
.redeem-hero .r-icon { display: none; }
.redeem-hero p { color: var(--text-2); font-size: 14px; }
.success-burst { text-align: center; padding: 8px 0; }
.success-burst .r-icon { background: var(--success-soft) !important; color: var(--success) !important; }
.success-burst .big { font-family: var(--serif); font-weight: 400; font-size: 46px; letter-spacing: -0.02em; color: var(--text); }

/* Admin */
.admin-page { max-width: 1180px; margin: 0 auto; padding: 24px 28px 60px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.admin-grid .panel { border: none; border-radius: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.panel h2 { font-size: 15px; font-weight: 650; margin-bottom: 14px; letter-spacing: -0.01em; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel .stat { padding: 0; }
.admin-cols { display: grid; grid-template-columns: 360px 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.code-out { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 220px; overflow: auto; white-space: pre; margin: 12px 0; }
.table-wrap { overflow-x: auto; max-height: 520px; overflow-y: auto; }
.row-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.help { font-size: 12.5px; color: var(--text-3); margin-top: -6px; margin-bottom: 14px; }

/* ============ Responsive ============ */
@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .section-head { grid-template-columns: 1fr; gap: 16px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .fact:nth-child(3) { border-left: none; padding-left: 0; }
  .fact:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-card > .brand { display: flex; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 284px; z-index: 60; transform: translateX(-100%); transition: transform 0.22s ease; }
  .app.sb-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .sb-overlay { position: fixed; inset: 0; background: rgba(20, 18, 14, 0.4); z-index: 55; }
  .app.sb-open .sb-overlay { display: block; }
  .menu-toggle { display: inline-grid; }
  .route { grid-template-columns: 1fr; gap: 36px; padding-top: 0; padding-left: 40px; }
  .route::before { top: 10px; bottom: 10px; left: 9px; right: auto; border-top: none; border-left: 2px dashed var(--line-strong); }
  .stop::before { top: 2px; left: -40px; }
  .feature-list { grid-template-columns: 1fr; }
  .feature-item:nth-child(n) { padding: 24px 0; border-left: none; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .hero { padding-top: 48px; }
  .section { padding: 76px 0; }
  .facts { margin-top: 64px; }
  .fact { padding: 20px 16px; }
  .fact:nth-child(odd) { padding-left: 0; }
  .fact b { font-size: 28px; }
  .suggestions { grid-template-columns: 1fr; }
  .suggestion:nth-child(n + 3) { display: none; }
  .messages-inner { padding: 22px 16px 30px; }
  .composer-wrap { padding: 0 10px 10px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .msg.ai .ai-avatar { display: none; }
  .nav-actions .link { display: none; }
  .cta { padding: 40px 24px; }
  .faq details p { padding-right: 0; }
  .admin-page { padding: 18px 16px 40px; }
  .models-table th:nth-child(3), .models-table td:nth-child(3) { display: none; }
  .models-table td, .models-table th { padding-left: 14px; padding-right: 14px; }
}
.models-table .m-name svg { width: 15px; height: 15px; }
.models-table tr.group td { background: var(--surface-2); padding: 10px 20px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.models-table tr.group td span { font-weight: 500; color: var(--text-3); }
.feature-item i { display: inline-flex; }
.gift-box { margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gift-box b { display: block; font-size: 14px; }
.gift-box b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 2px; }
.gift-box span { font-size: 13px; color: var(--text-2); }
.count-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; }
.support-thread { height: min(52vh, 440px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.s-empty { margin: auto; max-width: 320px; text-align: center; color: var(--text-3); font-size: 14px; }
.s-msg { max-width: 80%; padding: 9px 13px 7px; border-radius: 12px; word-wrap: break-word; font-size: 14px; line-height: 1.5; }
.s-msg.user { align-self: flex-end; background: var(--surface-3); border-bottom-right-radius: 4px; }
.s-msg.admin { align-self: flex-start; background: var(--ink); color: var(--on-ink); border-bottom-left-radius: 4px; }
.s-who { display: block; font-size: 11.5px; font-weight: 650; color: var(--accent); margin-bottom: 2px; }
.s-time { display: block; font-size: 11px; opacity: 0.55; margin-top: 3px; text-align: right; }
.support-form textarea { height: auto; padding: 10px 12px; resize: vertical; margin-bottom: 6px; }
.inbox { display: grid; grid-template-columns: 300px 1fr; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 420px; }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 560px; background: var(--surface-2); }
.inbox-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; gap: 2px; }
.inbox-item:hover { background: var(--hover); }
.inbox-item.active { background: var(--surface); }
.inbox-item .ii-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13.5px; font-weight: 600; }
.inbox-item .ii-last { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-pane { display: flex; flex-direction: column; padding: 14px 16px; min-width: 0; }
.inbox-pane .support-thread { flex: 1; height: 360px; }
.inbox-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; font-size: 13.5px; }
@media (max-width: 760px) { .inbox { grid-template-columns: 1fr; } .inbox-list { max-height: 220px; border-right: none; border-bottom: 1px solid var(--line); } }
.s-body { white-space: pre-wrap; display: block; }
.steps-list { list-style: none; counter-reset: s; display: grid; gap: 16px; }
.steps-list li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; }
.steps-list li::before { content: counter(s); grid-row: span 3; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 12.5px; font-weight: 650; display: grid; place-items: center; }
.steps-list b { font-size: 14.5px; }
.steps-list span { font-size: 13.5px; color: var(--text-2); }
.copy-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.copy-row code { flex: 1; font-family: var(--mono); font-size: 13px; background: var(--surface-3); padding: 6px 10px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; }
.low-banner { max-width: 760px; margin: 0 auto 8px; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 10px; background: var(--warning-soft); color: var(--text); font-size: 13.5px; animation: rise 0.2s ease; }
.low-banner.empty { background: var(--danger-soft); }
.low-banner .lb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); flex-shrink: 0; }
.low-banner.empty .lb-dot { background: var(--danger); }
.low-banner .lb-text { flex: 1; }
.low-banner .icon-btn { width: 28px; height: 28px; }
@media (max-width: 640px) { .low-banner { font-size: 12.5px; flex-wrap: wrap; } }
.web-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 15px; font-size: 13px; font-weight: 550; color: var(--text-2); border: 1px solid var(--line-strong); transition: background 0.15s, color 0.15s, border-color 0.15s; }
.web-btn svg { width: 14px; height: 14px; }
.web-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.web-btn.on { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.web-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; align-items: center; }
.sources .src-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-3); margin-right: 2px; }
.sources .src-label svg { width: 13px; height: 13px; }
.sources a { display: inline-flex; gap: 6px; align-items: center; max-width: 260px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; }
.sources a:hover { border-color: var(--line-strong); }
.sources a b { font-weight: 600; white-space: nowrap; }
.sources a span { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-warn { max-width: 760px; margin: 0 auto 8px; display: flex; align-items: center; gap: 12px; padding: 9px 9px 9px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13.5px; color: var(--text-2); animation: rise 0.2s ease; }
.model-warn b { color: var(--text); font-weight: 600; }
.model-warn .mw-text { flex: 1; }
.pick .p-name .badge { height: 18px; font-size: 11px; padding: 0 6px; }
.pick .p-est { font-family: var(--font); font-weight: 600; color: var(--text); }
.pick.pricey .p-est { color: var(--warning); }
@media (max-width: 640px) { .model-warn { flex-wrap: wrap; font-size: 12.5px; } }
.profit-grid { margin-bottom: 12px; }
.stat .s-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.feature-status { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 18px; }
.admin-grid.profit-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .admin-grid.profit-grid { grid-template-columns: 1fr; } }
#micBtn.recording { color: #fff; background: var(--accent); animation: beat 1.2s ease-in-out infinite; }
.gen-images { display: grid; gap: 8px; margin-bottom: 10px; max-width: 520px; }
.gen-images img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-3); aspect-ratio: 1; object-fit: cover; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery figure { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface-3); }
.gallery figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 6px 6px 10px; font-size: 12.5px; color: var(--text-2); }
.gallery figcaption > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery .icon-btn { width: 28px; height: 28px; }
/* Model picker: one accordion section per company */
.picker { padding: 6px; }
.pk-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; overflow: hidden; background: var(--surface); }
.pk-group.open { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.pk-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: left; border-left: 3px solid var(--tint); }
.pk-head:hover { background: var(--hover); }
.pk-mark { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; font-size: 13px; font-weight: 700; color: #fff; background: var(--tint); }
.pk-mark svg { width: 14px; height: 14px; }
.pk-title { flex: 1; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.pk-title b { font-size: 14px; font-weight: 650; }
.pk-title small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-sel { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.pk-group.open .pk-sel { color: var(--tint); font-weight: 600; }
.pk-chev { display: inline-flex; color: var(--text-3); transition: transform 0.15s; }
.pk-chev svg { width: 15px; height: 15px; }
.pk-group.open .pk-chev { transform: rotate(180deg); }
.pk-body { display: none; flex-direction: column; padding: 4px; border-top: 1px solid var(--line); background: var(--surface-2); }
.pk-group.open .pk-body { display: flex; }
.pk-body .pick { background: transparent; }
.pk-body .pick:hover { background: var(--surface); }
.pk-body .pick.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.picker .picker-note { border-top: none; margin-top: 2px; }

/* ---- Touch devices & phones ---- */
.link-danger { display: block; margin: 14px auto 0; font-size: 13px; color: var(--danger); text-decoration: underline; text-underline-offset: 2px; }
@media (hover: none) {
  /* No hover on touch screens: keep conversation menus visible. */
  .conv .more { opacity: 0.6; }
  .ai-actions { opacity: 1; }
}
@media (max-width: 640px) {
  /* iOS zooms into inputs under 16px; keep them at 16px on phones. */
  .input, .composer textarea, .search input { font-size: 16px; }
  .icon-btn, .send-btn { width: 40px; height: 40px; }
  .model-btn { height: 40px; }
  .conv { height: 42px; }
  .conv .more { width: 36px; height: 36px; }
  .composer-wrap { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); }
  .modal { max-height: calc(100dvh - 24px); }
  .modal-backdrop { align-items: end; padding: 8px; }
  .picker { max-height: min(70dvh, 560px); }
  .toasts { bottom: calc(90px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast { text-align: center; }
  .model-warn, .low-banner { font-size: 12.5px; }
  .hero h1 { font-size: 42px; }
}
