/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg: #0c0f0d;
  --bg-2: #11161300;
  --surface: #151b18;
  --surface-2: #1b231f;
  --surface-3: #232d28;
  --border: #2a352f;
  --border-soft: #1f2823;
  --text: #e8efea;
  --text-dim: #9fb0a6;
  --text-faint: #6c7d73;
  --accent: #10b981;
  --accent-hover: #16c98c;
  --accent-ink: #052e22;
  --danger: #f0606a;
  --record: #ef4444;
  --record-glow: rgba(239, 68, 68, 0.35);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The [hidden] attribute must win over component display rules (e.g. the auth
   forms use display:grid, which would otherwise defeat `hidden`). */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(16, 185, 129, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(16, 185, 129, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

#app { min-height: 100%; display: flex; flex-direction: column; }
.boot { margin: auto; color: var(--text-faint); padding: 4rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.62rem 1.05rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
  color: var(--text);
  background: var(--surface-3);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--secondary { background: var(--surface-3); border-color: var(--border); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn--ghost:hover:not(:disabled) { color: var(--text); border-color: var(--text-faint); }
.btn--block { width: 100%; }
.btn--sm { padding: 0.42rem 0.8rem; font-size: 0.86rem; }
.btn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ── Brand ──────────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-mark { font-size: 1.25rem; }
.brand-name { font-size: 1.12rem; }
.brand--lg .brand-mark { font-size: 2rem; }
.brand--lg .brand-name { font-size: 1.6rem; }

/* ── Auth view ──────────────────────────────────────────────────────────── */
.auth-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}
.auth-hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.08; letter-spacing: -0.03em; margin: 1.6rem 0 1rem; }
.lede { color: var(--text-dim); font-size: 1.05rem; max-width: 46ch; }
.hero-points { list-style: none; padding: 0; margin: 1.8rem 0; display: grid; gap: 0.7rem; }
.hero-points li { display: flex; align-items: center; gap: 0.7rem; color: var(--text); }
.hero-points li span { font-size: 1.05rem; }
.hero-foot { color: var(--text-faint); font-size: 0.92rem; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}
.tabs { display: flex; gap: 0.3rem; background: var(--bg); padding: 0.3rem; border-radius: var(--radius-sm); margin-bottom: 1.4rem; }
.tab {
  flex: 1; padding: 0.55rem; border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-weight: 600; border-radius: 7px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.tab.is-active { background: var(--surface-3); color: var(--text); }

.auth-form { display: grid; gap: 1rem; }
.auth-form label { display: grid; gap: 0.4rem; font-size: 0.9rem; color: var(--text-dim); font-weight: 500; }
input[type="email"], input[type="password"], input[type="text"], .meeting-title-input, .chat-form input, [data-chat-input] {
  font: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.66rem 0.8rem;
  width: 100%;
}
input:focus, .meeting-title-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input::placeholder { color: var(--text-faint); }

.terms { background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 0.85rem; }
.check { display: flex; gap: 0.65rem; align-items: flex-start; font-size: 0.85rem; color: var(--text-dim); cursor: pointer; }
.check input { margin-top: 0.2rem; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.check a { color: var(--accent); }
.form-error { color: var(--danger); font-size: 0.88rem; margin: 0; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(12, 15, 13, 0.8);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar-right { display: flex; align-items: center; gap: 0.85rem; }
.user-email { color: var(--text-dim); font-size: 0.88rem; }
.ai-badge { font-size: 0.74rem; font-weight: 700; padding: 0.22rem 0.55rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }
.ai-badge.is-claude { color: var(--accent); border-color: var(--accent); background: rgba(16, 185, 129, 0.08); }

.layout { flex: 1; display: grid; grid-template-columns: 270px 1fr; min-height: 0; }
.sidebar {
  border-right: 1px solid var(--border-soft);
  padding: 1rem;
  display: flex; flex-direction: column; gap: 0.8rem;
  overflow-y: auto;
}
.sidebar-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-faint); margin: 0.6rem 0 0; }
.meeting-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.meeting-item {
  padding: 0.6rem 0.7rem; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent; transition: background 0.12s, border-color 0.12s;
}
.meeting-item:hover { background: var(--surface); }
.meeting-item.is-active { background: var(--surface-2); border-color: var(--border); }
.meeting-item .mi-title { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meeting-item .mi-meta { font-size: 0.76rem; color: var(--text-faint); margin-top: 0.15rem; }
.sidebar-empty { color: var(--text-faint); font-size: 0.86rem; }

.workspace { padding: 1.25rem clamp(1rem, 3vw, 2rem); overflow-y: auto; }
.workspace-empty { display: grid; place-items: center; height: 100%; color: var(--text-faint); text-align: center; gap: 0.5rem; }

.meeting-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.1rem; }
.meeting-title-input { font-size: 1.35rem; font-weight: 700; border-color: transparent; background: transparent; padding: 0.35rem 0.5rem; flex: 1; letter-spacing: -0.02em; }
.meeting-title-input:hover { background: var(--surface); }
.meeting-meta { color: var(--text-faint); font-size: 0.82rem; white-space: nowrap; }

.panels { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1rem; align-items: start; }
.panel-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; }
.panel-head h3 { margin: 0; font-size: 1rem; }

/* Recorder */
.recorder-bar { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.record-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px; padding: 0.6rem 1.25rem;
  font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
  transition: background 0.15s, box-shadow 0.2s;
}
.record-btn:hover { background: var(--accent-hover); }
.record-btn.is-recording { background: var(--record); color: #fff; box-shadow: 0 0 0 0 var(--record-glow); animation: pulse 1.8s infinite; }
.record-dot { width: 11px; height: 11px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.record-btn.is-recording .record-dot { background: #fff; animation: blink 1s steps(2, start) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--record-glow); } 70% { box-shadow: 0 0 0 12px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
@keyframes blink { 50% { opacity: 0.25; } }

.recorder-status { display: flex; flex-direction: column; line-height: 1.15; }
.rec-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }
.rec-state { font-size: 0.78rem; color: var(--text-faint); }
.recorder-spacer { flex: 1; }
.mic-hint { font-size: 0.8rem; color: var(--text-faint); text-align: right; }
.engine-toggle { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.engine-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.engine-opt {
  font: inherit; font-size: 0.76rem; font-weight: 600;
  padding: 0.22rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.engine-opt:hover { color: var(--text); border-color: var(--text-faint); }
.engine-opt.is-active { background: rgba(16, 185, 129, 0.12); border-color: var(--accent); color: var(--accent); }
.engine-static { font-size: 0.78rem; color: var(--text-faint); }

.transcript {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  min-height: 220px;
  max-height: 46vh;
  overflow-y: auto;
  font-size: 0.97rem;
  white-space: pre-wrap;
  line-height: 1.65;
}
.transcript-placeholder { color: var(--text-faint); }
.interim { color: var(--text-faint); font-style: italic; min-height: 1.2em; margin: 0.5rem 0 0; }
.window-note { font-size: 0.74rem; color: var(--text-faint); margin: 0 0 0.45rem; display: flex; align-items: center; gap: 0.4rem; }
.window-note::before { content: '⋯'; color: var(--accent); font-weight: 700; }

/* Summary */
.summary-body { display: grid; gap: 0.9rem; }
.summary-tldr { background: var(--bg); border-left: 3px solid var(--accent); border-radius: 8px; padding: 0.7rem 0.85rem; }
.summary-group h4 { margin: 0 0 0.4rem; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.summary-group ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.3rem; }
.summary-group li { font-size: 0.93rem; }
.summary-group.actions li::marker { content: '☐  '; }
.engine-note { font-size: 0.76rem; color: var(--text-faint); }

/* Chat */
.chat-log { display: flex; flex-direction: column; gap: 0.6rem; max-height: 34vh; overflow-y: auto; margin-bottom: 0.8rem; padding-right: 0.2rem; }
.bubble { padding: 0.6rem 0.8rem; border-radius: 12px; max-width: 90%; font-size: 0.92rem; white-space: pre-wrap; }
.bubble.user { background: var(--accent); color: var(--accent-ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.assistant { background: var(--surface-3); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.thinking { color: var(--text-faint); font-style: italic; }
.chat-form { display: flex; gap: 0.5rem; }
.chat-form input { flex: 1; }

.muted { color: var(--text-faint); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: grid; place-items: center; padding: 1.5rem; z-index: 50;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 560px; width: 100%; padding: 1.6rem; box-shadow: var(--shadow);
  max-height: 85vh; overflow-y: auto;
}
.modal h2 { margin-top: 0; }
.modal-body { display: grid; gap: 0.8rem; color: var(--text-dim); font-size: 0.92rem; margin-bottom: 1.2rem; }
.modal-body strong { color: var(--text); }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toast-stack { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; z-index: 60; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text);
  padding: 0.7rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 0.9rem; max-width: 320px; animation: slidein 0.2s ease;
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--accent); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .auth-wrap { grid-template-columns: 1fr; gap: 2rem; }
  .auth-hero { order: 2; }
  .panels { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border-soft); max-height: 38vh; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
