/* =============================================================
 * Aspire33 sandbox — high-contrast, plain styling.
 *
 * White background, near-black text, blue accent for the user
 * voice, neutral grey for the agent voice. Boring on purpose;
 * readability over aesthetic.
 * ============================================================= */

:root {
  /* Text — high contrast against white. */
  --ink:          #0a0a0a;  /* primary text, near black */
  --ink-soft:     #2c2c2c;  /* secondary text */
  --ink-mute:     #525252;  /* tertiary text (still readable, was the problem) */

  /* Surfaces */
  --paper:        #ffffff;  /* main background, pure white */
  --paper-2:      #f7f7f7;  /* sticky chrome: header, sidebar, composer */
  --paper-3:      #ececec;  /* hover / pressed */

  /* Accents */
  --user:         #1d4ed8;  /* deep blue, accessible on white */
  --user-soft:    #dbeafe;  /* user focus halo */
  --agent-bg:     #f3f4f6;  /* neutral light grey for agent bubble */
  --agent-bd:     #d1d5db;  /* agent bubble border */

  /* Lines */
  --line:         #e5e5e5;
  --line-strong:  #bdbdbd;

  /* States */
  --danger:       #b91c1c;
  --warn:         #b45309;
  --ok:           #047857;

  /* Banner — keep the warning feel but readable. */
  --banner-bg:    #fde68a;
  --banner-bd:    #ca8a04;
  --banner-ink:   #422006;

  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;

  --shadow-soft:  0 1px 2px rgba(0,0,0,0.05),
                  0 1px 3px rgba(0,0,0,0.04);
  --shadow-pop:   0 4px 12px rgba(0,0,0,0.10);

  --header-h:     64px;
  --banner-h:     34px;
  --sidebar-w:    300px;

  --fs-base:      16px;
  --fs-sm:        14px;
  --fs-xs:        12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:         #f5f5f5;
    --ink-soft:    #d4d4d4;
    --ink-mute:    #a3a3a3;
    --paper:       #18181b;   /* softer than near-black */
    --paper-2:     #1f1f23;
    --paper-3:     #2a2a2e;
    --user:        #3b82f6;   /* less neon than #60a5fa, still readable */
    --user-soft:   #1e3a8a;
    --agent-bg:    #2a2a2e;   /* more separation from page background */
    --agent-bd:    #4a4a4f;   /* stronger border */
    --line:        #2a2a2e;
    --line-strong: #525252;
    --banner-bg:   #422006;
    --banner-bd:   #f59e0b;   /* brighter — makes the dot visible */
    --banner-ink:  #fde68a;
    --shadow-soft: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-pop:  0 4px 12px rgba(0,0,0,0.5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 100vh;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}

/* ------------------------------------------------------------ banner */

.sandbox-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--banner-h);
  background: var(--banner-bg);
  color: var(--banner-ink);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--banner-bd);
  position: sticky;
  top: 0;
  z-index: 30;
}
.sandbox-banner .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--banner-bd);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--banner-bd) 30%, transparent);
}

/* ------------------------------------------------------------ header */

.app-header {
  position: sticky;
  top: var(--banner-h);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  height: var(--header-h);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.app-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  cursor: pointer;
}
.app-title:hover { opacity: 0.8; }
.aspire-accent { color: var(--user); }

.app-subtitle {
  font-size: var(--fs-sm);
  color: var(--ink-mute);
}
.app-version {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  background: var(--paper-3);
  border-radius: 999px;
  padding: 1px 8px;
}
.app-version:empty { display: none; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.user-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.user-picker:focus-within {
  border-color: var(--user);
  box-shadow: 0 0 0 3px var(--user-soft);
}
.user-picker-label {
  color: var(--ink-mute);
  font-size: var(--fs-xs);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
#user-id-input {
  border: none;
  outline: none;
  background: transparent;
  width: 140px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: var(--fs-sm);
  color: var(--ink);
}

.dev-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.dev-toggle input { display: none; }
.dev-toggle-switch {
  width: 36px;
  height: 22px;
  background: var(--line-strong);
  border-radius: 999px;
  position: relative;
  transition: background 160ms ease;
}
.dev-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 160ms ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.dev-toggle input:checked + .dev-toggle-switch { background: var(--user); }
.dev-toggle input:checked + .dev-toggle-switch::after { transform: translateX(14px); }
.dev-toggle-label {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------ settings cog */

.settings-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, color 120ms ease;
}
.settings-btn:hover {
  background: var(--paper-3);
  color: var(--ink);
}
.settings-btn:active { transform: rotate(15deg); transition: transform 120ms; }

/* ------------------------------------------------------------ settings page */

/* When the settings page is active, hide the chat view. The cog click
   toggles `body.settings-mode`; back-arrow click removes it. */
.settings-page { display: none; }
body.settings-mode .layout,
body.settings-mode .composer,
body.settings-mode .toast { display: none; }
body.settings-mode .settings-page { display: block; }
body.settings-mode .app-header { /* keep header visible for back navigation context */ }

.settings-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* LLM log page — same overlay pattern as settings. */
.llmlog-page { display: none; }
body.llmlog-mode .layout,
body.llmlog-mode .composer,
body.llmlog-mode .toast { display: none; }
body.llmlog-mode .llmlog-page { display: block; }
.llmlog-page { max-width: 1000px; margin: 0 auto; padding: 24px 24px 80px; }
.llmlog-tail-toggle { margin-left: auto; }
.llmlog-body { display: flex; flex-direction: column; gap: 16px; }

.llmlog-summary {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.llmlog-stat {
  flex: 1; min-width: 120px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px;
}
.llmlog-stat .stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-mute); font-weight: 600;
}
.llmlog-stat .stat-value { font-size: 20px; font-weight: 700; color: var(--ink); }
.llmlog-stat .stat-sub { font-size: 12px; color: var(--ink-soft); }
.llmlog-stat--error .stat-value { color: var(--danger); }

.llmlog-filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 12px 14px; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.llmlog-filter { display: flex; flex-direction: column; gap: 4px; }
.llmlog-filter span { font-size: 11px; color: var(--ink-mute); font-weight: 600; }
.llmlog-filter select {
  padding: 7px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--paper); color: var(--ink);
  font-size: 13px; min-width: 130px;
}

.llmlog-list { display: flex; flex-direction: column; gap: 8px; }
.llmlog-empty { color: var(--ink-mute); padding: 24px; text-align: center; }

