/* ===================================================================
   Design tokens - dark is the committed theme, not a system fallback.
   One accent (electric blue) reserved for the primary action and the
   recording state. One negative colour (brick red) reserved for hard
   failure only - no ambient amber/green states anywhere. Offline and
   idle states are styled as plain neutral, never as a warning.
   =================================================================== */

:root {
  --accent: #5b8bff;
  --accent-hover: #7ea0ff;
  --accent-contrast: #0b1020;
  --danger: #ff7a70;
  --danger-bg: #3a1614;

  --surface: #0e0d0c;
  --surface-raised: #1a1816;
  --surface-sunken: #0a0908;
  --border: #2c2a27;
  --border-strong: #423f3a;

  --text: #f4f2ee;
  --text-muted: #a8a49c;
  --text-faint: #726e67;

  --radius-sm: 8px;
  --radius-md: 14px;
  --focus-ring: 0 0 0 3px rgb(91 139 255 / 0.4);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 8px 28px rgb(0 0 0 / 0.55);
}

/* Light mode swaps background/surface/text/border tokens only. --accent,
   --accent-hover, --accent-contrast, --danger, --danger-bg are deliberately
   NOT redefined here — the mic, primary actions, and focus ring stay the
   same electric blue in both themes; only the ground beneath them changes. */
