/* Velox — dark theme (default) */
:root {
  --bg: #030303;
  --bg-elev: #0a0a0c;
  --bg-elev-2: #141417;
  --border: #1a1a1e;
  --border-soft: #111114;
  --text: #e7e7ea;
  --text-dim: #9a9aa6;
  --text-faint: #61616d;
  --accent: #ffffff;
  --accent-hover: #d4d4d8;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --on-accent: #0a0a0a;
  --danger: #f0556b;
  --success: #3ecf8e;
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

/* Light pastel-white theme */
[data-theme="light"] {
  --bg: #f8f7f5;
  --bg-elev: #ffffff;
  --bg-elev-2: #f0eeea;
  --border: #e4e1db;
  --border-soft: #eceae5;
  --text: #1c1a17;
  --text-dim: #6e6a62;
  --text-faint: #aaa59c;
  --accent: #1c1a17;
  --accent-hover: #3a3730;
  --accent-soft: rgba(28, 26, 23, 0.07);
  --on-accent: #ffffff;
  --danger: #d94f5c;
  --success: #2e9e72;
}
[data-theme="light"] body { -webkit-font-smoothing: auto; }
[data-theme="light"] .msg.user .body  { background: #eeece7; }
[data-theme="light"] .msg .body code  { background: #eeece7; border-color: var(--border); }
[data-theme="light"] .msg .body pre   { background: #f0eeea; }
[data-theme="light"] .composer-box    { background: #ffffff; border-color: #e4e1db; }
[data-theme="light"] .hero h1 .grad {
  background: linear-gradient(120deg, #1c1a17, #6e6a62);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
[data-theme="light"] .plan.featured {
  border-color: rgba(28, 26, 23, 0.35);
  box-shadow: 0 0 0 1px rgba(28, 26, 23, 0.15), 0 12px 40px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .badge { color: #1c1a17; background: rgba(28,26,23,0.08); }
/* White logo → dark on light bg */
[data-theme="light"] .brand-logo,
[data-theme="light"] .msg .avatar img { filter: invert(1) brightness(0.15) contrast(1.2); }

/* Theme toggle button */
.theme-toggle {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-faint); cursor: pointer;
  border-radius: 8px; padding: 5px 8px; font-size: 15px;
  line-height: 1; transition: color .15s, border-color .15s, background .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--on-accent); border: none;
  padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg-elev-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: transparent; border: 1px solid var(--border); color: var(--danger); }
.btn-danger:hover { background: rgba(240,85,107,0.1); }

/* ---- Forms ---- */
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.field { margin-bottom: 16px; }

/* ---- Cards / panels ---- */
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.notice-error { background: rgba(240,85,107,0.1); color: #ff8fa0; border: 1px solid rgba(240,85,107,0.25); }
.notice-success { background: rgba(62,207,142,0.1); color: var(--success); border: 1px solid rgba(62,207,142,0.25); }

/* ---- Nav ---- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; }
.brand-logo { height: 28px; width: auto; display: block; }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 14px; }
.nav-links a:hover { color: var(--text); }

/* ---- Auth pages ---- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-card p.sub { color: var(--text-dim); margin-bottom: 24px; font-size: 14px; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--text-faint); text-align: center; }

/* ---- Landing ---- */
.hero { padding: 96px 0 64px; text-align: center; }
.hero h1 { font-size: 52px; line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 18px; }
.hero h1 .grad {
  background: linear-gradient(120deg, #ffffff, #8a8a92);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { font-size: 18px; color: var(--text-dim); max-width: 560px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; }

.pricing { padding: 48px 0 96px; }
.pricing h2 { text-align: center; font-size: 30px; letter-spacing: -0.02em; margin-bottom: 8px; }
.pricing .lead { text-align: center; color: var(--text-dim); margin-bottom: 40px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.plan {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column;
}
.plan.featured { border-color: rgba(255,255,255,0.4); box-shadow: 0 0 0 1px rgba(255,255,255,0.25), 0 12px 40px rgba(0,0,0,0.5); }
.plan h3 { font-size: 16px; margin-bottom: 4px; }
.plan .price { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 4px; }
.plan .price small { font-size: 14px; color: var(--text-faint); font-weight: 500; }
.plan ul { list-style: none; margin: 18px 0; flex: 1; }
.plan ul li { padding: 6px 0; font-size: 13px; color: var(--text-dim); display: flex; gap: 8px; }
.plan ul li::before { content: "→"; color: var(--accent); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 20px; margin-bottom: 8px; }

/* ---- Chat app ---- */
.app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }
.sidebar { background: var(--bg-elev); border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-head { padding: 18px 16px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.conv-list { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.conv-item { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conv-item:hover { background: var(--bg-elev-2); color: var(--text); }
.conv-item.active { background: var(--accent-soft); color: var(--text); }
.conv-item .del { opacity: 0; color: var(--text-faint); font-size: 14px; }
.conv-item:hover .del { opacity: 1; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--border-soft); font-size: 13px; flex-shrink: 0; }
.usage-bar { height: 6px; background: var(--bg-elev-2); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.usage-bar > span { display: block; height: 100%; background: var(--accent); }

.main { display: flex; flex-direction: column; height: 100vh; }
.chat-head { padding: 14px 24px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.model-select { width: auto; min-width: 140px; }
.composer-model {
  width: auto; background: transparent; border: none; border-left: 1px solid var(--border);
  color: var(--text-faint); font-size: 12px; padding: 4px 8px 4px 10px;
  border-radius: 0; cursor: pointer; flex-shrink: 0;
}
.composer-model:focus { border-color: var(--border); outline: none; }
.composer-model option { background: var(--bg-elev-2); color: var(--text); }
.messages { flex: 1; overflow-y: auto; padding: 24px; }
.msg { max-width: 760px; margin: 0 auto 22px; display: flex; gap: 14px; }
.msg .avatar { width: 28px; height: 28px; flex-shrink: 0; display: grid; place-items: center; margin-top: 2px; }
.msg .avatar img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.msg-content { flex: 1; min-width: 0; }
.msg.user { justify-content: flex-end; }
.msg.user .msg-content { flex: unset; max-width: 80%; }
.msg.user .body { background: var(--bg-elev-2); border-radius: 14px 14px 4px 14px; padding: 10px 14px; }
.tool-strip { font-size: 11px; color: var(--text-faint); margin-bottom: 6px; letter-spacing: 0.02em; }
.msg .body { word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.65; }
.msg .body p { margin: 0 0 10px; }
.msg .body p:last-child { margin-bottom: 0; }
.msg .body h1 { font-size: 18px; font-weight: 700; margin: 14px 0 6px; letter-spacing: -0.01em; }
.msg .body h2 { font-size: 16px; font-weight: 700; margin: 12px 0 5px; }
.msg .body h3 { font-size: 14px; font-weight: 600; margin: 10px 0 4px; }
.msg .body strong { font-weight: 600; color: var(--text); }
.msg .body em { font-style: italic; color: var(--text-dim); }
.msg .body code { font-family: var(--mono); font-size: 12px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.msg .body pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; margin: 10px 0; }
.msg .body pre code { background: none; border: none; padding: 0; font-size: 13px; }
.html-preview-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; background: transparent; border: 1px solid var(--border); color: var(--text-dim); font-size: 12px; padding: 4px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s, color .15s; }
.html-preview-btn:hover { border-color: var(--accent); color: var(--text); }
.html-preview-btn::before { content: '◻'; font-size: 10px; }
.html-preview-frame { display: block; width: 100%; min-height: 300px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 8px; background: #fff; resize: vertical; overflow: auto; }
.msg .body ul, .msg .body ol { padding-left: 20px; margin: 8px 0; }
.msg .body li { margin-bottom: 4px; }
.msg .body img.thumb { max-width: 240px; border-radius: 10px; margin-top: 8px; display: block; }
.composer { border-top: 1px solid var(--border-soft); padding: 16px 24px; }
.composer-inner { max-width: 760px; margin: 0 auto; }
.composer-box { display: flex; gap: 10px; align-items: flex-end; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.composer-box textarea { border: none; background: transparent; resize: none; max-height: 180px; padding: 4px; }
.composer-box textarea:focus { border: none; }
.icon-btn { background: transparent; border: none; color: var(--text-dim); cursor: pointer; padding: 6px; border-radius: 8px; font-size: 18px; }
.icon-btn:hover { background: var(--bg-elev-2); color: var(--text); }
.attach-preview { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; margin-bottom: 8px; }
.empty-state { max-width: 520px; margin: 80px auto; text-align: center; color: var(--text-dim); }
.empty-state h2 { color: var(--text); font-size: 24px; margin-bottom: 8px; letter-spacing: -0.02em; }

/* ---- Dashboard ---- */
.dash { padding: 32px 0 64px; }
.dash h1 { font-size: 26px; letter-spacing: -0.02em; margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat small { font-size: 13px; color: var(--text-faint); font-weight: 500; }
.key-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.key-row code { font-family: var(--mono); color: var(--text-dim); }
.code-block { font-family: var(--mono); font-size: 13px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; color: var(--text-dim); white-space: pre; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 38px; }
}