.llmcall {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); overflow: hidden;
}
.llmcall-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; cursor: pointer;
}
.llmcall-head:hover { background: var(--paper-2); }
.llmcall-type { font-weight: 700; color: var(--ink); font-size: 13px; }
.llmcall-pill {
  font-size: 11px; color: var(--ink-soft);
  background: var(--paper-3); border-radius: 999px; padding: 2px 8px;
}
.llmcall-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.llmcall-status--success { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.llmcall-status--error,
.llmcall-status--transient { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.llmcall-time { margin-left: auto; font-size: 11px; color: var(--ink-mute); }
.llmcall-body { display: none; padding: 0 14px 14px; }
.llmcall.open .llmcall-body { display: block; }
.llmcall-section { margin-top: 12px; }
.llmcall-section-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-mute); font-weight: 700; margin-bottom: 4px;
}
.llmcall-copy {
  font-size: 11px; color: var(--user); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 2px 8px;
}
.llmcall-copy:hover { background: var(--paper-3); }
.llmcall pre {
  margin: 0; padding: 10px 12px; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px; line-height: 1.5; color: var(--ink-soft);
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto;
}

/* Onboarding page — same overlay pattern as settings. */
.onboarding-page { display: none; }
body.onboarding-mode .layout,
body.onboarding-mode .composer,
body.onboarding-mode .toast { display: none; }
body.onboarding-mode .onboarding-page { display: block; }
.onboarding-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.onboard-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; gap: 14px; }
.form-row[hidden] { display: none; }
.form-row .form-field { flex: 1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field[hidden] { display: none; }
.form-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-soft);
}
.form-field input,
.form-field select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
}
.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--user);
  background: var(--paper);
}
.onboard-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Archetype panel — dev-view only. The archetype is internal/system
   information, so the regular user never sees it; toggling "Dev view"
   reveals it (label, rationale, and the gathered dimension chips). */
.archetype-panel {
  margin: 0 0 12px;
  padding: 14px 16px;
  background: var(--user-soft, var(--paper-2));
  border: 1px solid var(--user, var(--line));
  border-radius: var(--radius-lg);
}
.archetype-panel[hidden] { display: none; }
body:not(.dev-on) .archetype-panel { display: none; }

