/* Themes: light and warm only, no dark mode (issue #9). Chai is the default; pick another with THEME. */
:root {
  color-scheme: light;
  --bg: #faf6ef; --card: #fffdf9; --ink: #231d17; --muted: #6e6255; --line: #e8dfd2; --hero: #f3e6d6;
  --accent: #b4441a; --accent-ink: #fff; --accent-soft: #f6e2d6; --link: #b4441a;
  --ok: #2f7d45; --bad: #b42318; --wait: #8a5a00; --focus: #1d4ed8;
}
:root[data-theme="haldi"] {
  --bg: #fff9ec; --card: #fffef8; --ink: #2a2113; --muted: #6f5f43; --line: #efe2c2; --hero: #fcefc9;
  --accent: #e7a417; --accent-ink: #2a1c00; --accent-soft: #fbebc4; --link: #8a5a00; --focus: #7a3e00;
}
:root[data-theme="gulab"] {
  --bg: #fff6f4; --card: #fff; --ink: #2b1a1c; --muted: #735a5e; --line: #f1dcda; --hero: #fce6e8;
  --accent: #b8335a; --accent-ink: #fff; --accent-soft: #fbe1e6; --link: #b8335a; --bad: #a4161a;
}
:root[data-theme="mitti"] {
  --bg: #f6f1e7; --card: #fffcf6; --ink: #26211b; --muted: #6a6052; --line: #e3d9c6; --hero: #e9e3d2;
  --accent: #8c4f2b; --accent-ink: #fff; --accent-soft: #ecdccb; --link: #8c4f2b;
  --ok: #4e7a4a; --bad: #a4161a; --wait: #7a5300; --focus: #2f5d8a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--link); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .4rem 0 .6rem; overflow-wrap: anywhere; }
p, li { max-width: 75ch; }

/* ---------- Page frame ---------- */
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
.topline { border-bottom: 1px solid var(--line); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; display: inline-flex; gap: 8px; align-items: center; min-height: 44px; }
.brand::before { content: ""; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); }
.inline { display: inline; margin: 0; font-size: .9rem; }
.link { background: none; border: 0; padding: 0; min-height: 44px; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.eyebrow { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--link); font-weight: 700; margin: 0; }
.muted-eyebrow { color: var(--muted); margin-top: 32px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.back { color: var(--muted); font-size: .9rem; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.steps { color: var(--muted); padding-left: 1.2rem; }
.actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
label { font-size: .9rem; font-weight: 600; display: block; }
.input { display: block; width: 100%; min-height: 46px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; font-weight: 400; color: var(--ink); background: var(--card); }
.input:focus { border-color: var(--accent); }
.row2 { display: flex; gap: 12px; }
.row2 > * { flex: 1; min-width: 0; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--card); margin: 16px 0 0; }
.consent { margin: 0; }
.consent p { margin: 0 0 8px; font-size: .9rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 8px; min-height: 28px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.err { color: var(--bad); font-size: .9rem; margin: 0; }
.err:empty { display: none; }
.st { font-size: .8rem; font-weight: 700; white-space: nowrap; }
.st.ready { color: var(--ok); } .st.busy { color: var(--link); } .st.fail { color: var(--bad); } .st.nf { color: var(--muted); } .st.wait { color: var(--wait); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Landing ---------- */
.land { display: grid; gap: 32px; padding-top: 40px; padding-bottom: 56px; min-height: calc(100dvh - 73px); align-content: center; }
.land h1 { font-size: 2.1rem; }
.howto { display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; }
.howto li { display: flex; gap: 14px; align-items: flex-start; margin: 0; max-width: none; }
.howto .n { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--link); display: grid; place-items: center; font-weight: 700; }
.howto p { margin: 2px 0 0; }

/* ---------- Sign up / sign in ---------- */
.auth { display: grid; gap: 24px; }
.auth-form { max-width: 480px; width: 100%; margin: 0 auto; }
.auth-form.card { border: 0; background: none; padding: 0; }
.welcome { display: none; border-radius: 20px; background: var(--hero); padding: 48px; }
.welcome blockquote { font-size: 1.35rem; line-height: 1.45; margin: 16px 0; }

/* ---------- Dashboard ---------- */
.banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--hero); border-color: transparent; margin-top: 0; }
.banner h1 { font-size: 1.3rem; margin: 0; }
.banner p { margin: 4px 0 0; }
.convs { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; }
.convs li { margin: 0; max-width: none; }
.convs li + li { border-top: 1px solid var(--line); }
.conv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px; height: 100%; color: var(--ink); text-decoration: none; }
.conv > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.conv .badges { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.empty { text-align: center; padding: 40px 16px; }
.empty .icon { font-size: 2rem; margin: 0; }
.empty p { margin-left: auto; margin-right: auto; }

/* ---------- New conversation + recorder ---------- */
.newg { display: grid; gap: 20px; }
.newg > * { min-width: 0; }
.tips ul { margin: 8px 0 0; padding-left: 1.2rem; }
.tips li { margin: 6px 0; }
.tips-toggle summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.tips-panel { display: none; }
.recorder { display: flex; flex-direction: column; align-items: center; padding: 16px 0; max-width: 520px; margin: 0 auto; }
.mic { --level: 0; width: 170px; height: 170px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; margin-top: 16px;
  box-shadow: 0 0 0 calc(6px + var(--level) * 34px) color-mix(in srgb, var(--accent) 16%, transparent); transition: box-shadow .08s linear; }
.mic span { width: 104px; height: 104px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 40px; }
.mic.off { box-shadow: none; }
.mic.off span { background: var(--muted); }
.timer { font: 600 2.4rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 24px 0 4px; font-variant-numeric: tabular-nums; }
.recorder .err { max-width: 420px; margin-top: 12px; }
.actions-row { width: 100%; max-width: 420px; margin-top: 24px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); margin: 16px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .mic { transition: none; } }