:root[data-theme="light"] {
  --surface: #f6f4f0;
  --surface-raised: #ffffff;
  --surface-sunken: #ece9e2;
  --border: #ddd8cf;
  --border-strong: #c4beb1;

  --text: #201d18;
  --text-muted: #5f5a50;
  --text-faint: #8c8678;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.08);
  --shadow-md: 0 8px 28px rgb(0 0 0 / 0.14);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  font-family: ui-sans-serif, -apple-system, "Segoe UI Variable", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  background: var(--surface);
  color: var(--text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  /* Chrome's scroll anchoring misfires across the nested #chat-thread scroll
     container: once the thread's own (correctly scrolling) content crosses a
     height threshold, the browser "corrects" the outer page scroll too and
     yanks the whole viewport down, shoving the title/subtitle off-screen with
     no explicit scroll call anywhere in this app's JS. Opt out everywhere the
     jump was reproduced. */
  overflow-anchor: none;
}

#chat-thread { overflow-anchor: none; }

.container {
  overflow-anchor: none;
  max-width: clamp(360px, 92vw, 640px);
  margin: 0 auto;
  padding: calc(clamp(20px, 5vw, 32px) + env(safe-area-inset-top))
    calc(clamp(14px, 4vw, 20px) + env(safe-area-inset-right))
    calc(96px + env(safe-area-inset-bottom))
    calc(clamp(14px, 4vw, 20px) + env(safe-area-inset-left));
}

/* Extra clearance on every page that includes the bottom nav (Group G) -
   layered on top of .container's own bottom padding so nothing sits behind
   the fixed nav bar. */
.container.has-bottom-nav {
  padding-bottom: calc(96px + 64px + env(safe-area-inset-bottom));
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.is-active { color: var(--accent); }

.me-footer-version {
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  margin-top: 24px;
}

/* ---- Work tab (Group G, frames 22/22b) --------------------------------- */

.work-search-row { margin: 16px 0 10px; }
.work-search-row input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 14px;
}

.work-filter-row { display: flex; gap: 8px; margin-bottom: 16px; }
.work-filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.work-filter-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.work-day-header {
  margin: 18px 0 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.work-day-header:first-child { margin-top: 0; }

.work-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-top: none;
  color: var(--text);
  text-decoration: none;
}
.work-history-row:first-of-type,
.work-day-header + .work-history-row { border-top: 1px solid var(--border); border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
.work-history-row:last-child { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.work-history-row:hover { background: var(--surface-sunken); }

.work-history-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.work-history-title {
  font-size: 14px;
  font-weight: 600;
  /* Devanagari/mixed-script transcripts must wrap onto multiple lines, not
     clip or force horizontal scroll - a doc-specified test case. */
  overflow-wrap: anywhere;
}
.work-history-subtitle { color: var(--text-muted); font-size: 12px; }
.work-history-time { color: var(--text-faint); font-size: 12px; flex: none; }

.work-empty-state { text-align: center; padding: 48px 20px; }
.work-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
}
.work-empty-title { font-weight: 600; margin: 0 0 6px; }
.work-empty-body { color: var(--text-muted); font-size: 13px; margin: 0; }
.work-empty-caption { color: var(--text-faint); font-size: 12px; margin: 8px 0 0; }

/* ---- Me tab (Group G, frame 23) ---------------------------------------- */

.me-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* 58dp minimum touch target per the design spec. */
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
/* .me-row sets its own `display`, which otherwise beats the browser's
   default [hidden]{display:none} - without this a hidden .me-row still
   shows (every other row is always-visible, so this never mattered until
   the install row needed to hide/show conditionally). */
.me-row[hidden] { display: none; }
.me-row-label { font-weight: 600; }
.me-row-value { color: var(--text-muted); font-size: 14px; text-align: right; }
.me-row-action {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}
.me-row-hint {
  color: var(--text-faint);
  font-size: 12px;
  margin: -8px 0 8px;
}
.me-row-hint[hidden] { display: none; }

.me-privacy-details {
  margin: 16px 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.me-privacy-details summary { font-weight: 600; cursor: pointer; }
.me-privacy-details p { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: 10px 0 0; }

.me-clear-data-btn { display: block; margin: 20px auto 0; }

/* First-paint reveal, staggered top to bottom - a small dose of the
   motion-as-storytelling feel without pretending this is a scrolling
   narrative page. Also covers hidden panels (fields/errors) the
   moment JS reveals them, which reads as feedback rather than a
   layout jump. */
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.container > * {
  animation: reveal-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.container > *:nth-child(1) { animation-delay: 0s; }
.container > *:nth-child(2) { animation-delay: 0.05s; }
.container > *:nth-child(3) { animation-delay: 0.1s; }
.container > *:nth-child(4) { animation-delay: 0.15s; }
.container > *:nth-child(5) { animation-delay: 0.2s; }
.container > *:nth-child(n+6) { animation-delay: 0.25s; }

@media (prefers-reduced-motion: reduce) {
  .container > * { animation: none; }
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(22px, 4.5vw, 29px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  margin: 28px 0 10px;
}

.subtitle { color: var(--text-muted); margin: 0 0 24px; font-size: 14px; }

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}
.back-link:hover { color: var(--text); }

a { color: var(--accent); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ---- Buttons ---- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  margin: 4px 4px 4px 0;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.button:hover { border-color: var(--text-faint); }
.button:active { transform: scale(0.98); }

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.button.small { padding: 6px 12px; font-size: 13px; }

.button:disabled { opacity: 0.55; cursor: default; transform: none; }

/* .button sets its own `display`, which otherwise beats the browser's default
   [hidden]{display:none} - without this override a hidden .button still shows. */
.button[hidden] { display: none; }

/* Send only earns its place once there's something to send - typed text or a
   finished transcript - so composer opens as just the input, one control. */
.composer .button.primary {
  animation: send-btn-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes send-btn-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .composer .button.primary { animation: none; }
}

/* Circular icon-only buttons (mute, delete, close) - a deliberate,
   documented exception to the soft-radius scale below. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  flex: none;
  transition: transform 0.12s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-faint); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---- Skills grid ---- */

.skill-grid {
  display: grid;
  gap: 10px;
}

.skill-card {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding: 14px 44px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.skill-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.skill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--accent);
  flex: none;
}
.skill-icon svg { width: 19px; height: 19px; }

.skill-name { font-weight: 600; font-size: 15px; }
.skill-meta { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.delete-skill-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
}
.delete-skill-btn svg { width: 16px; height: 16px; }
.delete-skill-btn:hover { color: var(--danger); border-color: var(--danger); }

/* A just-saved skill (Group F, frame 19) - tint clears the first time it's
   actually used (skills.used_at gets set), not on a timer. */
.skill-card-new {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-raised));
  border-color: var(--accent);
}
.skill-card-new-badge {
  position: absolute;
  top: 10px;
  left: 14px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.empty { color: var(--text-muted); font-style: italic; font-size: 14px; }

/* ---- Mic: a disc, never a floating action button ---- */

.mic-disc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  /* 196dp per the design spec's home mic, reached at the 360dp reference
     viewport width (196/360 ≈ 54vw) and capped there for anything wider. */
  width: clamp(140px, 54vw, 196px);
  height: clamp(140px, 54vw, 196px);
  border-radius: 50%;
  border: none;
  background: var(--accent);
  /* White, not --accent-contrast (a dark navy used everywhere else on the
     accent blue) - the design doc's mic mockup specifically draws this
     glyph and label in white; the mic is a distinct "hero" control, not
     one more button in the accent-contrast family. */
  color: #fff;
  cursor: pointer;
  margin: 12px auto;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.mic-disc:hover { transform: scale(1.02); }
.mic-disc:active { transform: scale(0.97); }
.mic-disc svg { width: clamp(36px, 15vw, 56px); height: clamp(36px, 15vw, 56px); stroke-width: 2.25; }
/* No .recording colour override - the spec reserves the single accent for
   both the primary action and the recording state; danger/red is only for
   hard failure. The full-screen recording overlay is this button's actual
   "recording state" visual, and it's the same accent blue by design. */

.mic-disc-wrap { text-align: center; }
.mic-disc-label {
  display: block;
  font-size: clamp(13px, 3.5vw, 16px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
}

/* Compact circular mic used inline in the composer once a conversation
   has started - same disc principle, smaller scale. */
.mic-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 56dp minimum touch target per the design spec - was 44px, below it. */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  flex: none;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.mic-compact:hover { transform: scale(1.05); }
.mic-compact:active { transform: scale(0.95); }
.mic-compact svg { width: 22px; height: 22px; stroke-width: 2.25; }
/* No .recording colour override - same reasoning as .mic-disc above. */

/* Before the first message, the composer mic gets more presence -
   still the "thing the app is for", not yet crowded by a thread. */
.mic-compact.session-idle {
  width: 88px;
  height: 88px;
}
.mic-compact.session-idle svg { width: 30px; height: 30px; }

#record-status { display: block; text-align: center; margin-top: 8px; color: var(--text-muted); font-size: 13px; }

/* ---- Full-screen recording overlay (Group B) -------------------------
   The accent fills the whole screen only here - everywhere else it's
   reserved for the primary action and this recording state. Deliberately
   theme-invariant: --accent is identical in light and dark mode, so this
   overlay never needs its own light/dark override block. ---- */

.recording-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vh, 32px);
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.recording-overlay[hidden] { display: none; }

.rec-top {
  position: absolute;
  top: calc(24px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 8px;
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  animation: rec-pulse 1.4s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .rec-dot { animation: none; }
}
.rec-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mono-digits {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.rec-timer { font-size: clamp(48px, 15vw, 62px); }

.rec-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  width: min(320px, 80vw);
}
.rec-bar {
  flex: 1;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transform: scaleY(0.06);
  transition: transform 0.05s linear;
}

.rec-hint {
  max-width: 320px;
  font-size: 15px;
  line-height: 1.5;
  color: rgb(255 255 255 / 0.9);
  margin: 0;
}

.rec-controls {
  position: absolute;
  bottom: calc(32px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 6vw, 36px);
  width: 100%;
}

.rec-photo-btn, .rec-stop-btn, .rec-cancel-btn {
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
  color: #fff;
  background: transparent;
  transition: transform 0.12s ease;
}
.rec-photo-btn:active, .rec-stop-btn:active, .rec-cancel-btn:active { transform: scale(0.95); }

.rec-photo-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgb(255 255 255 / 0.6);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.rec-photo-btn svg { width: 20px; height: 20px; }

.rec-stop-btn {
  width: clamp(96px, 34vw, 132px);
  height: clamp(96px, 34vw, 132px);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-md);
}
.rec-stop-btn svg { width: 28px; height: 28px; }

.rec-cancel-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid rgb(255 255 255 / 0.6);
  font-size: 11px;
}

/* ---- Attached photos, mid-recording (Group B) ---- */

.rec-attached-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(360px, 90vw);
}
.rec-attached-row[hidden] { display: none; }

.rec-attached-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.8);
  align-self: flex-start;
}

