/* Warm light theme by default, matching the chat dashboard; dark follows the system. */
:root {
  color-scheme: light dark;
  --bg: #faf9f6;
  --panel: #ffffff;
  --raised: #f5f3ee;
  --line: #e8e5de;
  --line-strong: #d8d3c8;
  --text: #1c1b19;
  --muted: #6f6b63;
  --accent: #127a4f;
  --accent-strong: #0d6540;
  --accent-ink: #ffffff;
  --accent-soft: rgba(18, 122, 79, .09);
  --danger: #b4432f;
  --brand-bg: #10261b;
  --brand-text: #f1efea;
  --brand-muted: #b7c7bc;
  --shadow: 0 24px 60px rgba(40, 33, 20, .10), 0 2px 6px rgba(40, 33, 20, .05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font: 16px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --panel: #1a1b1e;
    --raised: #222327;
    --line: #2b2c30;
    --line-strong: #3a3b40;
    --text: #f1efea;
    --muted: #a29e96;
    --accent: #6cf5b4;
    --accent-strong: #8ff8c6;
    --accent-ink: #0b1f15;
    --accent-soft: rgba(108, 245, 180, .10);
    --danger: #ff9b87;
    --brand-bg: #0d1d15;
    --shadow: 0 24px 60px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
[hidden] { display: none !important; }
a { color: var(--accent); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea {
  font: inherit; color: inherit; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 10px 12px; background: var(--panel);
}
button { cursor: pointer; font-weight: 500; }
button:hover { background: var(--raised); }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { display: block; width: 100%; margin: 6px 0 16px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent-soft); outline-offset: 0; border-color: var(--accent);
}
input[aria-invalid=true] { border-color: var(--danger); }
label { display: block; font-size: 14px; font-weight: 600; }
.primary { width: 100%; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 11px 14px; }
.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.hint, .switch, .optional, .note { color: var(--muted); font-size: 14px; font-weight: 400; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 0 0 12px; }
.error:empty { min-height: 0; margin: 0; }
#status { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10; margin: 0; max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--shadow); }
#status:empty { display: none; }

/* Sign-in and signup */
.brand-mark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-mark img { border-radius: 10px; }
.brand-mark.compact { font-size: 16px; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand {
  background: radial-gradient(120% 80% at 0% 0%, #1d4a33 0%, var(--brand-bg) 60%); color: var(--brand-text);
  padding: 48px clamp(32px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: 28px;
}
.auth-brand h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.15; letter-spacing: -.02em; margin: 0; max-width: 17ch; }
.benefits { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; max-width: 420px; }
.benefits li { display: flex; gap: 14px; align-items: flex-start; }
.benefits strong { display: block; color: var(--brand-text); }
.benefits li > span:last-child { color: var(--brand-muted); font-size: 15px; }
.benefit-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(108, 245, 180, .12); color: #6cf5b4; font-size: 14px; }
.pill-preview { display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 10px 16px; border-radius: 999px; background: #000; border: 1px solid rgba(255,255,255,.14); font-size: 14px; color: #f5f5f7; }
.pill-preview > span:nth-child(2) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff453a; box-shadow: 0 0 0 3px rgba(255,69,58,.2); flex: none; }
.pill-answer { color: #32d74b; font-size: 12px; flex: none; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 72px); }
.auth-card form { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-card .brand-mark.compact { display: none; }
.auth-card h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.lede { color: var(--muted); margin: 0 0 24px; }
.google {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 44px; padding: 0 16px;
  border: 1px solid #747775; border-radius: 8px; background: #fff; color: #1f1f1f;
  font: 500 15px/1 Roboto, var(--font); text-decoration: none;
}
.google:hover { background: #f8f9fa; text-decoration: none; box-shadow: 0 1px 3px rgba(60,64,67,.2); }
@media (prefers-color-scheme: dark) { .google { background: #131314; color: #e3e3e3; border-color: #8e918f; } .google:hover { background: #1f1f20; } }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hint { margin: -10px 0 16px; }
.switch { text-align: center; margin: 20px 0 0; }
.handoff { min-height: 100vh; align-items: center; text-align: center; gap: 4px; }
.handoff h1 { font-size: 24px; margin: 12px 0 4px; }
.handoff p { color: var(--muted); margin: 0 0 20px; max-width: 360px; }
.handoff img { border-radius: 12px; }
.button-link { display: inline-block; width: auto; border-radius: 8px; padding: 11px 20px; text-decoration: none; }
.button-link:hover { text-decoration: none; }
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card { padding: 32px 16px; justify-content: flex-start; }
  .auth-card .brand-mark.compact { display: flex; justify-content: center; margin: 8px 0 28px; }
  .auth-card h2 { text-align: center; }
  .lede { text-align: center; }
}

/* Signed-in app */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.ghost { background: transparent; }
.primary.inline { width: auto; }
.link-button { border: 0; padding: 0; background: none; color: var(--accent); font-weight: 600; }
.link-button:hover { background: none; text-decoration: underline; }
.danger-button { color: var(--danger); background: transparent; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .brand-mark { color: var(--text); }
.topbar .brand-mark:hover { text-decoration: none; }
.tabs-nav { display: flex; gap: 4px; flex: 1; }
.tabs-nav a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 500; }
.tabs-nav a:hover { color: var(--text); background: var(--raised); text-decoration: none; }
.tabs-nav a[aria-current] { color: var(--text); background: var(--raised); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; margin-left: auto; }
#identity { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.who button { padding: 7px 12px; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--raised); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.plan-base { background: rgba(59,130,246,.12); color: #2563eb; border-color: transparent; }
.badge.plan-pro { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.plan-ultra { background: linear-gradient(90deg, rgba(168,85,247,.16), rgba(236,72,153,.16)); color: #a21caf; border-color: transparent; }
@media (prefers-color-scheme: dark) { .badge.plan-base { color: #93c5fd; } .badge.plan-ultra { color: #f0abfc; } }
.mini-badge { margin-left: 6px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Chats */
.chats-view { flex: 1; display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; height: calc(100vh - 57px); position: sticky; top: 57px; }
.list-tools { display: flex; gap: 8px; padding: 16px; border-bottom: 1px solid var(--line); }
.list-tools input, .list-tools select { margin: 0; }
.list-tools select { width: auto; }
#chats { overflow: auto; padding: 8px; display: grid; align-content: start; gap: 2px; }
.chat-item { display: grid; gap: 3px; padding: 12px; border-radius: 10px; color: var(--text); font-weight: 400; border: 1px solid transparent; }
.chat-item:hover { background: var(--raised); text-decoration: none; }
.chat-item.selected { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.chat-item-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-item-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.chat-item-top time, .chat-item-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chat-item-preview { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-empty { color: var(--muted); font-size: 14px; padding: 16px 12px; margin: 0; }
.chat-detail { padding: 28px clamp(20px, 4vw, 48px) 64px; min-width: 0; max-width: 960px; }
.back-link { display: none; margin-bottom: 12px; font-size: 14px; }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 16px; margin-bottom: 20px; }
.detail-head > div:first-child { flex: 1 1 280px; min-width: 0; }
.detail-head h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 4px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 13px; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { padding: 7px 12px; font-size: 14px; }
.detail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.detail-tabs button { border: 0; border-radius: 0; background: none; padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.detail-tabs button:hover { color: var(--text); background: none; }
.detail-tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.generate-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.generate-bar button { padding: 8px 14px; }
.error.wide { flex-basis: 100%; margin: 0; }
.block { margin-bottom: 28px; }
.block h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.block ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.block.lead p { font-size: 17px; line-height: 1.6; margin: 0; }
.block.lead { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); font-size: 14px; }
.qa { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: qa; }
.qa li { padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.qa .q { font-weight: 600; margin: 0 0 8px; }
.qa .a, .gap p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.muted { color: var(--muted) !important; }
.transcript { display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: baseline; }
.line .speaker { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.line.me .speaker { color: var(--accent); }
.line p { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); overflow-wrap: anywhere; }
.line.me p { background: var(--accent-soft); border-color: transparent; }
.score-card { display: flex; gap: 24px; align-items: center; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 28px; }
.score-card h3 { margin: 0 0 6px; font-size: 18px; }
.score-card p { margin: 0; color: var(--muted); }
.score { --c: var(--accent); flex: none; width: 96px; height: 96px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(closest-side, var(--panel) 78%, transparent 80% 100%), conic-gradient(var(--c) calc(var(--score) * 1%), var(--line) 0); }
.score.ok { --c: #d97706; } .score.low { --c: var(--danger); }
.score strong { font-size: 28px; line-height: 1; } .score span { font-size: 12px; color: var(--muted); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.skill { padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.skill-top { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 8px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.gap { padding: 16px 18px; border: 1px solid var(--line); border-left: 3px solid #d97706; border-radius: 12px; background: var(--panel); display: grid; gap: 8px; margin-bottom: 12px; }
.gap .q { font-weight: 600; }
.gap .better { padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); }
.empty { text-align: center; padding: 64px 24px; color: var(--muted); max-width: 460px; margin: 40px auto; }
.empty.small { padding: 24px; margin: 0 auto; }
.empty h3 { color: var(--text); font-size: 20px; margin: 12px 0 8px; }
.empty p { margin: 0 0 16px; }
.upsell { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }

/* Plans and account */
.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 4px; }
.banner { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--text); margin: 0 0 20px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.plan-card { position: relative; display: flex; flex-direction: column; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.plan-card.featured { border-color: var(--accent); box-shadow: var(--shadow); }
.plan-card.current { outline: 2px solid var(--accent); outline-offset: -1px; }
.plan-card h2 { margin: 0 0 8px; font-size: 20px; }
.price { margin: 0 0 8px; } .price strong { font-size: 34px; letter-spacing: -.02em; } .price span { color: var(--muted); }
.plan-summary { color: var(--muted); font-size: 14px; margin: 0 0 16px; min-height: 60px; }
.plan-card ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; align-content: start; gap: 8px; flex: 1; font-size: 14px; }
.plan-card li::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: 8px; }
.plan-card button { width: 100%; }
.ribbon { position: absolute; top: -11px; left: 24px; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
#plans-note { margin-top: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 20px; max-width: 720px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.panel .hint { margin: 0 0 16px; }
#settings { max-width: 420px; }
.key-row { padding: 14px 0; border-top: 1px solid var(--line); }
.key-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.key-saved { color: var(--accent); font-family: var(--mono); font-size: 14px; }
.key-missing { color: var(--muted); font-size: 14px; }
.key-row form { display: flex; gap: 8px; flex-wrap: wrap; }
.key-row input { flex: 1; min-width: 220px; margin: 0; }
.key-row .error:empty { display: none; }
.key-row .error { margin: 8px 0 0; }
@media (max-width: 1000px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chats-view { grid-template-columns: 280px minmax(0, 1fr); } }
@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
  .topbar .brand-mark span, #identity { display: none; }
  .tabs-nav { order: 3; flex-basis: 100%; }
  .chats-view { grid-template-columns: 1fr; }
  .chat-list { position: static; height: auto; border-right: 0; }
  .chat-open .chat-list { display: none; }
  body:not(.chat-open) .chat-detail { display: none; }
  .back-link { display: inline-block; }
  .chat-detail { padding: 20px 16px 48px; }
  .detail-head { flex-direction: column; }
  .two-col, .plan-grid { grid-template-columns: 1fr; }
  .page { padding: 24px 16px 48px; }
  .score-card { flex-direction: column; text-align: center; }
}