/* ---------- Conversation ---------- */
.title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.convg { display: grid; }
.convg > * { min-width: 0; }
.fail-title { color: var(--bad); margin: 0; }
.turns { list-style: none; padding: 0; margin: 16px 0 0; }
.turns li { display: flex; gap: 12px; margin-top: 14px; }
.turns .t { width: 48px; flex: none; color: var(--muted); font: .75rem ui-monospace, monospace; padding-top: 3px; }
.turns p { margin: 0; overflow-wrap: anywhere; }
.who { font-size: .75rem; font-weight: 700; }
.who.a { color: var(--link); } .who.b { color: var(--ok); }
.transcript { margin-top: 20px; }
.transcript > summary { cursor: pointer; font-weight: 600; padding: 8px 0; min-height: 44px; }

/* "Your app" (issue #4) */
.app { margin-top: 20px; }
.app-title { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.05rem; margin: 0 0 10px; }
.app .steps { list-style: none; padding: 0; margin: 0 0 8px; color: var(--ink); }
.app .steps li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; }
.app .dot { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; margin-top: 2px; border: 2px solid var(--line); color: var(--muted); }
.app .done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.app .now .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 1s linear infinite; }
.app .failed .dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.app .you .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.app .waiting .lab { color: var(--muted); }
.app .lab small { display: block; color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: reduce) { .app .now .dot { animation: none; } }
.plan { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 10px 0; }
.plan .chrome { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); padding: 4px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.plan .chrome a { display: inline-flex; align-items: center; min-height: 36px; }
.plan iframe { display: block; width: 100%; height: 60vh; min-height: 360px; border: 0; background: #fff; }
.decide { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; }
.decide > :only-child, .decide .changes[open] { grid-column: 1 / -1; }
.approve-form { margin: 0; }
.approve-form .btn, .changes summary { width: 100%; }
.changes summary { list-style: none; }
.changes summary::-webkit-details-marker { display: none; }
.changes[open] summary { margin-bottom: 10px; }
.link-card { display: block; border: 1px solid var(--ok); border-radius: 12px; padding: 12px; margin: 10px 0; color: var(--ink); overflow-wrap: anywhere; text-decoration: none; background: color-mix(in srgb, var(--ok) 10%, var(--card)); }
.note { border-radius: 10px; background: var(--accent-soft); padding: 10px 12px; font-size: .9rem; margin: 10px 0; }
.rounds { font-size: .85rem; color: var(--muted); }
dialog.confirm { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); max-width: 420px; width: calc(100% - 32px); padding: 18px; }
dialog.confirm::backdrop { background: rgba(35, 29, 23, .35); }

/* ---------- Tablet 640–1199px ---------- */
@media (min-width: 640px) {
  .wrap { padding-left: 32px; padding-right: 32px; }
  .convs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; border: 0; background: none; overflow: visible; border-radius: 0; }
  .convs li + li { border-top: 0; }
  .conv { flex-direction: column; align-items: stretch; justify-content: space-between; min-height: 132px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
  .conv .badges { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .decide { grid-template-columns: 1fr 1fr; }
  .plan iframe { height: 520px; }
  .auth-form.card { border: 1px solid var(--line); background: var(--card); padding: 32px; margin-top: 24px; }
}

/* ---------- Desktop ≥1200px (designed at 1920px) ---------- */
@media (min-width: 1200px) {
  .wrap { padding-left: 48px; padding-right: 48px; }
  h1 { font-size: 2rem; }
  .land { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 72px; }
  .land h1 { font-size: 3rem; max-width: 16ch; }
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: stretch; min-height: calc(100dvh - 120px); }
  .auth-form.card { align-self: center; margin: 0; justify-self: center; }
  .welcome { display: flex; flex-direction: column; justify-content: center; }
  .convs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .newg { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 48px; align-items: start; }
  .tips-toggle { display: none; }
  .tips-panel { display: block; position: sticky; top: 24px; }
  .recording .newg { grid-template-columns: minmax(0, 1fr); }
  .convg { grid-template-columns: minmax(0, 1.7fr) minmax(380px, 1fr); gap: 32px; align-items: start; }
  .convg .plan iframe { height: max(640px, calc(100dvh - 420px)); }
  .txpanel { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow: auto; }
}
/* While recording, the recorder stands alone on every size. */
.recording .tips-panel, .recording .tips-toggle { display: none !important; }
