/* Tablet-first: a clinician reading on an iPad in one sitting. Large type, generous spacing, 44px+ targets. */
:root {
  --bg: #f6f5f2; --surface: #ffffff; --ink: #1f2328; --muted: #5d6570; --line: #e3e0da;
  --accent: #8a1c3a; --accent-ink: #ffffff;
  --user-bg: #eef2f7; --user-ink: #1f2b3a; --agent-bg: #fbf3f5; --agent-ink: #2b1f24;
  --chip-bg: #e7e4de; --chip-ink: #4a4f57; --flag-bg: #fff1b8; --flag-line: #c99a00;
  --notice-bg: #fff6d9; --notice-line: #e2c25c; --error: #a1261a;
  --radius: 14px; --space: 20px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a; --surface: #1d2024; --ink: #e8e6e3; --muted: #a1a8b0; --line: #2e3238;
    --accent: #e0708f; --accent-ink: #15171a;
    --user-bg: #1f2a36; --user-ink: #dce6f2; --agent-bg: #2c2026; --agent-ink: #f2e1e6;
    --chip-bg: #343840; --chip-ink: #c9ced6; --flag-bg: #4d4214; --flag-line: #d6b443;
    --notice-bg: #3a3319; --notice-line: #8f7a2c; --error: #ff8f80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 19px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

.bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--accent); text-decoration: none; font-size: 1.05rem; display: inline-flex; align-items: center; min-height: 44px; }
.who { margin-left: auto; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button, .link { font: inherit; min-height: 44px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0 4px; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 0 22px; cursor: pointer; font-weight: 600; }

main { max-width: 820px; margin: 0 auto; padding: var(--space) 16px 64px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.narrow { max-width: 480px; margin: 40px auto; }
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type=email] {
  width: 100%; min-height: 52px; font: inherit; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); color: var(--ink); margin-bottom: 16px;
}

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.conversations { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.conversations a {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; min-height: 64px;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none;
}
.conversations a:active { transform: scale(.995); }
.c-date { font-weight: 600; }
.c-meta { color: var(--muted); font-size: .9rem; grid-column: 1; }
.badge { grid-row: 1 / span 2; grid-column: 2; font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-ink); white-space: nowrap; }
.badge.review { background: var(--flag-bg); color: var(--ink); }

.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: none; font-weight: 600; }
.conv-head { margin: 4px 0 18px; }
.notice { background: var(--notice-bg); border: 1px solid var(--notice-line); border-radius: 10px; padding: 10px 14px; font-size: .95rem; }

.turns { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.turn { border-radius: var(--radius); padding: 14px 18px 16px; max-width: 92%; }
.turn.user { background: var(--user-bg); color: var(--user-ink); justify-self: start; }
.turn.agent { background: var(--agent-bg); color: var(--agent-ink); justify-self: end; }
.who-line { display: flex; gap: 10px; align-items: baseline; font-size: .82rem; margin-bottom: 4px; }
.speaker { font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.time { color: var(--muted); font-variant-numeric: tabular-nums; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chip { background: var(--chip-bg); color: var(--chip-ink); border-radius: 6px; padding: 0 6px; font-size: .9em; }
.flag { background: var(--flag-bg); box-shadow: inset 0 -2px 0 var(--flag-line); border-radius: 3px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.flag:focus-visible { outline: 2px solid var(--flag-line); outline-offset: 2px; }
.flag.open::after {
  content: "possible name — check"; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--flag-line); color: #1f2328; font-size: .72em; font-weight: 600; white-space: nowrap; vertical-align: 2px;
}

.error { color: var(--error); font-weight: 600; }
@media (max-width: 600px) { body { font-size: 18px; } .turn { max-width: 100%; } .card { padding: 20px; } }