/* "✓ detected" badge shown when classification is complete. */
.archetype-progress--done { color: var(--ok, #2e7d32); }
.archetype-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.archetype-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.archetype-progress {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-mute);
}
.archetype-progress[hidden] { display: none; }
.archetype-label {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.archetype-rationale {
  margin: 6px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  line-height: 1.5;
}
.archetype-rationale[hidden] { display: none; }

/* Dimension chips — dev-view only. */
.archetype-dims { display: none; }
body.dev-on .archetype-dims {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.dim-chip {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--paper-3);
  border: 1px solid var(--line);
}
.dim-chip .dim-name { color: var(--ink-mute); font-weight: 600; }
.dim-chip .dim-val { color: var(--ink); }
.dim-chip--empty { opacity: 0.6; }
.dim-chip--empty .dim-val { color: var(--ink-mute); font-style: italic; }

/* Resume page — the resume builder's workspace (own overlay page). */
.resume-page { display: none; }
body.resume-mode .layout,
body.resume-mode .composer,
body.resume-mode .toast { display: none; }
body.resume-mode .resume-page { display: block; }
.resume-page { max-width: 920px; margin: 0 auto; padding: 24px 24px 80px; }
.resume-body { display: flex; flex-direction: column; gap: 16px; }

.resume-meta {
  background: var(--user-soft, var(--paper-2));
  border: 1px solid var(--user, var(--line));
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.resume-meta .resume-archetype { font-size: 18px; font-weight: 700; color: var(--ink); }
.resume-meta .resume-rationale { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.5; }

.resume-empty { color: var(--ink-mute); padding: 40px; text-align: center; }
.resume-empty[hidden] { display: none; }

/* ---- Professional résumé preview — a print-ready "paper" rendering ---- */
.resume-doc-page { display: none; }
body.resume-doc-mode .layout,
body.resume-doc-mode .composer,
body.resume-doc-mode .toast { display: none; }
body.resume-doc-mode .resume-doc-page { display: block; }

.resume-doc-toolbar {
  display: flex; align-items: center; gap: 16px;
  max-width: 860px; margin: 0 auto; padding: 16px 24px 0;
}
/* Title + save-status sit on the left; the rest is pushed right by the first
   right-group control (robust even when the save pill is hidden). The shared
   .settings-page-title has flex:1 (grows), so size it to content here. */
.resume-doc-toolbar .settings-page-title { flex: 0 0 auto; }
.resume-doc-toolbar .resume-doc-style-wrap { margin-left: auto; }
.resume-doc-print-btn {
  border: 1px solid var(--user);
  background: var(--user); color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.resume-doc-print-btn:hover { filter: brightness(1.06); }
.resume-doc-build-btn {
  border: 1px solid var(--line);
  background: var(--paper-2); color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.resume-doc-build-btn:hover { border-color: var(--user); color: var(--user); }
.resume-doc-build-btn:disabled { opacity: 0.6; cursor: default; }
.resume-doc-edit-btn {
  border: 1px solid var(--line);
  background: var(--paper-2); color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.resume-doc-edit-btn:hover { border-color: var(--user); color: var(--user); }
.resume-doc-edit-btn.active { background: var(--user); color: #fff; border-color: var(--user); }

/* Per-section "Edit with AI" affordances — only in edit mode, never printed. */
.doc-section-edit { display: none; margin-top: 6px; }
body.resume-doc-editing .doc-section-edit { display: block; }
.doc-edit-btn {
  border: 1px dashed #bbb; background: transparent; color: #555;
  border-radius: 6px; padding: 3px 10px; font-size: 11.5px; cursor: pointer;
  font-family: -apple-system, system-ui, sans-serif;
}
.doc-edit-btn:hover { border-color: var(--user); color: var(--user); }
.doc-edit-box {
  margin-top: 6px; padding: 10px; border: 1px solid #ddd; border-radius: 8px;
  background: #fafafa; font-family: -apple-system, system-ui, sans-serif;
  text-align: left;  /* stay left-aligned even inside the centered header */
}
.doc-edit-input {
  width: 100%; box-sizing: border-box; resize: vertical;
  border: 1px solid #ccc; border-radius: 6px; padding: 7px 9px;
  font-size: 12.5px; color: #1a1a1a; font-family: inherit;
}
.doc-edit-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.doc-edit-chip {
  border: 1px solid #ccc; background: #fff; color: #333;
  border-radius: 999px; padding: 3px 10px; font-size: 11.5px; cursor: pointer;
}
.doc-edit-chip:hover { border-color: var(--user); color: var(--user); }
.doc-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.doc-edit-apply {
  border: 1px solid var(--user); background: var(--user); color: #fff;
  border-radius: 6px; padding: 5px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.doc-edit-cancel {
  border: 1px solid #ccc; background: #fff; color: #555;
  border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.doc-edit-btnrow { display: flex; gap: 8px; }
.doc-edit-btnrow[hidden] { display: none; }
/* Manual (typed) edit form. */
.doc-manual-row { display: block; margin-bottom: 8px; }
.doc-manual-label {
  display: block; font-size: 11px; font-weight: 600; color: #555;
  margin-bottom: 3px; font-family: -apple-system, system-ui, sans-serif;
}
.doc-manual-input, .doc-manual-area {
  width: 100%; box-sizing: border-box; border: 1px solid #ccc; border-radius: 6px;
  padding: 6px 9px; font-size: 12.5px; color: #1a1a1a;
  font-family: -apple-system, system-ui, sans-serif; resize: vertical;
}
.doc-edited-tag {
  margin-left: 8px; font-size: 10px; font-weight: 600; color: var(--user);
  font-family: -apple-system, system-ui, sans-serif; vertical-align: middle;
  text-transform: none; letter-spacing: 0;
}
.doc-section-busy { opacity: 0.45; transition: opacity 0.15s; }

/* ---- Style templates ---- */
/* The picker (segmented control). */
.resume-doc-templates {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.resume-doc-templates .tpl-btn {
  border: none; border-right: 1px solid var(--line);
  background: var(--paper-2); color: var(--ink);
  padding: 8px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.resume-doc-templates .tpl-btn:last-child { border-right: none; }
.resume-doc-templates .tpl-btn:hover { color: var(--user); }
.resume-doc-templates .tpl-btn.active { background: var(--user); color: #fff; }

/* classic = the base .resume-doc look (serif, centered). */

/* modern — sans-serif, left-aligned, accent-colored section rules. */
.resume-doc.tpl-modern { font-family: "Helvetica Neue", Arial, sans-serif; }
.resume-doc.tpl-modern .doc-header {
  text-align: left; border-bottom: 3px solid var(--user);
}
.resume-doc.tpl-modern .doc-name { color: var(--user); letter-spacing: 0; }
.resume-doc.tpl-modern .doc-title { font-style: normal; font-weight: 600; color: #333; }
.resume-doc.tpl-modern .doc-contact { font-family: inherit; }
.resume-doc.tpl-modern .doc-section-title {
  color: var(--user); border-bottom: 2px solid var(--user); letter-spacing: 0.5px;
}

/* two-column — header band over a sidebar + main grid. */
.resume-doc.tpl-two-column { font-family: "Helvetica Neue", Arial, sans-serif; }
.resume-doc.tpl-two-column .doc-header {
  text-align: left; border-bottom: 2px solid #1a1a1a;
}
.resume-doc.tpl-two-column .doc-2col {
  display: grid; grid-template-columns: 1fr 2fr; gap: 26px;
  margin-top: 18px; align-items: start;
}
.resume-doc.tpl-two-column .doc-sidebar {
  background: #f4f6f8; border-radius: 8px; padding: 14px 16px 8px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.resume-doc.tpl-two-column .doc-section { margin-top: 14px; }
.resume-doc.tpl-two-column .doc-sidebar .doc-section:first-child,
.resume-doc.tpl-two-column .doc-main .doc-section:first-child { margin-top: 0; }
.resume-doc.tpl-two-column .doc-sidebar .doc-section-title {
  font-size: 12px; border-bottom: 1px solid #cbd3da;
}
.resume-doc.tpl-two-column .doc-sidebar .doc-list { padding-left: 16px; }
.resume-doc.tpl-two-column .doc-sidebar .doc-list li { font-size: 12px; }

/* ---- header photo (shared; visible only in banner / portrait) ---- */
.resume-doc .doc-photo {
  display: none; position: relative; flex: 0 0 auto;
  align-items: center; justify-content: center; cursor: pointer; overflow: hidden;
  background-size: cover; background-position: center;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.resume-doc .doc-headtext { min-width: 0; }
.resume-doc .doc-photo-ph { font-size: 26px; opacity: 0.9; }
.resume-doc .doc-photo-remove {
  position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer; display: none;
}
.resume-doc .doc-photo.has-photo:hover .doc-photo-remove { display: block; }
/* With a real photo, drop the dashed "upload" look for a clean frame. */
.resume-doc.tpl-banner .doc-photo.has-photo { border: 2px solid rgba(255, 255, 255, 0.85); }
.resume-doc.tpl-portrait .doc-photo.has-photo { border: 1px solid rgba(0, 0, 0, 0.12); }

/* banner — accent gradient header band with a circular photo on the left. */
.resume-doc.tpl-banner { font-family: "Helvetica Neue", Arial, sans-serif; }
.resume-doc.tpl-banner .doc-header {
  display: flex; align-items: center; gap: 24px; text-align: left;
  background: linear-gradient(135deg, var(--user), #1e3a8a); color: #fff;
  border: none; border-radius: 8px 8px 0 0;
  margin: -48px -56px 22px; padding: 28px 56px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.resume-doc.tpl-banner .doc-headtext { flex: 1; }
.resume-doc.tpl-banner .doc-name { color: #fff; }
.resume-doc.tpl-banner .doc-title { color: #dbeafe; font-style: normal; font-weight: 600; }
.resume-doc.tpl-banner .doc-contact { color: #cdddf5; }
.resume-doc.tpl-banner .doc-photo {
  display: flex; width: 96px; height: 96px; border-radius: 50%;
  /* background-color only — the `background` shorthand would reset the
     base rule's background-size:cover / position:center and the photo
     would render at natural size from the top-left (cropped). */
  background-color: rgba(255, 255, 255, 0.15); border: 2px dashed rgba(255, 255, 255, 0.65);
}
.resume-doc.tpl-banner .doc-section-title { color: var(--user); border-bottom-color: var(--user); }

/* portrait — bold header with a rounded-square photo on the right. */
.resume-doc.tpl-portrait { font-family: "Helvetica Neue", Arial, sans-serif; }
.resume-doc.tpl-portrait .doc-header {
  display: flex; flex-direction: row-reverse; align-items: center;
  justify-content: space-between; gap: 24px; text-align: left;
  border-bottom: 3px solid var(--user);
}
.resume-doc.tpl-portrait .doc-headtext { flex: 1; }
.resume-doc.tpl-portrait .doc-name { color: var(--user); font-size: 33px; }
.resume-doc.tpl-portrait .doc-title { font-style: normal; font-weight: 600; color: #333; }
.resume-doc.tpl-portrait .doc-section-title { color: var(--user); border-bottom-color: var(--user); }
.resume-doc.tpl-portrait .doc-photo {
  display: flex; width: 104px; height: 104px; border-radius: 14px;
  /* background-color only (see banner note) so the photo fills via cover. */
  background-color: #eef2f9; border: 2px dashed #9bb2d6;
}

/* ---- style picker popover ---- */
.resume-doc-style-wrap, .resume-doc-export-wrap { position: relative; }
.resume-doc-style-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.resume-doc-style-btn:hover { border-color: var(--user); color: var(--user); }
.resume-doc-style-btn .style-swatch {
  width: 13px; height: 13px; border-radius: 3px; display: inline-block;
  background: #444; border: 1px solid rgba(0, 0, 0, 0.2);
}
.style-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: 320px; max-height: 70vh; display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28); overflow: hidden;
}
.style-panel[hidden] { display: none; }
.style-panel .sp-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.style-panel .sp-head strong { display: block; font-size: 13.5px; color: var(--ink); }
.style-panel .sp-head small { font-size: 11.5px; color: var(--ink-mute); }
.style-panel .sp-list {
  flex: 1; min-height: 0; overflow: auto;
  padding: 12px 12px 28px; display: flex; flex-direction: column; gap: 12px;
}
.style-panel .styleopt {
  position: relative; display: flex; flex-direction: column; gap: 9px;
  background: var(--paper-2); border: 2px solid var(--line); border-radius: 12px;
  padding: 11px; cursor: pointer; text-align: left; color: var(--ink); font: inherit;
}
.style-panel .styleopt:hover { border-color: var(--line-strong); }
.style-panel .styleopt.active { border-color: var(--user); }
.style-panel .so-meta b { font-size: 13px; }
.style-panel .so-meta > span { display: block; color: var(--ink-mute); font-size: 11.5px; margin-top: 1px; }
.style-panel .so-check {
  position: absolute; top: 9px; right: 9px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--user); color: #fff; font-size: 12px;
  display: none; align-items: center; justify-content: center;
}
.style-panel .styleopt.active .so-check { display: flex; }
.style-panel .photo-tag {
  display: inline-block; font-size: 8.5px; font-weight: 700; color: var(--user);
  background: var(--user-soft); border-radius: 999px; padding: 1px 6px; margin-left: 5px; vertical-align: middle;
}
.style-panel .sp-scrollhint {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 14px 0 10px; pointer-events: none;
  background: linear-gradient(transparent, var(--paper) 65%);
}
.style-panel .sp-scrollhint.hidden { display: none; }
.style-panel .sp-scrollhint button {
  pointer-events: auto; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-mute);
  font-size: 11.5px; font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.style-panel .sp-scrollhint button:hover { border-color: var(--user); color: var(--user); }

/* mini preview thumbnails — fixed white "paper", theme-independent. */
.style-panel .thumb {
  height: 208px; background: #fff; border-radius: 7px; padding: 13px 15px; overflow: hidden;
  color: #222; font-family: Arial, Helvetica, sans-serif; display: flex; flex-direction: column; gap: 2px;
}
.style-panel .thumb .thead { display: flex; flex-direction: column; gap: 1px; }
.style-panel .tname, .style-panel .ttitle, .style-panel .tcontact,
.style-panel .th, .style-panel .tline { display: block; }
.style-panel .tname {
  font-size: 13px; font-weight: 800; line-height: 1.05; color: #3b82f6;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.style-panel .ttitle {
  font-size: 7.5px; font-weight: 700; color: #333;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.style-panel .tcontact { font-size: 5.5px; color: #888; margin-top: 1px; }
.style-panel .trule { height: 2px; background: #3b82f6; margin: 3px 0; border-radius: 1px; }
.style-panel .th { font-size: 6.5px; font-weight: 800; letter-spacing: 0.4px; color: #3b82f6; margin: 4px 0 2px; }
.style-panel .tline { font-size: 6px; color: #555; line-height: 1.5; margin-bottom: 1px; }
.style-panel .tline.bul { padding-left: 6px; position: relative; }
.style-panel .tline.bul::before { content: "•"; position: absolute; left: 0; color: #999; }
.style-panel .thumb.classic { font-family: Georgia, "Times New Roman", serif; }
.style-panel .thumb.classic .thead { align-items: center; text-align: center; }
.style-panel .thumb.classic .tname { color: #1a1a1a; }
.style-panel .thumb.classic .trule { background: #999; height: 1px; }
.style-panel .thumb.classic .th { color: #1a1a1a; border-bottom: 1px solid #aaa; padding-bottom: 1px; }
.style-panel .tbody.cols { display: flex; gap: 8px; }
.style-panel .tbody.cols .cmain { flex: 1.5; }
.style-panel .tbody.cols .cside { flex: 1; background: #eef2f9; border-radius: 3px; padding: 5px 6px; }
.style-panel .tphoto { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.style-panel .tphoto::before { content: "📷"; font-size: 12px; opacity: 0.75; }
.style-panel .thumb.tbanner .tbanner-head {
  display: flex; align-items: center; gap: 9px; margin: -13px -15px 7px; padding: 12px 14px;
  background: linear-gradient(135deg, #3b82f6, #1e3a8a); color: #fff;
}
.style-panel .thumb.tbanner .tbanner-head .tphoto {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16); border: 1.5px dashed rgba(255, 255, 255, 0.6);
}
.style-panel .thumb.tbanner .tname { color: #fff; }
.style-panel .thumb.tbanner .ttitle { color: #dbeafe; }
.style-panel .thumb.tportrait .tport-head {
  display: flex; justify-content: space-between; align-items: center; gap: 9px;
  border-bottom: 2px solid #3b82f6; padding-bottom: 7px; margin-bottom: 4px;
}
.style-panel .thumb.tportrait .tport-head .tphoto {
  width: 36px; height: 36px; border-radius: 8px; background: #eef2f9; border: 1.5px dashed #9bb2d6;
}
.style-panel .thumb.tportrait .tname { color: #1a1a1a; }

/* ---- export dropdown ---- */
.export-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 232px; padding: 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}
.export-menu[hidden] { display: none; }
.export-menu button {
  display: flex; align-items: center; gap: 11px; width: 100%; background: none; border: none;
  color: var(--ink); font-size: 13px; font-weight: 600; padding: 9px 10px; border-radius: 8px;
  cursor: pointer; text-align: left;
}
.export-menu button:hover { background: var(--paper-3); }
.export-menu .mi-ic { font-size: 17px; width: 20px; text-align: center; }
.export-menu .mi-txt { display: flex; flex-direction: column; gap: 1px; }
.export-menu .mi-sub { font-size: 11px; color: var(--ink-mute); font-weight: 400; }

/* ===== Phase 2: two-pane agentic editing ===== */

/* The résumé page fills the viewport below the banner+header as a flex column:
   toolbar on top, then the document + agent panel side-by-side. */
body.resume-doc-mode .resume-doc-page {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--banner-h) - var(--header-h)); overflow: hidden;
}
.resume-doc-toolbar { max-width: none; margin: 0; flex: 0 0 auto; flex-wrap: wrap; }
.resume-doc-work { flex: 1; display: flex; min-height: 0; }
.resume-doc-stage { flex: 1; overflow: auto; min-width: 0; }
.resume-agent-panel {
  /* Fixed, stable width. min-width:0 stops long Recent-card titles from
     forcing the flex item wider than its basis (which made the panel jump
     between ~340px and ~500px depending on content). */
  flex: 0 0 420px; min-width: 0;
  border-left: 1px solid var(--line); background: var(--paper-2);
  display: flex; flex-direction: column; min-height: 0;
}
.resume-agent-panel .agent-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.resume-agent-panel .agent-av {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--user), #7c5cff);
}
.resume-agent-panel .agent-head h3 { margin: 0; font-size: 14px; }
.resume-agent-panel .agent-head small { color: var(--ink-mute); font-size: 11.5px; }
.resume-agent-panel .agent-body { flex: 1; overflow: auto; padding: 12px 14px; }
.resume-agent-panel .grouplabel {
  font-size: 10.5px; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 700; margin: 10px 2px 7px;
}
.agent-suggest-placeholder { font-size: 12px; color: var(--ink-mute); padding: 2px 2px 4px; }
.agent-thinking-block { margin: 4px 0 8px; }
.agent-thinking-block .checklist-head {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  color: var(--ink-soft); margin-bottom: 6px;
}
.agent-recent { display: flex; flex-direction: column; gap: 8px; }
.act {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; font-size: 12.5px;
}
.act-top { display: flex; align-items: center; gap: 7px; }
.act-ic { color: var(--ok, #22c55e); }
.act.working .act-ic { color: var(--user); }
.act-title { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-undo {
  margin-left: auto; background: none; border: none; color: var(--user);
  font-size: 11.5px; font-weight: 600; cursor: pointer; flex: 0 0 auto;
}
.act-sub { color: var(--ink-mute); font-size: 11.5px; margin-top: 3px; }
/* The agent's chat reply — more readable than a muted caption. */
.act-reply { color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
/* Command bar. (Override the global `body.resume-doc-mode .composer{display:none}`
   that hides the chat composer — this one lives inside the agent panel.) */
.resume-agent-panel .composer {
  display: block !important; flex: 0 0 auto;
  border-top: 1px solid var(--line); padding: 12px 14px; background: var(--paper-2);
}
.resume-agent-panel .focuschip {
  display: inline-block; font-size: 11px; color: var(--user); background: var(--user-soft);
  border-radius: 999px; padding: 3px 9px; margin-bottom: 8px;
}
.resume-agent-panel .focuschip[hidden] { display: none; }
.resume-agent-panel .cbox {
  display: flex; gap: 8px; align-items: flex-end; background: var(--paper);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 12px;
}
.resume-agent-panel .cbox:focus-within { border-color: var(--user); }
.resume-agent-panel .cbox textarea {
  flex: 1; background: none; border: none; color: var(--ink); font: inherit;
  font-size: 13px; resize: none; outline: none; overflow-y: auto;
  min-height: 20px; max-height: 140px; /* auto-grown by JS up to this cap */
}
.resume-agent-panel .send {
  background: var(--user); border: none; color: #fff; border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; font-size: 14px; flex: 0 0 auto;
}
.resume-agent-panel .qa { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.resume-agent-panel .qa button {
  font-size: 11px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-soft); border-radius: 999px; padding: 3px 9px; cursor: pointer;
}
.resume-agent-panel .qa button:hover { border-color: var(--user); color: var(--user); }

/* Auto-save pill in the toolbar. */
.savestatus {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--ink-mute); background: var(--paper-2); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 999px;
}
.savestatus[hidden] { display: none; }
.savestatus .spin {
  width: 11px; height: 11px; border-radius: 50%; display: none;
  border: 2px solid var(--ink-mute); border-top-color: transparent;
  animation: savestatus-rot 0.7s linear infinite;
}
.savestatus .ck { color: var(--ok, #22c55e); display: none; }
.savestatus.saving { color: var(--ink-soft); }
.savestatus.saving .spin { display: inline-block; }
.savestatus.saved { color: var(--ok, #22c55e); }
.savestatus.saved .ck { display: inline-block; }
@keyframes savestatus-rot { to { transform: rotate(360deg); } }

/* Inline-editable affordances (always-on). */
.resume-doc [contenteditable="true"] { outline: none; border-radius: 3px; }
.resume-doc [contenteditable="true"]:hover { box-shadow: inset 0 0 0 1px #c9d6f0; }
.resume-doc [contenteditable="true"]:focus { box-shadow: inset 0 0 0 2px var(--user); background: #fbfcff; }
/* Empty title/name placeholders. */
.resume-doc .doc-title:empty::before,
.resume-doc .doc-title-text:empty::before { content: "Add a title"; color: #aaa; }
/* Two-column owns contacts in the header (hidden) so edits still round-trip. */
.resume-doc.tpl-two-column .doc-headtext .doc-contact { display: none; }
/* Click-to-focus highlight. */
.resume-doc .doc-section.focused,
.resume-doc .doc-header.focused {
  box-shadow: 0 0 0 2px var(--user-soft); border-radius: 8px;
}
.doc-section-busy { opacity: 0.5; }

/* Floating format toolbar. */
.fmtbar {
  position: fixed; z-index: 80; display: flex; gap: 1px; padding: 4px;
  background: #0b0d12; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.fmtbar[hidden] { display: none; }
.fmtbar button {
  background: none; border: none; color: #e7eaf0; min-width: 30px; height: 28px;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.fmtbar button:hover { background: #1f232c; }
.fmtbar button.active { background: var(--user); color: #fff; }

@media print {
  .resume-doc-edit-btn, .resume-doc-templates,
  .doc-section-edit, .doc-edited-tag,
  .doc-photo-remove,
  .resume-agent-panel, .fmtbar, .savestatus { display: none !important; }
  /* Strip editing chrome from the printed paper. */
  .resume-doc [contenteditable="true"] { box-shadow: none !important; background: none !important; }
  .resume-doc .doc-section.focused, .resume-doc .doc-header.focused { box-shadow: none !important; }
  body.resume-doc-mode .resume-doc-page { display: block; height: auto; overflow: visible; }
  .resume-doc-work { display: block; }
  .resume-doc-stage { overflow: visible; }
  /* Don't print an empty photo placeholder. */
  .resume-doc .doc-photo:not(.has-photo) { display: none !important; }
  /* The paper's padding is reset to 0 in print, so re-anchor the banner band. */
  .resume-doc.tpl-banner .doc-header { margin: 0 0 22px; border-radius: 0; }
}

/* Polished structured entries (when the agent emits role/dates blocks). */
.resume-doc .doc-entry { margin-bottom: 10px; }
.resume-doc .doc-entry-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.resume-doc .doc-entry-role { font-weight: 700; }
.resume-doc .doc-entry-dates {
  font-size: 12px; color: #555; white-space: nowrap;
  font-family: -apple-system, system-ui, sans-serif;
}
.resume-doc .doc-entry-loc { font-size: 12.5px; color: #555; font-style: italic; }
.resume-doc .doc-entry .doc-list { margin-top: 3px; }

.resume-doc-stage { padding: 20px 24px 80px; }
.resume-doc-empty { background: var(--paper-2); border-radius: var(--radius-lg); margin: 0 auto; max-width: 800px; }

/* The "paper" — deliberately light/serif and theme-independent so it reads
   like a printed résumé regardless of the sandbox's dark UI. */
.resume-doc {
  max-width: 800px; margin: 0 auto;
  background: #ffffff; color: #1a1a1a;
  border-radius: 8px; padding: 48px 56px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}
.resume-doc .doc-header {
  text-align: center;
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 14px; margin-bottom: 20px;
}
.resume-doc .doc-name {
  margin: 0; font-size: 30px; font-weight: 700; letter-spacing: 0.5px;
}
.resume-doc .doc-title { margin-top: 4px; font-size: 15px; font-style: italic; color: #444; }
.resume-doc .doc-contact {
  margin-top: 8px; font-size: 12.5px; color: #333;
  font-family: -apple-system, system-ui, sans-serif;
}
.resume-doc .doc-license {
  margin-top: 2px; font-size: 11.5px; color: #666;
  font-family: -apple-system, system-ui, sans-serif;
}
.resume-doc .doc-section { margin-top: 18px; }
.resume-doc .doc-section-title {
  margin: 0 0 8px; font-size: 13.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: #1a1a1a;
  border-bottom: 1px solid #bbb; padding-bottom: 3px;
}
.resume-doc .doc-summary { margin: 0; font-size: 14px; }
.resume-doc .doc-list { margin: 0; padding-left: 20px; }
.resume-doc .doc-list li { margin-bottom: 5px; font-size: 13.5px; }
.resume-doc p { font-size: 13.5px; margin: 0; }

/* Print: show only the paper, full-bleed. */
@media print {
  body * { visibility: hidden; }
  #resume-doc-page, #resume-doc-page * { visibility: visible; }
  .resume-doc-toolbar { display: none !important; }
  #resume-doc-page { position: absolute; inset: 0; }
  .resume-doc-stage { padding: 0; }
  .resume-doc { box-shadow: none; max-width: none; margin: 0; border-radius: 0; padding: 0; }
}

.resume-sections { display: flex; flex-direction: column; gap: 22px; }

/* Tier groups. */
.resume-tier-group { display: flex; flex-direction: column; gap: 8px; }
.resume-tier-head { display: flex; align-items: baseline; gap: 8px; }
.resume-tier-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink);
}
.resume-tier-count {
  font-size: 11px; font-weight: 700; color: var(--ink-mute);
  background: var(--paper-3); border-radius: 999px; padding: 1px 8px;
}
.resume-tier-help { margin: 0 0 4px; font-size: var(--fs-sm); color: var(--ink-mute); }
.resume-tier--essential .resume-tier-title { color: var(--user); }

.resume-section {
  display: flex; gap: 14px;
  background: var(--paper); border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.resume-section--primary { border-left-color: var(--user, var(--line-strong)); }
.resume-order {
  flex-shrink: 0; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--paper-3);
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
}
.resume-section-main { flex: 1; min-width: 0; }
.resume-section-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.resume-section-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.resume-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  border-radius: 999px; padding: 2px 8px;
  color: var(--user, var(--ink-soft)); border: 1px solid var(--user, var(--line));
}
.resume-emphasis { font-size: 11px; color: var(--ink-mute); }
.resume-gather { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.5; }

/* Per-section gathering status — placeholder now, grows with the builder. */
.resume-status {
  flex-shrink: 0; align-self: flex-start;
  font-size: 11px; font-weight: 600; color: var(--ink-mute);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
  white-space: nowrap;
}
.resume-status--none { color: var(--ink-mute); }
.resume-status--gathering { color: var(--warn); border-color: var(--warn); }
.resume-status--complete { color: var(--ok); border-color: var(--ok); }

/* Reference questions — the planned interview, distinct from live chat. */
.resume-questions { margin: 8px 0 0; }
.resume-questions-head {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-mute);
}
.resume-questions ul {
  margin: 4px 0 0; padding-left: 18px;
  list-style: disc; color: var(--ink-soft);
}
.resume-questions li { font-size: var(--fs-sm); font-style: italic; line-height: 1.5; }

/* Gathered content captured for a section. */
.resume-content {
  margin: 8px 0 0; padding: 8px 10px;
  background: var(--paper-2); border-left: 2px solid var(--ok);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm); color: var(--ink); line-height: 1.5;
  white-space: pre-wrap;
}
.resume-content--empty {
  color: var(--ink-mute); font-style: italic;
  border-left-color: var(--line);
}

/* Generated section — source tag, editable content, action buttons. */
.resume-source {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px;
}
.resume-source--generated {
  color: var(--user); border: 1px solid var(--user);
  background: transparent;
}
.resume-generated { margin-top: 8px; }
.resume-generated-actions {
  display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.resume-action-btn {
  font-size: var(--fs-sm); padding: 6px 12px;
  background: var(--paper-2); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; line-height: 1; font-family: inherit;
}
.resume-action-btn:hover { background: var(--paper-3, var(--paper-2)); color: var(--ink); }
.resume-action-btn:disabled { opacity: 0.6; cursor: default; }
.resume-action-btn--primary {
  background: var(--user); color: #fff; border-color: var(--user);
}
.resume-action-btn--primary:hover { color: #fff; opacity: 0.9; }

.resume-content-editor {
  margin: 8px 0 0; padding: 8px 10px;
  width: 100%; box-sizing: border-box;
  background: var(--paper-2); border: 1px solid var(--line);
  border-left: 2px solid var(--user);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm); color: var(--ink); line-height: 1.5;
  font-family: inherit; resize: vertical; min-height: 80px;
}
.resume-content-editor:focus {
  outline: none; border-color: var(--user); border-left-color: var(--user);
}

.settings-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.settings-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--paper-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.settings-back-btn:hover {
  background: var(--paper-3);
  color: var(--ink);
  border-color: var(--line-strong);
}

.settings-page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
}

/* "Saved ✓" indicator — appears briefly after each auto-save. */
.settings-saved-indicator {
  font-size: var(--fs-sm);
  color: var(--ok);
  font-weight: 600;
  animation: saved-fade 1.6s ease-out forwards;
}
.settings-saved-indicator[hidden] { display: none; }
@keyframes saved-fade {
  0%   { opacity: 0; transform: translateY(-2px); }
  20%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

.settings-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.settings-section-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.settings-section-help {
  margin: 0 0 16px;
  font-size: var(--fs-sm);
  color: var(--ink-mute);
  line-height: 1.5;
}

.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--paper-2);
  transition: background 120ms ease, border-color 120ms ease;
}
.radio-row:hover { background: var(--paper-3); }
.radio-row input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--user);
  flex-shrink: 0;
}
.radio-row:has(input[type="radio"]:checked) {
  background: var(--user-soft);
  border-color: var(--user);
}
.radio-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.radio-title {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.radio-default-pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  padding: 2px 7px;
  border-radius: 999px;
}
.radio-help {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  line-height: 1.4;
}
.specific-lang-select {
  margin-top: 6px;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, opacity 120ms ease;
}
.specific-lang-select:disabled { opacity: 0.5; cursor: not-allowed; }
.specific-lang-select:focus {
  outline: none;
  border-color: var(--user);
  box-shadow: 0 0 0 3px var(--user-soft);
}

/* ------------------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
  overflow: hidden;
}

/* ---- sidebar ---- */

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.sidebar-title {
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}
.sidebar-count {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  background: var(--paper-3);
  padding: 3px 8px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-weight: 600;
}

.sidebar-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* "+ new thread" button — small, prominent enough to find, never in the way. */
.new-thread-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--user);
  color: #ffffff;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2px;  /* optical centering of the "+" */
  transition: filter 120ms ease, transform 80ms ease;
}
.new-thread-btn:hover { filter: brightness(1.08); }
.new-thread-btn:active { transform: scale(0.94); }

.user-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.user-row {
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-row:hover { background: var(--paper-3); }
.user-row[aria-selected="true"] {
  background: var(--paper);
  border-left-color: var(--user);
}

.user-row-id {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: var(--fs-sm);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-row-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--ink-mute);
}
.user-row-count {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

.user-list-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--ink-mute);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* ---- thread ---- */

.thread-wrap {
  position: relative;
  overflow-y: auto;
  padding: 24px 20px 32px;
  background: var(--paper);
}

.thread {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;   /* tight default; same-sender runs feel grouped */
}

/* Extra breathing room when the sender changes ("turn-taking" feel). */
.bubble--user + .bubble--agent,
.bubble--agent + .bubble--user {
  margin-top: 12px;
}

.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.5;
  font-size: var(--fs-base);
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  animation: bubble-in 180ms ease-out both;
  box-shadow: var(--shadow-soft);
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.bubble--user {
  align-self: flex-end;
  background: var(--user);
  color: #ffffff;
  border-bottom-right-radius: 6px;
}
.bubble--agent {
  align-self: flex-start;
  background: var(--agent-bg);
  color: var(--ink);
  border: 1px solid var(--agent-bd);
  border-bottom-left-radius: 6px;
}

.bubble-meta {
  display: none;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: var(--fs-xs);
  line-height: 1.5;
  display: none;
}
.bubble--user .bubble-meta  { color: rgba(255,255,255,0.95); }
.bubble--agent .bubble-meta { color: var(--ink-soft); }

body.dev-on .bubble-meta { display: block; }

.bubble-meta .pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  margin-bottom: 4px;
  font-weight: 600;
}
.bubble--user .bubble-meta .pill {
  background: rgba(255,255,255,0.22);
  color: #ffffff;
}
/* Pill background uses var(--paper) so it flips with the theme:
   - light mode: white pill on light-grey agent bubble (dark text)
   - dark mode:  near-black pill on dark agent bubble (light text)
   This is what fixes the "invisible pills on agent bubbles" bug. */
.bubble--agent .bubble-meta .pill {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--agent-bd);
}

.status-not_applicable { /* default look */ }
.status-pending  { color: #ffffff !important; background: var(--warn) !important; border-color: var(--warn) !important; }
.status-done     { color: #ffffff !important; background: var(--ok) !important; border-color: var(--ok) !important; }
.status-failed   { color: #ffffff !important; background: var(--danger) !important; border-color: var(--danger) !important; }

.empty-state, .loading-state {
  text-align: center;
  color: var(--ink-mute);
  margin-top: 56px;
  padding: 24px;
}
.empty-illustration {
  font-size: 40px;
  margin-bottom: 8px;
}
.empty-state h2 {
  margin: 0 0 6px;
  font-size: 18px;
  color: var(--ink);
  font-weight: 600;
}
.empty-state p {
  margin: 0;
  font-size: var(--fs-sm);
}
.loading-state {
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------ composer */

.composer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  padding: 14px 20px 18px;
}

.composer-state {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.composer-state[hidden] { display: none; }

.composer-input {
  flex: 1;
  resize: none;
  min-height: 48px;
  max-height: 180px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  font-size: var(--fs-base);
  color: var(--ink);
}
.composer-input::placeholder { color: var(--ink-mute); }
.composer-input:focus {
  border-color: var(--user);
  box-shadow: 0 0 0 3px var(--user-soft);
}

.composer-actions {
  display: flex;
  gap: 8px;
}

.send-btn {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.send-btn:not(:disabled):active { transform: translateY(1px); }

.send-btn--user {
  background: var(--user);
  color: #ffffff;
}
.send-btn--user:hover:not(:disabled) { filter: brightness(1.08); }

/* Use paper-3 (a step contrast vs the composer surface, paper-2) so the
   button stands out instead of merging into the composer in both themes. */
.send-btn--agent {
  background: var(--paper-3);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.send-btn--agent:hover:not(:disabled) {
  background: var(--line);
  border-color: var(--ink-mute);
}

/* Cancel-recording button — quietly destructive look. */
.send-btn--cancel {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
}
.send-btn--cancel:hover:not(:disabled) {
  background: var(--paper-3);
  color: var(--danger);
  border-color: var(--danger);
}

/* ------------------------------------------------------------ mic & recording */

.mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--paper-3);
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.mic-btn:hover:not(:disabled) {
  background: var(--user);
  color: #ffffff;
  border-color: var(--user);
}
.mic-btn:active:not(:disabled) { transform: scale(0.94); }
.mic-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Recording indicator: pulsing red dot + label + timer */
.recording-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  min-height: 48px;
  font-size: var(--fs-base);
}
.recording-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 25%, transparent);
  animation: rec-pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}
.recording-label {
  color: var(--danger);
  font-weight: 600;
}
.recording-timer {
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  color: var(--ink);
  font-size: var(--fs-base);
  font-weight: 600;
}

/* ------------------------------------------------------------ audio bubble */

/* Tighter than the default bubble — the audio control has its own visual
   weight and doesn't need extra padding around it. */
.bubble.bubble--audio {
  padding: 6px 8px 8px;
  max-width: 280px;
}
.bubble--audio.bubble--user audio { color-scheme: dark; }
.bubble--audio audio {
  display: block;
  width: 100%;
  height: 34px;
}

/* Status line under the audio control — subtle, single row, never shouty. */
.bubble--audio .audio-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding: 0 4px;
  font-size: var(--fs-xs);
  line-height: 1.4;
}
.bubble--audio.bubble--user .audio-meta { color: rgba(255,255,255,0.85); }
.bubble--audio.bubble--agent .audio-meta { color: var(--ink-mute); }

.audio-time {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  opacity: 0.7;
}

/* Transcription state indicator — minimal, inherits text color from
   .audio-meta so it never clashes with the bubble background. */
.transcription-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Three-dot typing animation. Each dot pulses on a stagger; the row
   reads as "something is happening" at a glance, but doesn't draw the
   eye away from the audio itself. */
.transcription-indicator .dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.transcription-indicator .dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: dot-pulse 1.4s ease-in-out infinite;
}
.transcription-indicator .dots span:nth-child(2) { animation-delay: 0.18s; }
.transcription-indicator .dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dot-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  35%      { opacity: 1;    transform: scale(1.15); }
}

/* Done state: small green check (no animation), just a confirmation. */
.transcription-indicator--done {
  color: var(--ok);
}
.bubble--audio.bubble--user .transcription-indicator--done {
  /* On the blue bubble, the saturated ok-green clashes — use white with
     a tiny check icon instead. */
  color: rgba(255,255,255,0.9);
}

/* Failed state: subtle warning, not a panic. */
.transcription-indicator--failed {
  color: var(--danger);
  font-weight: 600;
}
.bubble--audio.bubble--user .transcription-indicator--failed {
  color: #fecaca; /* readable red on the blue bubble */
}

/* Transcript itself — italic, under the audio control. Phase D fills
   this in once the transcript lands. */
.audio-transcript-preview {
  margin-top: 6px;
  padding: 0 4px;
  font-size: var(--fs-sm);
  font-style: italic;
  line-height: 1.45;
}
.bubble--audio.bubble--user .audio-transcript-preview { color: rgba(255,255,255,0.95); }
.bubble--audio.bubble--agent .audio-transcript-preview { color: var(--ink-soft); }

/* ------------------------------------------------------------ entity confirmation card */

/* Inline card under a user message when we've extracted high-stakes
   entities and the user hasn't confirmed yet. Designed to read as a
   soft form, not a chat bubble — so the user understands they need
   to act on it. */
.entity-card {
  align-self: stretch;
  max-width: 520px;
  margin: 4px auto 8px;
  padding: 14px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  animation: bubble-in 180ms ease-out both;
}
.entity-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-soft);
}
.entity-card-header::before {
  /* small bullet dot to flag attention without being shouty */
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--user);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--user) 25%, transparent);
}

.entity-card-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 8px;
  margin-bottom: 12px;
}
.entity-field-label {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  align-self: center;
  white-space: nowrap;
}
.entity-field-input {
  font-size: var(--fs-base);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.entity-field-input:focus {
  border-color: var(--user);
  box-shadow: 0 0 0 3px var(--user-soft);
}

.entity-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.entity-card-actions .send-btn {
  /* reuse the send-btn styles defined elsewhere */
  padding: 8px 14px;
  font-size: var(--fs-sm);
}

/* Confirmed (collapsed) state — single grey line replacing the form. */
.entity-card--confirmed {
  padding: 8px 14px;
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
  box-shadow: none;
  font-size: var(--fs-sm);
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 8px;
}
.entity-card--confirmed::before {
  content: "✓";
  color: var(--ok);
  font-weight: 700;
}

/* While Aspire blocks on pending entities, show a quieter hint instead
   of the "Aspire is thinking" pulse. */
.entity-pending-hint {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 4px 0;
  font-size: var(--fs-sm);
  color: var(--ink-mute);
  font-style: italic;
}
.entity-pending-hint[hidden] { display: none; }

/* "Aspire is thinking..." indicator — lives just under the thread,
   styled as a soft agent bubble so it reads as the next reply landing. */
.agent-thinking {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  padding-top: 4px;
}
/* Display: flex above has the same specificity as the user-agent's
   [hidden]{display:none} rule, so we have to explicitly re-hide when
   the attribute is set. Same trick as .composer-state. */
.agent-thinking[hidden] { display: none; }
.bubble--thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-style: italic;
  animation: bubble-in 180ms ease-out both;
}
.bubble--thinking .dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bubble--thinking .dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: dot-pulse 1.3s ease-in-out infinite;
}
.bubble--thinking .dots span:nth-child(2) { animation-delay: 0.18s; }
.bubble--thinking .dots span:nth-child(3) { animation-delay: 0.36s; }

/* Inline step checklist — the live backend steps of the current turn,
   shown in place of the single-line "Aspire is thinking…" pulse. */
.bubble--thinking.agent-checklist {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  font-style: normal;
}
.agent-checklist .checklist-head {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-style: italic;
}
.checklist-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checklist-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--ink-mute);
}
.checklist-step .step-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
}
/* pending → hollow circle */
.step--pending .step-icon::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--ink-mute);
  border-radius: 50%;
  opacity: 0.5;
}
/* active → spinning ring */
.step--active .step-icon::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 1.5px solid color-mix(in srgb, var(--user) 30%, transparent);
  border-top-color: var(--user);
  border-radius: 50%;
  animation: checklist-spin 0.7s linear infinite;
}
@keyframes checklist-spin { to { transform: rotate(360deg); } }
/* done → green check */
.step--done .step-icon { color: var(--ok); font-weight: 700; }

.checklist-step .step-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.checklist-step .step-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.step--active .step-label { color: var(--ink); font-weight: 600; }
.step--done .step-label { color: var(--ink-soft); }
.checklist-step .step-dur {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}
/* Technical detail (call_type · model) — only under the Dev view toggle. */
.step-tech {
  display: none;
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  opacity: 0.85;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
body.dev-on .step-tech { display: block; }

/* Lifecycle action buttons on audio bubbles — pending shows
   "Mark done" / "Mark failed", failed shows "Retry". Subtle outline
   style so they don't compete with the audio control itself. */
.audio-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding: 0 4px;
  flex-wrap: wrap;
}
.audio-action-btn {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, opacity 120ms ease;
}
.audio-action-btn:hover:not(:disabled) {
  background: currentColor;
}
.bubble--audio.bubble--user .audio-action-btn {
  color: rgba(255,255,255,0.85);
}
.bubble--audio.bubble--user .audio-action-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.95);
  color: var(--user);   /* invert on the blue bubble */
}
.bubble--audio.bubble--agent .audio-action-btn {
  color: var(--ink-soft);
}
.bubble--audio.bubble--agent .audio-action-btn:hover:not(:disabled) {
  background: var(--ink-soft);
  color: var(--paper);
}
.audio-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.audio-action-btn--danger {
  /* "Mark failed" tinted slightly — still subtle, hints at destruction */
  border-color: var(--danger);
  color: var(--danger);
}
.bubble--audio.bubble--user .audio-action-btn--danger { color: #fecaca; border-color: #fecaca; }
.audio-action-btn--danger:hover:not(:disabled) {
  background: var(--danger);
  color: #ffffff;
}

/* "Transcribe now" — the real-Sarvam button. Filled to differentiate
   from the outlined simulate buttons; this is the primary action when
   real transcription is configured. */
.audio-action-btn--primary {
  background: var(--ok);
  color: #ffffff;
  border-color: var(--ok);
}
.bubble--audio.bubble--user .audio-action-btn--primary {
  background: #ffffff;
  color: var(--user);
  border-color: #ffffff;
}
.audio-action-btn--primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

/* ------------------------------------------------------------ toast */

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  z-index: 50;
}
.toast.toast--error { background: var(--danger); color: #ffffff; }

/* ------------------------------------------------------------ mobile */

@media (max-width: 760px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    padding: 12px 14px;
    gap: 10px;
  }
  .header-right { justify-content: space-between; }
  #user-id-input { width: 100%; }
  .user-picker { flex: 1; }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 38vh;
  }
  .user-list { max-height: 32vh; }

  .thread-wrap { padding: 16px 12px 24px; }
  .bubble { max-width: 88%; }

  .composer {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }
  .composer-actions { justify-content: space-between; }
  .send-btn { flex: 1; }
}

.pill--intent { color: var(--user, var(--ink)); border-color: var(--user, var(--line)); }
