/* Levin PWA. Solid colours only, one accent, and 64 px touch targets because it is used
   one-handed, often outdoors, sometimes while walking. */
:root {
  --bg: #0f1115;
  --surface: #181b21;
  --surface-2: #22262e;
  --line: #2c313a;
  --text: #f2f3f5;
  --muted: #a3a9b4;       /* 7.9:1 on --bg */
  --accent: #ffc53d;      /* warm yellow; black text on it is 12:1 */
  --accent-ink: #14120a;
  --user: #2b3240;
  --danger: #ff8a80;
  --radius: 16px;
  --tap: 64px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f3;
    --surface: #ffffff;
    --surface-2: #ecece7;
    --line: #d9d9d2;
    --text: #15171b;
    --muted: #555b66;     /* 6.9:1 on --bg */
    --accent: #ffc53d;
    --user: #e3e7ee;
    --danger: #b3261e;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
code { font-size: 0.9em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

#app { display: flex; flex-direction: column; height: 100dvh; }
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: env(safe-area-inset-top) 16px 0;
}
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.bar h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.5em; }

.primary, .ghost {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  font-weight: 650;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { color: var(--danger); margin-top: 24px; align-self: flex-start; }

/* Setup */
#setup { justify-content: center; min-height: 100dvh; }
.setup-card { max-width: 420px; width: 100%; margin: 0 auto; }
.setup-card h1 { font-size: 34px; margin: 0 0 8px; }
.setup-card label { display: block; font-weight: 650; margin: 24px 0 8px; }
.setup-card input, .memory-form input, .text-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.setup-card .primary { width: 100%; margin-top: 16px; min-height: var(--tap); }

/* Conversation */
.thread { list-style: none; margin: 0; padding: 8px 0 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 6px; }
.msg.levin { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg .meta { display: block; font-size: 13px; color: var(--muted); margin-top: 6px; }
.msg.levin .saved { display: block; font-size: 14px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); }
.empty { color: var(--muted); text-align: center; margin: auto 0; padding: 24px; }

.dock { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 12px; }
.talk-state { margin: 0; color: var(--muted); font-size: 15px; min-height: 1.5em; }
.mic {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  transition: transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.mic svg { width: 40px; height: 40px; fill: currentColor; }
.mic:active { transform: scale(0.96); }
.mic.listening { background: var(--danger); color: #1b0b0a; animation: pulse 1.4s ease-in-out infinite; }
.mic.busy { background: var(--surface-2); color: var(--muted); }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .mic.listening { animation: none; } .mic { transition: none; } }

.text-form { display: flex; gap: 8px; width: 100%; }
.send { width: 52px; min-width: 52px; border-radius: 12px; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.send svg { width: 22px; height: 22px; fill: var(--text); }

/* Lists */
.memory-form { display: flex; gap: 8px; margin-bottom: 12px; }
.list { list-style: none; margin: 0; padding: 0 0 16px; overflow-y: auto; flex: 1; }
.list li { display: flex; align-items: center; gap: 12px; min-height: var(--tap); border-bottom: 1px solid var(--line); padding: 10px 0; }
.list li > span { flex: 1; }
.list li small { display: block; color: var(--muted); font-size: 13px; }
.list .row-btn { background: none; border: 0; min-width: 48px; min-height: 48px; color: var(--muted); }
.list button.open { flex: 1; text-align: left; background: none; border: 0; padding: 0; min-height: 48px; }

/* Status */
.status { display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; margin: 8px 0; }
.status dt { color: var(--muted); }
.status dd { margin: 0; text-align: right; font-weight: 600; }
.ok { color: #7ddc8c; }
.bad { color: var(--danger); }
@media (prefers-color-scheme: light) { .ok { color: #1e7b34; } }

.msg.levin .sources { display: block; font-size: 14px; margin-top: 8px; color: var(--muted); }
.msg.levin .sources a { color: var(--text); text-underline-offset: 3px; }

/* Meetings */
#meetings { overflow-y: auto; padding-bottom: 16px; }
.consent { margin: 0 0 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.meeting-toggle { width: 100%; min-height: var(--tap); }
.meeting-toggle.recording { background: var(--danger); color: #1b0b0a; }
.meeting-live { margin-top: 12px; }
.rec { display: flex; align-items: center; gap: 8px; font-weight: 650; margin: 0 0 8px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.meeting-text { white-space: pre-wrap; color: var(--muted); font-size: 15px; }
.meeting-text p { margin: 0 0 8px; }
.meeting-detail h2 { margin: 16px 0 2px; font-size: 21px; }
.meeting-summary { white-space: pre-wrap; margin: 12px 0; }
.meeting-detail details { margin: 12px 0; }
.meeting-detail summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }

/* Reminders */
.reminders h2 { font-size: 17px; margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.reminders .list { flex: none; padding-bottom: 8px; }

/* Voice print */
.voice-card { margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.voice-card h2 { font-size: 19px; margin: 0 0 6px; }
.voice-card .primary { width: 100%; min-height: var(--tap); margin-top: 8px; }
.voice-card .danger { margin-top: 12px; }
.small { font-size: 15px; }
.voice-steps { margin: 12px 0 0; padding: 12px; border-radius: 12px; background: var(--surface-2); }

/* Growth */
.sub { font-size: 15px; color: var(--muted); margin: 18px 0 4px; font-weight: 650; }
.list.compact { flex: none; padding-bottom: 0; }
.list.compact li { min-height: 48px; }
.journal-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.journal-entry p { margin: 4px 0; }
.journal-entry ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 15px; }
#reflect-now { margin-top: 14px; }
.row-actions { display: flex; gap: 4px; }

/* Tabs */
.tabs {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { min-height: var(--tap); background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 14px; padding: 0 2px; }
.tabs button[aria-current="page"] { color: var(--text); box-shadow: inset 0 3px 0 var(--accent); }
#status { overflow-y: auto; padding-bottom: 16px; }