.rec-attached-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  width: 100%;
}

.rec-thumb {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgb(255 255 255 / 0.15);
}
.rec-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rec-thumb-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 4px;
  font-size: 9px;
  color: #fff;
  background: rgb(0 0 0 / 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashed-tile {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed rgb(255 255 255 / 0.5);
  background: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ---- Microphone permission denied (Group B) -------------------------
   Neutral, never accent/danger - this is a blocked state, not a failure
   and not the recording state. ---- */

.mic-denied-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(24px + env(safe-area-inset-top)) 28px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.mic-denied-screen[hidden] { display: none; }

.mic-denied-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  color: var(--text-muted);
  margin-bottom: 8px;
}
.mic-denied-icon svg { width: 30px; height: 30px; }

.mic-denied-title {
  font-size: clamp(20px, 5vw, 25px);
  font-weight: 800;
  max-width: 360px;
  margin: 0;
}

.mic-denied-body {
  color: var(--text-muted);
  max-width: 360px;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.mic-denied-steps {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  max-width: 360px;
  margin: 8px 0;
}

.mic-denied-screen .button {
  width: min(320px, 100%);
  justify-content: center;
}
.mic-denied-retry { margin-top: 8px; }

.mic-denied-note {
  color: var(--text-faint);
  font-size: 13px;
  margin: 4px 0 0;
}

/* ---- Recording interrupted (Group B) ----------------------------------
   Neutral, not accent/danger - this is a paused/recoverable state, not the
   live-recording state and not a failure. ---- */

.capture-interrupted-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.capture-interrupted-screen[hidden] { display: none; }

.capture-interrupted-title {
  font-size: clamp(20px, 5vw, 25px);
  font-weight: 800;
  max-width: 340px;
  margin: 0;
}

.capture-saved-panel {
  width: min(340px, 100%);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.capture-saved-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.capture-saved-timer { font-size: clamp(28px, 8vw, 36px); }

.capture-saved-panel .rec-waveform {
  height: 32px;
  margin: 12px auto 0;
}
.capture-saved-panel .rec-bar { background: var(--text-faint); }

.capture-saved-note {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 12px 0 0;
}

.capture-interrupted-screen .button {
  width: min(320px, 100%);
  justify-content: center;
}
.capture-resume-btn svg { width: 18px; height: 18px; }

.text-action {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 6px;
}
.text-action:hover { color: var(--text); }

/* ---- Forms ---- */

textarea, input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin: 8px 0 16px;
  font-family: inherit;
  background: var(--surface-raised);
  color: var(--text);
}
textarea::placeholder, input[type="text"]::placeholder { color: var(--text-faint); }

/* Read-only, not editable (Group D) - a plain text row, no box, no caret.
   Tapping opens the correction sheet for that field alone. */
.field-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.field-row:first-child { border-top: 1px solid var(--border); }

.field-row-tap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  background: none;
  border: none;
  padding: 8px 4px;
  margin: 0;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.field-row-tap:hover { background: var(--surface-sunken); }

.field-row-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.field-row-label {
  width: 130px;
  flex: none;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.field-row-value {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Low-confidence flagging (Group D, frame 11) - the one accent, tinted, not
   a second (danger) color; capped at 2 per record, enforced server-side. */
.field-row-uncertain {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding-left: 4px;
  margin-left: -7px;
}

.field-check-badge {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.field-uncertain-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12px;
}

@keyframes field-row-flash {
  0%, 100% { background: transparent; }
  30% { background: var(--surface-sunken); }
}
.field-row-flash { animation: field-row-flash 0.6s ease; border-radius: var(--radius-sm); }

.field-remove-btn { width: 32px; height: 32px; flex: none; }
.field-remove-btn svg { width: 15px; height: 15px; }
.field-remove-btn:hover { color: var(--danger); border-color: var(--danger); }

/* Collapsed-by-default raw transcript (Group D, frame 10) - expands in
   place, no layout jump elsewhere since it just grows this row. */
.transcript-row { border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.transcript-row[hidden] { display: none; }

.transcript-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 4px;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
}
.transcript-toggle:hover { color: var(--text); }

.transcript-chevron { width: 14px; height: 14px; flex: none; transition: transform 0.15s ease; }
.transcript-toggle[aria-expanded="true"] .transcript-chevron { transform: rotate(180deg); }

.transcript-text {
  margin: 0 0 10px;
  padding: 0 4px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.transcript-text[hidden] { display: none; }

/* Pinned confirm pair (Group D, frame 10) - "Fix something" is a deliberate
   no-op (see session.js): correction already happens per-field above. */
.confirm-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.confirm-row .button { flex: 1; justify-content: center; }
.confirm-row[hidden] { display: none; }

.confirm-badge {
  margin: 16px 0 0;
  padding: 12px;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}
.confirm-badge[hidden] { display: none; }

/* ---- Correction sheet (Group D) ---------------------------------------
   Modal bottom sheet, one field only. Speak is first and largest; typing
   is a plain fallback below it. ---- */

.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
  z-index: 1100;
}
.sheet-scrim[hidden] { display: none; }

.correction-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1101;
  background: var(--surface-raised);
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
}
.correction-sheet[hidden] { display: none; }

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  margin: 0 auto 16px;
  cursor: grab;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.sheet-field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sheet-now-reads {
  font-size: 11px;
  color: var(--text-faint);
}

.sheet-current-value {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  word-break: break-word;
}

.correction-sheet .button { width: 100%; justify-content: center; margin: 0 0 10px; }
.sheet-hold-btn svg { width: 18px; height: 18px; }
.sheet-hold-btn.is-recording { background: var(--accent-hover); }

.sheet-type-row { display: flex; gap: 8px; margin-bottom: 10px; }
.sheet-type-row[hidden] { display: none; }
.sheet-type-row input { margin: 0; flex: 1; }
.sheet-type-row .button { width: auto; margin: 0; }

.sheet-clear-btn { display: block; margin: 4px auto 0; }

/* ---- Follow-up question card (Group D, frame 13) -----------------------
   Inline in the thread, not a modal - "Hold and answer" is primary and
   largest; Skip/Type sit below it as an equal-weight pair. ---- */

.question-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  max-width: 80%;
}

.question-card-subtitle {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.question-card-subtitle[hidden] { display: none; }

.question-card-headline {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
}

.question-card .button { width: 100%; justify-content: center; }
.question-card-hold-btn { margin-bottom: 10px; }
.question-card-hold-btn.is-recording { background: var(--accent-hover); }

.question-card-row { display: flex; gap: 10px; }
.question-card-row .button { flex: 1; }

.question-card-type-row { display: flex; gap: 8px; margin-top: 10px; }
.question-card-type-row[hidden] { display: none; }
.question-card-type-row input { margin: 0; flex: 1; }
.question-card-type-row .button { width: auto; }

/* ---- Skill prompt card (Group F, frame 17) -----------------------------
   Inline in the thread, never a modal - same "card with an accent rail"
   language as the question card above. ---- */

.skill-prompt-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  max-width: 80%;
}

.skill-prompt-eyebrow {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.skill-prompt-headline { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.skill-prompt-body { margin: 0 0 14px; color: var(--text); font-size: 14px; line-height: 1.5; }

.skill-prompt-row { display: flex; gap: 10px; }
.skill-prompt-row .button { flex: 1; margin: 0; justify-content: center; }

.skill-prompt-footer {
  margin: 10px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

/* ---- Skill review screen (Group F, frame 18) --------------------------- */

.skill-review-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.skill-review-screen[hidden] { display: none; }

.skill-review-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
}

.skill-review-title {
  font-size: clamp(20px, 5vw, 25px);
  font-weight: 800;
  margin: 8px 0 24px;
  max-width: 360px;
}

.skill-review-section { margin-bottom: 24px; }

.skill-review-label {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.skill-review-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.skill-review-sublabel {
  margin: 0 0 8px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.skill-review-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.skill-review-name { font-size: 17px; font-weight: 700; word-break: break-word; }

.field-proposal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-top: none;
}
.field-proposal-row:first-child { border-top: 1px solid var(--border); border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
.field-proposal-row:last-child { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }

.field-proposal-name { flex: 1; font-weight: 600; word-break: break-word; }

.field-proposal-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  flex: none;
}
.field-proposal-toggle input { margin: 0; }

.field-proposal-delete { width: 32px; height: 32px; flex: none; }
.field-proposal-delete svg { width: 15px; height: 15px; }
.field-proposal-delete:hover { color: var(--danger); border-color: var(--danger); }

.skill-review-formats { display: flex; flex-wrap: wrap; gap: 8px; }
.format-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.skill-review-error {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.skill-review-error[hidden] { display: none; }

.skill-review-save { width: 100%; justify-content: center; }

/* ---- Toast / snackbar (shared) ----------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  max-width: min(400px, calc(100vw - 32px));
}
.toast[hidden] { display: none; }

.toast-message { font-size: 14px; }
.toast-action {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  flex: none;
}
.toast-action[hidden] { display: none; }

#downloads a {
  display: inline-block;
  margin: 4px 8px 4px 0;
}

/* ---- Sitting shell (Group F, frames 20/21) ----------------------------- */

.sitting-stats {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}
.sitting-stats[hidden] { display: none; }

.sitting-stat-tile {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.sitting-stat-value { display: block; font-size: 22px; font-weight: 800; color: var(--accent); }
.sitting-stat-label { display: block; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.sitting-back-bar { margin: 8px 0; }
.sitting-back-bar[hidden] { display: none; }

.sitting-shell { margin-top: 20px; }
.sitting-shell[hidden] { display: none; }

.sitting-records-label {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sitting-records-list { margin-bottom: 14px; }

.sitting-record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-top: none;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.sitting-record-row:first-child { border-top: 1px solid var(--border); border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
.sitting-record-row:last-child { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.sitting-record-row:hover { background: var(--surface-sunken); }

.sitting-record-title { flex: 1; overflow-wrap: anywhere; }
.sitting-record-check { color: var(--accent); font-weight: 700; flex: none; }
.sitting-record-flag {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  flex: none;
}

.sitting-add-another-btn { width: 100%; justify-content: center; }
.sitting-finish-btn { width: 100%; justify-content: center; }

.sitting-resume-banner[hidden] { display: none; }
.sitting-resume-actions { display: flex; gap: 10px; margin-top: 8px; }
.sitting-resume-actions .button { flex: 1; margin: 0; justify-content: center; }

/* ---- Session summary (Group F, frame 21) ------------------------------- */

.sitting-summary-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}
.sitting-summary-screen[hidden] { display: none; }

.sitting-summary-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
}

.sitting-summary-title {
  font-size: clamp(20px, 5vw, 25px);
  font-weight: 800;
  margin: 8px 0 16px;
}

.sitting-summary-note {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.sitting-summary-note[hidden] { display: none; }

.sitting-summary-list { margin-bottom: 20px; }

.sitting-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-top: none;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.sitting-summary-row:first-child { border-top: 1px solid var(--border); border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm); }
.sitting-summary-row:last-child { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.sitting-summary-row:hover { background: var(--surface-sunken); }

.sitting-summary-finish-btn { width: 100%; justify-content: center; }
.sitting-summary-keep-btn { width: 100%; justify-content: center; }

.error {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 14px;
}

.audio-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Chat / conversation UI ---- */

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  max-height: 50vh;
  overflow-y: auto;
  padding: 2px 4px 2px 2px;
}

.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  animation: bubble-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .bubble { animation: none; }
}

.bubble-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-contrast);
  border-bottom-right-radius: 4px;
}

.bubble-assistant {
  align-self: flex-start;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.bubble-thinking { color: var(--text-muted); font-style: italic; }

/* ---- Artifact-ready card (Group E, frames 15 & 16) - a real preview of
   the record, then Open/Share per generated format. Share is primary; Open
   is secondary. ---- */

.artifact-preview { display: flex; flex-direction: column; gap: 2px; }

.artifact-preview-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}
.artifact-preview-key {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex: none;
}
.artifact-preview-value {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.artifact-preview-more { color: var(--text-faint); font-size: 12px; margin-top: 2px; }

.artifact-format-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.artifact-format-label {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.artifact-format-row .button { width: auto; }

.artifact-share-confirm {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}
.artifact-share-confirm[hidden] { display: none; }

/* ---- Post-Send processing card (Group C) ------------------------------
   Named steps, never a bare spinner - this can run several seconds and the
   user needs to see it moving. Neutral surface, matching an assistant
   bubble - this isn't the recording state, no accent fill here. ---- */

.processing-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  max-width: 80%;
}

.processing-steps { display: flex; flex-direction: column; gap: 8px; }

.processing-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.processing-step.is-pending { color: var(--text-faint); }
.processing-step.is-active { color: var(--text); font-weight: 600; }
.processing-step.is-done { color: var(--text-muted); }

.processing-step-icon {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  position: relative;
}
.processing-step.is-done .processing-step-icon {
  border-color: var(--accent);
  background: var(--accent);
}
.processing-step.is-done .processing-step-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--accent-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.processing-step.is-active .processing-step-icon {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: processing-spin 0.8s linear infinite;
}
@keyframes processing-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .processing-step.is-active .processing-step-icon { animation: none; }
}

.processing-progress-bar {
  margin-top: 12px;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.processing-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.processing-skeleton { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.processing-skeleton-line {
  height: 10px;
  border-radius: 4px;
  background: var(--surface-sunken);
  animation: processing-shimmer 1.4s ease-in-out infinite;
}
.processing-skeleton-line.short { width: 60%; }
@keyframes processing-shimmer {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .processing-skeleton-line { animation: none; }
}

/* ---- Processing failed (Group C) - terminal state, two silent retries
   already happened before this ever shows. Reassurance comes before the
   retry action - that's the user's real fear, address it first. ---- */

.processing-error-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  max-width: 80%;
}

.processing-error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
  margin-bottom: 8px;
}

.processing-error-title { font-weight: 700; margin-bottom: 4px; }
.processing-error-body { color: var(--text-muted); font-size: 14px; margin: 0 0 12px; }
.processing-error-card .button { width: 100%; justify-content: center; }
.processing-error-ref { color: var(--text-faint); font-size: 11px; margin: 10px 0 0; }

/* ---- Offline queue (Group C) -------------------------------------------
   Neutral grey only - offline is an expected field condition, never an
   error, so no --danger/--danger-bg here. ---- */

.offline-banner {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 12px 0;
  color: var(--text-muted);
}
.offline-banner[hidden] { display: none; }

.offline-banner-title { font-weight: 600; color: var(--text); margin: 0; font-size: 14px; }
.offline-banner-sub { margin: 2px 0 0; font-size: 13px; }

.queued-list { margin-top: 10px; }
.queued-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.queued-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.queued-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queued-row-status { color: var(--text-faint); flex: none; }
.queued-row.is-ready { cursor: pointer; }
.queued-row-open { color: var(--accent); font-weight: 600; flex: none; }

/* ---- Recent list (Group C, homepage) ---- */

.recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.recent-row:first-child { border-top: none; }
.recent-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.recent-row-badge {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.recent-row-badge.is-working { background: var(--surface-sunken); color: var(--text-muted); }
.recent-row-badge.is-failed { background: var(--danger-bg); color: var(--danger); }

.composer {
  display: flex;
  gap: 10px;
  align-items: center;
}

.composer input[type="text"] { margin: 0; flex: 1; }

/* ===================================================================
   Responsive tiers
   Fluid clamp()-based sizing above already covers most of the range
   between a small phone and a laptop. These tiers handle the edges:
   a safety net for very narrow phones, more breathing room on
   laptop/desktop, and a distinctly larger scale for TVs and other
   10-foot displays, where the same pixel sizes read as tiny from
   normal viewing distance.
   =================================================================== */

/* Very short viewports (landscape phone with the keyboard open) -
   the thread is the thing competing for space, so give it room back. */
@media (max-height: 480px) {
  .container { padding-top: 12px; }
  .chat-thread { max-height: 34vh; }
  .mic-compact.session-idle { width: 56px; height: 56px; }
  .mic-compact.session-idle svg { width: 22px; height: 22px; }
}

/* Very narrow phones - clamp() already scales most things down, this
   just keeps the composer row from feeling cramped at the extreme end. */
@media (max-width: 360px) {
  .composer { gap: 6px; }
  .mic-compact.session-idle { width: 68px; height: 68px; }
  .mic-compact.session-idle svg { width: 26px; height: 26px; }
}

/* Laptop / desktop monitor - more width and vertical room than a
   handheld device actually has to offer. */
@media (min-width: 1024px) {
  .container { max-width: 720px; }
  .chat-thread { max-height: 58vh; }
}

/* TV and other large, far-viewed displays. Pixel sizes tuned for an
   arm's-length phone or a laptop read as tiny from a couch, so this
   tier steps every touchpoint up in real size rather than just letting
   the layout stretch wider. */
@media (min-width: 1600px) {
  .container { max-width: 860px; padding-top: 48px; }
  h1 { font-size: 40px; }
  h2 { font-size: 16px; }
  .subtitle { font-size: 17px; }

  .button { font-size: 16px; padding: 13px 22px; }
  .icon-btn { width: 46px; height: 46px; }
  .icon-btn svg { width: 21px; height: 21px; }

  .mic-disc { width: 220px; height: 220px; }
  .mic-disc svg { width: 62px; height: 62px; }
  .mic-disc-label { font-size: 16px; }
  .mic-compact { width: 64px; height: 64px; }
  .mic-compact svg { width: 26px; height: 26px; }
  .mic-compact.session-idle { width: 108px; height: 108px; }
  .mic-compact.session-idle svg { width: 36px; height: 36px; }

  .bubble { font-size: 17px; padding: 14px 18px; }
  .chat-thread { max-height: 62vh; gap: 14px; }

  .skill-name { font-size: 18px; }
  .skill-meta { font-size: 15px; }
  .skill-icon { width: 46px; height: 46px; }
  .skill-icon svg { width: 22px; height: 22px; }

  textarea, input[type="text"] { font-size: 16px; padding: 13px 16px; }
  .field-row label { width: 190px; font-size: 14px; }
}

/* ---- Auth: login / signup (Group H) ---- */
.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 80vh;
  justify-content: center;
}

.auth-title { font-size: 22px; margin: 0 0 4px; }
.auth-subtitle { color: var(--text-muted); margin: 0 0 24px; }

.auth-error {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: 14px;
}

.auth-form { display: flex; flex-direction: column; gap: 6px; }

.auth-label {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 12px;
}

.auth-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
}

.auth-submit {
  width: 100%;
  margin-top: 24px;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
}

.auth-submit:hover { background: var(--accent-hover); }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.auth-switch a { color: var(--accent); }

.me-profile-header { margin-bottom: 8px; }
.me-profile-name { font-size: 18px; font-weight: 600; margin: 0; }
.me-profile-meta { color: var(--text-muted); font-size: 14px; margin: 2px 0 0; }
.me-profile-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me-profile-row .text-action { font-size: 13px; flex-shrink: 0; }
