:root {
  color-scheme: light;
  --white: #ffffff;
  --canvas: #f6f8fa;
  --surface: #f0f4f7;
  --ink: #10233d;
  --muted: #65748a;
  --faint: #8d99aa;
  --line: #dbe2e8;
  --line-strong: #c7d0da;
  --green: #079455;
  --green-dark: #067647;
  --green-soft: #e8f8f0;
  --coral: #f04438;
  --coral-soft: #fff0ee;
  --amber: #b76508;
  --amber-soft: #fff7e8;
  --blue-soft: #edf6ff;
  --danger: #c4322b;
  --shadow-dialog: 0 20px 50px rgba(16, 35, 61, 0.16);
  --radius: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(7, 148, 85, 0.22);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--white);
  border-inline: 1px solid var(--line);
}
.auth-locked .app-shell { filter: blur(6px); pointer-events: none; user-select: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand-cluster,
.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

.organization-name {
  overflow: hidden;
  max-width: 260px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deployment-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 7px; border-radius: 6px; background: var(--amber-soft); color: #8a4d08; font-size: 10px; font-weight: 750; white-space: nowrap; }
.deployment-badge.production { background: var(--green-soft); color: var(--green-dark); }

.user-control { display: inline-flex; align-items: center; gap: 8px; padding: 5px 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 680; white-space: nowrap; }
.user-control .icon { width: 17px; height: 17px; color: var(--muted); }
.help-control { width: 36px; height: 36px; color: var(--muted); }
.help-control:hover { border-color: var(--line-strong); color: var(--green-dark); }

.workspace-nav {
  position: sticky;
  top: 66px;
  z-index: 15;
  display: flex;
  min-height: 48px;
  align-items: stretch;
  gap: 28px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.workspace-nav button {
  position: relative;
  min-width: 72px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 680;
}

.workspace-nav button.active { color: var(--green-dark); }
.workspace-nav button.active::after { content: ""; position: absolute; right: 4px; bottom: 0; left: 4px; height: 3px; background: var(--green); }
.focus-mode .workspace-nav { display: none; }

.mobile-nav { display: none; }
.focus-mode .mobile-nav { display: none !important; }

.brand-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 21px;
  font-weight: 760;
}

.status-control {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--coral); }

.page {
  display: none;
  min-height: calc(100vh - 66px);
  padding: 28px 28px calc(36px + var(--safe-bottom));
}

.page.active { display: block; }
.page:not(.workspace-page) { width: min(100%, 720px); margin-inline: auto; }
#page-elders { width: min(100%, 920px); }

.page-heading-row,
.section-heading,
.field-heading,
.dialog-header,
.subpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p { margin: 0; }

.page-heading-row h1 {
  font-size: 30px;
  line-height: 1.2;
  font-weight: 780;
}

.page-count {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.btn {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 720;
  transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn-primary { border-color: var(--green); background: var(--green); color: var(--white); }
.btn-primary:hover { border-color: var(--green-dark); background: var(--green-dark); }
.btn-accent { border-color: #a9dfc5; background: var(--green-soft); color: var(--green-dark); }
.btn-accent:hover { border-color: var(--green); background: #dcf4e8; }
.btn-secondary { border-color: var(--line-strong); background: var(--white); color: var(--ink); }
.btn-secondary:hover { background: var(--surface); }
.btn-danger { border-color: #ffd2ce; background: var(--coral-soft); color: var(--danger); }
.btn-compact { min-height: 42px; padding: 9px 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
}

.search-field {
  display: flex;
  height: 48px;
  align-items: center;
  gap: 10px;
  margin: 22px 0 10px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--muted);
}

.search-field:focus-within { border-color: var(--green); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; }
.search-field input::placeholder { color: var(--faint); }

.archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.segmented-control {
  display: inline-flex;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented-control button {
  display: inline-flex;
  min-width: 92px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 4px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
}

.segmented-control button span {
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(101, 116, 138, 0.1);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.segmented-control button.active {
  background: var(--white);
  color: var(--green-dark);
  box-shadow: 0 1px 3px rgba(16, 35, 61, 0.1);
}

.segmented-control button.active span { background: var(--green-soft); color: var(--green-dark); }

.pending-upload-summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  padding: 9px 12px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #8a4d08;
  font-size: 13px;
  font-weight: 680;
}
.pending-upload-summary[hidden] { display: none; }
.pending-upload-summary .icon { flex: 0 0 auto; }
.pending-upload-summary > span { min-width: 0; flex: 1; }
.pending-summary-action { min-width: 44px; flex: 0 0 auto; padding: 5px 0; border: 0; background: transparent; color: #8a4d08; cursor: pointer; font-size: 13px; font-weight: 760; }

.archive-list { border-top: 1px solid var(--line); }

.elder-row {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 19px 0;
  border-bottom: 1px solid var(--line);
}

.elder-avatar,
.memoir-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}

.elder-avatar .icon,
.memoir-avatar .icon { width: 26px; height: 26px; }
.elder-copy { min-width: 0; }
.elder-name { overflow-wrap: anywhere; font-size: 18px; font-weight: 760; }
.elder-meta { margin-top: 3px; color: var(--muted); font-size: 14px; }
.elder-progress { margin-top: 8px; color: var(--amber); font-size: 13px; font-weight: 680; }
.elder-progress.empty { color: var(--muted); }

.consent-badge,
.task-status {
  display: inline-flex;
  width: fit-content;
  min-height: 26px;
  align-items: center;
  margin-top: 7px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
}

.consent-badge.active,
.task-status.active,
.task-status.completed,
.task-status.approved,
.task-status.passed { background: var(--green-soft); color: var(--green-dark); }
.consent-badge.withdrawn,
.task-status.rework { background: var(--coral-soft); color: var(--danger); }
.pending-upload-badge { display: inline-flex; width: fit-content; min-height: 26px; align-items: center; gap: 5px; margin-top: 7px; padding: 3px 8px; border-radius: 5px; background: var(--blue-soft); color: #19568c; font-size: 12px; font-weight: 700; }
.pending-upload-badge .icon { width: 14px; height: 14px; }
.task-status.review,
.task-status.in-progress { background: var(--blue-soft); color: #19568c; }
.task-status.rejected,
.task-status.cancelled { background: var(--coral-soft); color: var(--danger); }

.elder-row-actions {
  display: flex;
  width: 304px;
  grid-column: 3;
  gap: 8px;
  align-items: center;
}

.elder-row-actions .btn { flex: 1; min-height: 40px; padding: 8px 10px; }
.row-menu { position: relative; }
.row-menu summary { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; cursor: pointer; color: var(--muted); list-style: none; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu[open] summary { background: var(--surface); }
.row-menu-panel { position: absolute; right: 0; bottom: 44px; z-index: 5; width: 150px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow-dialog); }
.row-menu-panel button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; text-align: left; }
.row-menu-panel button:hover { background: var(--surface); }
.row-menu-panel .danger { color: var(--danger); }

.empty-state,
.error-state {
  padding: 56px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state h2,
.error-state h2 { margin-bottom: 8px; color: var(--ink); font-size: 18px; }
.empty-state .btn { margin-top: 16px; }
.error-state .btn { margin-top: 16px; }

.workspace-page { padding: 24px 28px calc(36px + var(--safe-bottom)); }
.workspace-heading { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 20px; }
.workspace-heading h1 { font-size: 28px; line-height: 1.2; }
.workspace-actions,
.project-title-group { display: flex; align-items: center; gap: 12px; }
.project-title-group select { min-width: 240px; height: 42px; padding: 0 36px 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--white); }

.metric-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 20px -28px 0;
  padding: 22px 28px;
  border-block: 1px solid var(--line);
}

.metric-item { display: flex; align-items: baseline; justify-content: center; gap: 8px; border-right: 1px solid var(--line); }
.metric-item:last-child { border-right: 0; }
.metric-value { color: var(--green); font-size: 30px; font-weight: 780; font-variant-numeric: tabular-nums; }
.metric-label { color: var(--muted); font-size: 13px; }

.agenda-surface { padding: 24px 0; border-bottom: 1px solid var(--line); }
.agenda-heading { align-items: flex-end; margin-bottom: 14px; }
.agenda-heading h2 { font-size: 18px; }
.agenda-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.agenda-summary { display: flex; align-items: center; gap: 8px; }
.agenda-count { display: inline-flex; min-height: 28px; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 12px; }
.agenda-count strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.agenda-count.today { border-color: #a9dfc2; background: var(--green-soft); color: var(--green-dark); }
.agenda-count.overdue { border-color: #ffd2ce; background: var(--coral-soft); color: var(--danger); }
.agenda-count.follow-up { border-color: #cfe5f8; background: var(--blue-soft); color: #19568c; }
.agenda-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.agenda-card { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-left: 3px solid var(--faint); border-radius: var(--radius); background: var(--white); }
.agenda-card.overdue { border-left-color: var(--coral); }
.agenda-card.today { border-left-color: var(--green); }
.agenda-card.follow_up { border-left-color: #397eb5; }
.agenda-card.upcoming { border-left-color: var(--amber); }
.agenda-card-head,
.agenda-card-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.agenda-card-head { margin-bottom: 11px; color: var(--muted); font-size: 11px; }
.agenda-label { color: var(--ink); font-weight: 740; }
.agenda-card h3 { overflow-wrap: anywhere; font-size: 15px; }
.agenda-card p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.agenda-card .btn { flex: 0 0 auto; min-height: 36px; }
.agenda-empty { grid-column: 1 / -1; padding: 24px; border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; }

.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; min-height: 480px; }
.task-surface { min-width: 0; padding: 24px 24px 0 0; }
.task-surface .section-heading { margin-bottom: 12px; }
.task-surface h2,
.attention-rail h2,
.quality-summary h2 { font-size: 18px; }
.task-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.task-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.task-table th { height: 44px; padding: 0 12px; background: var(--canvas); color: var(--muted); font-size: 12px; text-align: left; white-space: nowrap; }
.task-table td { min-height: 64px; padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.task-elder { font-weight: 720; }
.task-secondary { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.task-progress { width: 100px; }
.task-progress-bar { height: 5px; margin-top: 6px; overflow: hidden; border-radius: 4px; background: var(--line); }
.task-progress-bar span { display: block; height: 100%; background: var(--green); }
.table-actions { display: flex; gap: 4px; }
.table-actions .icon-btn { width: 34px; height: 34px; border-radius: 50%; color: var(--green-dark); }
.table-actions .icon { width: 17px; height: 17px; }

.attention-rail { padding: 24px 0 24px 24px; border-left: 1px solid var(--line); }
.attention-item { display: grid; width: 100%; grid-template-columns: 42px 1fr 18px; gap: 10px; align-items: center; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.attention-item:hover .attention-copy strong { color: var(--green-dark); }
.attention-item:focus-visible { outline: 3px solid rgba(7, 148, 85, 0.16); outline-offset: 2px; }
.attention-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: var(--radius); background: var(--amber-soft); color: var(--amber); }
.attention-icon.review { background: var(--blue-soft); color: #19568c; }
.attention-copy { min-width: 0; }
.attention-copy strong { display: block; font-size: 14px; }
.attention-copy > span { display: block; color: var(--muted); font-size: 12px; }
.quality-summary { margin-top: 24px; }
.quality-summary h2 { margin-bottom: 10px; }
.quality-row { display: flex; justify-content: space-between; padding: 8px 0; color: var(--muted); font-size: 13px; }
.quality-row strong { color: var(--ink); }
.rail-action { display: flex; width: 100%; min-height: 42px; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--green-dark); cursor: pointer; font-weight: 720; text-align: left; }
.rail-action .icon:last-child { margin-left: auto; }

.asr-quality-surface { padding: 26px 0 8px; border-top: 1px solid var(--line); }
.asr-quality-heading { align-items: flex-end; margin-bottom: 16px; }
.asr-quality-heading h2 { font-size: 18px; }
.asr-quality-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.asr-quality-heading-actions { display: flex; align-items: center; gap: 12px; }
.asr-quality-heading-actions > span { color: var(--muted); font-size: 12px; }
.asr-quality-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.asr-quality-metric { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--line); }
.asr-quality-metric:last-child { border-right: 0; }
.asr-quality-metric strong { display: block; color: var(--green-dark); font-size: 22px; font-variant-numeric: tabular-nums; }
.asr-quality-metric span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.asr-quality-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, .8fr); gap: 32px; padding-top: 20px; }
.asr-quality-layout h3 { margin-bottom: 9px; font-size: 14px; }
.asr-dialect-row { display: grid; grid-template-columns: minmax(110px, 1fr) 90px 90px 120px; gap: 12px; align-items: center; min-height: 42px; border-bottom: 1px solid var(--line); font-size: 13px; }
.asr-dialect-row:first-child { color: var(--muted); font-size: 11px; }
.asr-dialect-row strong { overflow-wrap: anywhere; }
.asr-dialect-row span:not(:first-child) { font-variant-numeric: tabular-nums; text-align: right; }
.asr-correction-list { display: flex; flex-wrap: wrap; gap: 8px; }
.asr-correction-item { display: inline-flex; min-height: 34px; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--muted); font-size: 12px; }
.asr-correction-item strong { color: var(--ink); }
.asr-quality-empty { padding: 18px 0; color: var(--muted); font-size: 13px; }
.asr-quality-note { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.asr-evaluation-history { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.asr-evaluation-history .section-heading { margin-bottom: 6px; }
.asr-evaluation-history h3 { font-size: 14px; }
.asr-evaluation-history .section-heading > span { color: var(--muted); font-size: 12px; }
.asr-evaluation-list { border-top: 1px solid var(--line); }
.asr-evaluation-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) 88px 110px minmax(150px, .8fr); gap: 16px; align-items: center; min-height: 78px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.asr-evaluation-name { min-width: 0; }
.asr-evaluation-name strong { display: block; overflow-wrap: anywhere; font-size: 14px; }
.asr-evaluation-name span,
.asr-evaluation-name p,
.asr-evaluation-score span,
.asr-evaluation-meta span { display: block; margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.asr-evaluation-name p { overflow-wrap: anywhere; }
.asr-evaluation-decision { justify-self: start; padding: 4px 7px; border-radius: 5px; background: var(--blue-soft); color: #19568c; font-size: 11px; font-weight: 720; }
.asr-evaluation-decision.accepted { background: var(--green-soft); color: var(--green-dark); }
.asr-evaluation-decision.rejected { background: var(--coral-soft); color: var(--danger); }
.asr-evaluation-decision.candidate { background: var(--amber-soft); color: #8a4d08; }
.asr-evaluation-score strong { display: block; color: var(--green-dark); font-size: 16px; font-variant-numeric: tabular-nums; }
.asr-evaluation-meta { min-width: 0; text-align: right; }

.review-list,
.audit-list { margin-top: 20px; border-top: 1px solid var(--line); }
.review-mode-toolbar { display: flex; margin: 18px 0 26px; }
.review-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.review-section-heading h2 { font-size: 18px; }
.review-section-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.transcript-review-live-status { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; min-height: 24px; color: var(--stitch-muted); font-size: 11px; }
.transcript-review-live-status i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--stitch-green); box-shadow: 0 0 0 3px rgba(0, 106, 59, .08); }
.transcript-review-live-status.syncing i { animation: transcript-review-sync 1s ease-in-out infinite alternate; }
.transcript-review-live-status.paused i { background: #ba6d0c; box-shadow: 0 0 0 3px rgba(186, 109, 12, .09); animation: none; }
@keyframes transcript-review-sync { from { opacity: .35; } to { opacity: 1; } }
.transcript-review-filters { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(132px, 160px)) minmax(180px, 210px); gap: 10px; align-items: center; margin-bottom: 16px; }
.transcript-review-filters select,
.transcript-review-search { width: 100%; min-width: 0; height: 44px; border: 1px solid var(--stitch-line); border-radius: 12px; background: var(--white); color: var(--stitch-ink); font-size: 13px; }
.transcript-review-filters select { padding: 0 32px 0 12px; }
.transcript-review-search { display: flex; align-items: center; gap: 9px; padding: 0 12px; }
.transcript-review-search .icon { flex: 0 0 auto; color: var(--stitch-weak); }
.transcript-review-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--stitch-ink); font: inherit; }
.transcript-review-search input::placeholder { color: var(--stitch-weak); }
.transcript-review-claim-filter { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
.transcript-review-search:focus-within,
.transcript-review-filters select:focus { border-color: var(--stitch-green); outline: 2px solid rgba(0, 106, 59, 0.1); outline-offset: 0; }
.transcript-review-clear { width: 44px; height: 44px; color: var(--stitch-muted); }
.transcript-review-clear:disabled { opacity: .35; cursor: default; }
.transcript-review-progress { margin-bottom: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.transcript-review-progress > div { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.transcript-review-progress strong,
.transcript-review-progress span { display: block; }
.transcript-review-progress strong { font-size: 13px; }
.transcript-review-progress div span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.transcript-review-progress b { color: var(--green-dark); font-size: 18px; font-variant-numeric: tabular-nums; }
.transcript-review-progress-track { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: var(--green-soft); }
.transcript-review-progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--stitch-action); transition: width .2s ease; }
.transcript-review-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; border-block: 1px solid var(--line); }
.transcript-review-summary > div { min-width: 0; padding: 13px 16px; border-right: 1px solid var(--line); }
.transcript-review-summary > div:last-child { border-right: 0; }
.transcript-review-summary strong { display: block; color: var(--green-dark); font-size: 20px; font-variant-numeric: tabular-nums; }
.transcript-review-summary span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.transcript-review-list { border-top: 1px solid var(--line); }
.transcript-review-row { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(130px, .8fr) minmax(240px, 1.6fr) minmax(120px, .7fr) auto; gap: 16px; align-items: center; min-height: 92px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.transcript-review-person,
.transcript-review-source,
.transcript-review-copy,
.transcript-review-meta { min-width: 0; }
.transcript-review-person strong,
.transcript-review-copy strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.transcript-review-person span,
.transcript-review-source small,
.transcript-review-meta > span:last-child { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.review-source-badge { display: inline-flex; min-height: 25px; align-items: center; padding: 3px 7px; border-radius: 5px; background: var(--blue-soft); color: #19568c; font-size: 11px; font-weight: 720; }
.review-source-badge.manual_needed { background: var(--coral-soft); color: var(--danger); }
.review-source-badge.legacy { background: var(--amber-soft); color: #8a4d08; }
.transcript-review-copy p { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.transcript-review-meta { text-align: right; }
.transcript-review-meta .task-status { display: inline-flex; }
.transcript-review-claim-status { display: block; max-width: 150px; margin: 5px 0 0 auto; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.transcript-review-claim-status.mine { color: var(--green-dark); font-weight: 700; }
.transcript-review-claim-status.claimed { color: #8a4d08; }
.transcript-review-row > .btn { min-width: 106px; }
.transcript-review-row > .btn:disabled { box-shadow: none; opacity: .65; cursor: default; }
.transcript-review-list .empty-state .btn { margin-top: 14px; }
.transcript-review-pagination { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.transcript-review-pagination > div { display: flex; align-items: center; gap: 4px; }
.transcript-review-pagination .icon-btn { width: 40px; height: 40px; color: var(--green-dark); }
.transcript-review-pagination .icon-btn:disabled { opacity: .3; cursor: default; }
.transcript-review-pagination .icon-btn:disabled:hover { background: transparent; }
.review-row { display: grid; grid-template-columns: minmax(180px, 1fr) 120px 120px 220px; gap: 16px; align-items: center; min-height: 76px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.review-title { font-weight: 740; }
.review-meta { color: var(--muted); font-size: 12px; }
.review-actions { display: flex; justify-content: flex-end; gap: 8px; }
.review-actions .btn { min-height: 38px; padding: 7px 10px; }
.audit-row { display: grid; grid-template-columns: 150px 140px 180px minmax(180px, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.audit-time,
.audit-resource { color: var(--muted); }

.session-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #cfe5f8;
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: #19568c;
  font-size: 14px;
}

.resume-panel {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.resume-panel summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 720;
}

.resume-panel summary::-webkit-details-marker { display: none; }
.resume-panel summary > span:first-child { display: flex; align-items: center; gap: 8px; }
.fact-conflict-panel { margin: 14px 0; padding: 13px 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.fact-conflict-panel[hidden] { display: none; }
.fact-conflict-panel.is-resolved { border-left-color: var(--green); background: var(--green-soft); }
.fact-conflict-panel.is-resolved .fact-conflict-heading { color: var(--green-dark); }
.fact-conflict-heading { display: flex; align-items: flex-start; gap: 9px; color: #8a4d08; }
.fact-conflict-heading .icon { flex: 0 0 auto; margin-top: 1px; }
.fact-conflict-heading div { display: grid; gap: 2px; }
.fact-conflict-heading span { color: var(--muted); font-size: 12px; }
.fact-conflict-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #ead6b8; }
.fact-conflict-values { min-width: 0; font-size: 13px; line-height: 1.55; }
.fact-conflict-values span { display: block; color: var(--muted); font-size: 11px; }
.conflict-evidence { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.conflict-evidence li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; align-items: baseline; font-size: 11px; }
.conflict-evidence li b { color: #8a4d08; }
.conflict-evidence li span { overflow-wrap: anywhere; color: var(--muted); }
.conflict-evidence-action { display: inline-flex; align-items: center; gap: 3px; padding: 2px 4px; border: 0; background: transparent; color: var(--green-dark); cursor: pointer; font-size: 11px; font-weight: 700; }
.conflict-evidence-action .icon { width: 13px; height: 13px; }
.fact-conflict-actions { display: grid; flex: 0 0 auto; gap: 2px; text-align: right; }
.fact-conflict-action { padding: 6px 0; border: 0; background: transparent; color: #8a4d08; cursor: pointer; font-size: 12px; font-weight: 760; }
.fact-resolution-action { padding: 6px 0; border: 0; background: transparent; color: var(--green-dark); cursor: pointer; font-size: 12px; font-weight: 760; }
.conflict-resolution-result { margin-top: 5px; padding: 7px 9px; border-left: 3px solid var(--green); background: var(--green-soft); }
.conflict-resolution-result b { color: var(--green-dark); font-size: 12px; }
.conflict-resolution-result span { display: block; margin-top: 2px; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.memoir-conflict-panel { margin: 18px 0; padding: 14px; border-left: 3px solid var(--coral); background: var(--coral-soft); }
.memoir-conflict-panel.is-resolved { border-left-color: var(--green); background: var(--green-soft); }
.memoir-conflict-panel h2 { font-size: 16px; }
.memoir-conflict-panel p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.memoir-conflict-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #ffd2ce; font-size: 13px; }
.memoir-conflict-row > div { min-width: 0; }
.memoir-conflict-row .conflict-evidence li b { color: var(--danger); }
.memoir-conflict-panel.is-resolved .memoir-conflict-row .conflict-evidence li b { color: var(--green-dark); }
.memoir-conflict-actions { display: grid; flex: 0 0 auto; gap: 2px; text-align: right; }
.memoir-conflict-row button { padding: 5px 0; border: 0; background: transparent; color: var(--danger); cursor: pointer; font-weight: 750; }
.memoir-conflict-row button[data-record-resolution] { color: var(--green-dark); }
.resume-summary { color: var(--muted); font-size: 12px; font-weight: 600; }
.progress-content { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.progress-last { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.progress-last strong { display: block; margin-bottom: 5px; color: var(--ink); }

.coverage-row,
.topic-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.coverage-row { padding-top: 12px; }
.coverage-item { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.coverage-item.filled { border-color: #b8e8d1; background: var(--green-soft); color: var(--green-dark); }

.topic-selector { margin: 14px 0; }
.topic-tab { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--white); color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 680; }
.topic-tab.active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }

.question-panel {
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.eyebrow { padding: 14px 14px 0; color: var(--muted); font-size: 12px; font-weight: 720; }
.question-panel h1 { padding: 5px 14px 16px; font-size: 23px; line-height: 1.45; font-weight: 780; }
.assistant-link { display: flex; width: calc(100% - 28px); min-height: 46px; align-items: center; justify-content: space-between; margin: 0 14px 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--green); cursor: pointer; font-weight: 720; }
.assistant-link span { display: flex; align-items: center; gap: 8px; }
.question-choices { border-top: 1px solid var(--line); }
.question-choices summary { padding: 10px 14px; color: var(--muted); cursor: pointer; font-size: 13px; list-style-position: inside; }
#questionList { display: grid; gap: 6px; padding: 0 14px 14px; }
.question-choice { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); cursor: pointer; text-align: left; }
.question-choice.selected { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }

.record-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px minmax(72px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 150px;
  padding: 20px 14px;
  border-block: 1px solid var(--line);
}
.recording-environment-notice { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #7a470b; }
.recording-environment-notice[hidden] { display: none; }
.recording-environment-notice .icon { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; }
.recording-environment-notice div { display: grid; gap: 2px; }
.recording-environment-notice strong { font-size: 13px; }
.recording-environment-notice span { font-size: 12px; line-height: 1.55; }
.recording-check-link { display: inline-flex; width: fit-content; min-height: 34px; align-items: center; gap: 6px; margin: 8px auto 2px; padding: 5px 8px; border: 0; background: transparent; color: var(--green-dark); font: inherit; font-size: 12px; font-weight: 720; cursor: pointer; }
.recording-check-link .icon { width: 16px; height: 16px; }

.record-status,
.record-timer { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 680; }
.record-timer { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.record-btn { display: grid; width: 82px; height: 82px; place-items: center; padding: 0; border: 2px solid var(--coral); border-radius: 50%; background: var(--white); cursor: pointer; }
.record-core { display: block; width: 58px; height: 58px; border-radius: 50%; background: var(--coral); transition: width 160ms ease, height 160ms ease, border-radius 160ms ease; }
.record-btn.recording .record-core { width: 34px; height: 34px; border-radius: 7px; }
.record-btn.recording { animation: recordingPulse 1.8s ease-in-out infinite; }

@keyframes recordingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 68, 56, 0.22); }
  50% { box-shadow: 0 0 0 10px rgba(240, 68, 56, 0); }
}

.transcript-panel,
.followup-panel { padding: 18px 0; border-bottom: 1px solid var(--line); }
.field-heading { margin-bottom: 9px; font-size: 14px; font-weight: 720; }
.field-heading span span,
.field-heading label span,
.field-heading > span:last-child { color: var(--muted); font-size: 12px; font-weight: 550; }
.field-status { color: var(--green) !important; }
.transcript-panel textarea,
.assistant-compose textarea { width: 100%; min-height: 120px; resize: vertical; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--white); line-height: 1.7; }
.retry-upload { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; padding: 7px 0; border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 13px; font-weight: 700; }
.retry-upload[hidden] { display: none; }
.transcript-panel textarea:focus,
.assistant-compose textarea:focus { border-color: var(--green); outline: 3px solid rgba(7, 148, 85, 0.12); }
.transcript-confirm-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.5; cursor: pointer; }
.transcript-confirm-row input { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--green); }
.session-draft-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; margin-top: 10px; padding: 8px 10px; border: 1px solid #dceade; border-radius: 8px; background: #f6fbf7; color: #4f7458; font-size: 12px; line-height: 18px; }
.session-draft-status[hidden] { display: none; }
.session-draft-status > span { display: flex; min-width: 0; align-items: center; gap: 6px; }
.session-draft-status .icon { width: 15px; height: 15px; flex: 0 0 auto; }
.session-draft-status button { flex: 0 0 auto; padding: 2px 0; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.session-draft-status button:hover { color: var(--danger); }
.upload-progress { height: 6px; margin-top: 12px; overflow: hidden; border-radius: 4px; background: var(--line); }
.upload-progress[hidden] { display: none; }
.upload-progress span { display: block; width: 0; height: 100%; background: var(--green); transition: width 180ms ease; }
.upload-recovery-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.upload-recovery-actions[hidden] { display: none; }
.upload-retry-status { flex: 1 1 180px; color: #8a6724; font-size: 12px; line-height: 18px; }
.upload-retry-status[hidden] { display: none; }
.discard-upload { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; padding: 7px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 700; }
.discard-upload:hover { color: var(--danger); }
.recognition-recovery { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 10px 12px; border: 1px solid #e1b85b; border-radius: 8px; background: #fff9e9; color: #725619; font-size: 13px; line-height: 20px; }
.recognition-recovery[hidden] { display: none; }
.retry-recognition { display: inline-flex; min-height: 34px; flex: 0 0 auto; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #b98b21; border-radius: 6px; background: white; color: #725619; font: inherit; font-weight: 700; cursor: pointer; }
.retry-recognition:disabled { opacity: .55; cursor: default; }
.retry-recognition .icon { width: 16px; height: 16px; }
.analysis-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.analysis-tag { padding: 4px 8px; border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 12px; }
.analysis-tag.gap { background: var(--amber-soft); color: var(--amber); }

.followup-list { display: grid; gap: 8px; }
.followup-option { display: flex; width: 100%; min-height: 48px; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); cursor: pointer; text-align: left; }
.followup-option::before { content: ""; width: 18px; height: 18px; flex: 0 0 auto; border: 2px solid var(--line-strong); border-radius: 50%; }
.followup-option.selected { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.followup-option.selected::before { border: 5px solid var(--green); background: var(--white); }

.next-question-field { display: block; padding: 18px 0 12px; color: var(--muted); font-size: 13px; font-weight: 680; }
.next-question-field input { width: 100%; height: 46px; margin-top: 8px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--white); }
.save-round { min-height: 52px; margin-bottom: 28px; }

.history-section { padding-top: 22px; border-top: 1px solid var(--line); }
.section-heading h2 { font-size: 19px; }
.section-heading span { color: var(--muted); font-size: 13px; }
.history-empty { padding: 28px 0; color: var(--muted); text-align: center; }
.history-round { padding: 16px 0; border-bottom: 1px solid var(--line); }
.history-q { display: flex; align-items: center; gap: 8px; color: var(--green-dark); font-size: 13px; font-weight: 720; }
.history-q .icon-btn { width: 34px; height: 34px; flex: 0 0 auto; margin-left: auto; }
.history-topic { color: var(--muted); font-weight: 550; }
.history-a { margin-top: 6px; color: var(--ink); line-height: 1.75; }
.transcript-state { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 7px; border: 1px solid #e8b064; border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700; white-space: nowrap; }
.transcript-state.confirmed { border-color: #b8e8d1; background: var(--green-soft); color: var(--green-dark); }
.page-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }

.subpage-header { min-height: 48px; margin-bottom: 24px; }
.subpage-header > div { flex: 1; }
.subpage-header h1 { font-size: 22px; }
.subpage-header p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.assistant-conversation { min-height: 280px; margin-bottom: 18px; padding: 18px 0; border-block: 1px solid var(--line); }
.assistant-empty { display: grid; min-height: 240px; place-content: center; color: var(--muted); text-align: center; }
.assistant-empty .icon { width: 34px; height: 34px; margin: 0 auto 10px; color: var(--green); }
.assistant-turn { padding: 15px 0; border-bottom: 1px solid var(--line); }
.assistant-turn:last-child { border-bottom: 0; }
.assistant-user { color: var(--muted); font-size: 13px; }
.assistant-reply { margin-top: 8px; font-family: "Songti SC", "STSong", serif; font-size: 17px; line-height: 1.85; }
.assistant-compose { padding-top: 4px; }
.assistant-compose > label { display: block; margin-bottom: 8px; font-weight: 720; }
.assistant-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }

.memoir-header { display: grid; grid-template-columns: 42px 1fr 42px; text-align: center; }
.memoir-cover { display: grid; grid-template-columns: 66px 1fr; gap: 16px; align-items: center; padding: 16px 0 24px; border-bottom: 1px solid var(--line); }
.memoir-avatar { width: 66px; height: 66px; }
.memoir-cover h2 { font-size: 25px; line-height: 1.3; }
.memoir-subtitle { margin-top: 5px; color: var(--muted); }
.memoir-stats { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; color: var(--amber); font-size: 13px; font-weight: 680; }
.memoir-stats span:last-child { color: var(--green); }
.memoir-section-title { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 10px; }
.memoir-section-title h2 { font-size: 19px; }
.memoir-section-title span { color: var(--muted); font-size: 12px; }
.memoir-timeline { margin-top: 24px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.memoir-timeline .memoir-section-title { margin-top: 0; }
.timeline-group + .timeline-group { margin-top: 24px; }
.memoir-timeline ol { margin: 0; padding: 0; list-style: none; }
.timeline-row { position: relative; display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 13px; padding: 13px 0; border-top: 1px solid var(--line); }
.timeline-row.unplaced { grid-template-columns: 96px minmax(0, 1fr); }
.timeline-row time { overflow-wrap: anywhere; color: var(--green-dark); font-size: 15px; font-weight: 760; font-variant-numeric: tabular-nums; }
.timeline-row:not(.unplaced) time { white-space: nowrap; }
.timeline-row.unplaced time { color: #a15c07; overflow-wrap: anywhere; }
.timeline-event { min-width: 0; }
.timeline-event-heading { display: flex; min-height: 26px; align-items: center; gap: 7px; }
.timeline-event-heading strong { font-size: 14px; }
.timeline-event-actions { display: flex; min-width: 0; align-items: center; gap: 5px; margin-left: auto; }
.timeline-event-heading .icon-btn { width: 30px; height: 30px; flex: 0 0 auto; }
.timeline-followup, .timeline-resolution-action { display: inline-flex; min-height: 30px; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--green-dark); font-size: 12px; font-weight: 720; white-space: nowrap; cursor: pointer; }
.timeline-followup .icon, .timeline-resolution-action .icon { width: 14px; height: 14px; }
.timeline-event p { margin-top: 3px; overflow-wrap: anywhere; font-family: "Songti SC", "STSong", serif; font-size: 15px; line-height: 1.7; }
.timeline-event small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.timeline-event .timeline-question { color: #8a4b08; }
.timeline-event .timeline-resolution-note { color: var(--green-dark); }
.timeline-event .timeline-stale-note { padding: 7px 9px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #8a4b08; line-height: 1.55; }
.timeline-stale-list { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--amber); background: var(--amber-soft); }
.timeline-stale-list strong { display: block; color: #8a4b08; font-size: 12px; }
.timeline-stale-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; padding-top: 7px; color: var(--muted); font-size: 11px; }
.timeline-stale-row span { min-width: 0; overflow-wrap: anywhere; }
.timeline-stale-row button { flex: 0 0 auto; }
.timeline-state { flex: 0 0 auto; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.timeline-state.confirmed, .timeline-state.resolved { border-color: #b8e8d1; background: var(--green-soft); color: var(--green-dark); }
.timeline-state.conflict { border-color: #f4b8a5; background: var(--coral-soft); color: var(--danger); }
.memoir-relationships { margin-top: 24px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.memoir-relationships .memoir-section-title { margin-top: 0; }
.relationship-center { display: inline-flex; min-height: 42px; align-items: center; gap: 10px; margin-bottom: 4px; color: #19568c; }
.relationship-center > .icon { width: 34px; height: 34px; padding: 7px; border: 1px solid #b8d3ec; border-radius: 50%; background: #eef6fc; }
.relationship-center span { display: grid; }
.relationship-center strong { font-size: 14px; }
.relationship-center small { color: var(--muted); font-size: 10px; }
.memoir-relationships ol { margin: 0 0 0 16px; padding: 0 0 0 16px; border-left: 1px solid #b8d3ec; list-style: none; }
.relationship-row { position: relative; display: grid; grid-template-columns: 98px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.relationship-row::before { content: ""; position: absolute; left: -21px; top: 22px; width: 9px; height: 9px; border: 2px solid #5b9bc9; border-radius: 50%; background: var(--white); }
.relationship-kind { display: grid; align-content: start; gap: 3px; }
.relationship-kind strong { color: #19568c; font-size: 14px; }
.relationship-kind span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.relationship-content { min-width: 0; }
.relationship-heading { display: flex; min-height: 28px; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.relationship-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px; }
.relationship-content p { margin-top: 3px; overflow-wrap: anywhere; font-family: "Songti SC", "STSong", serif; font-size: 15px; line-height: 1.7; }
.relationship-content small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.relationship-content .relationship-question { color: #19568c; }
.relationship-followup, .identity-add, .identity-edit { display: inline-flex; min-height: 28px; flex: 0 0 auto; align-items: center; gap: 4px; padding: 0 4px; border: 0; background: transparent; color: var(--green-dark); font-size: 12px; font-weight: 720; white-space: nowrap; cursor: pointer; }
.relationship-followup .icon, .identity-add .icon, .identity-edit .icon { width: 14px; height: 14px; }
.identity-add { color: #19568c; }
.verified-person-list { display: grid; gap: 6px; margin: 7px 0 9px; }
.verified-person { display: flex; min-height: 48px; align-items: center; gap: 8px; padding: 7px 8px; border-left: 3px solid var(--green); background: #f0faf5; }
.verified-person.is-stale { border-left-color: var(--amber); background: var(--amber-soft); }
.verified-person-mark { display: inline-flex; color: var(--green-dark); }
.verified-person.is-stale .verified-person-mark { color: var(--amber); }
.verified-person-mark .icon { width: 17px; height: 17px; }
.verified-person-copy { display: grid; min-width: 0; flex: 1; }
.verified-person-copy strong { overflow-wrap: anywhere; color: var(--green-dark); font-size: 13px; }
.verified-person.is-stale .verified-person-copy strong { color: #8a4d08; }
.verified-person-copy small { margin-top: 1px; overflow-wrap: anywhere; }
.identity-edit { color: #19568c; }
.relationship-evidence-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.relationship-evidence-list span, .relationship-evidence { display: inline-flex; min-height: 28px; align-items: center; gap: 4px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--white); color: var(--muted); font-size: 10px; }
.relationship-evidence { cursor: pointer; }
.relationship-evidence .icon { width: 13px; height: 13px; }
.chapter-list { position: relative; padding-left: 30px; }
.chapter-list::before { content: ""; position: absolute; left: 9px; top: 18px; bottom: 18px; width: 1px; background: var(--line-strong); }
.memoir-chapter { position: relative; border-bottom: 1px solid var(--line); }
.memoir-chapter::before { content: ""; position: absolute; left: -30px; top: 18px; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--white); }
.memoir-chapter.has-content::before { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px var(--white); }
.memoir-chapter summary { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; font-size: 17px; font-weight: 720; }
.memoir-chapter summary::-webkit-details-marker { display: none; }
.chapter-state { color: var(--muted); font-size: 12px; font-weight: 550; }
.memoir-chapter.has-content summary { color: var(--green-dark); }
.chapter-body { padding: 0 0 18px; }
.memoir-fragment { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.memoir-fragment.needs-review { border-left: 3px solid #e8b064; }
.frag-q { display: flex; align-items: center; gap: 7px; font-weight: 720; }
.frag-q .transcript-state { margin-left: auto; }
.frag-q .icon-btn { width: 32px; height: 32px; flex: 0 0 auto; }
.frag-q::before { content: "Q"; display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 6px; background: var(--green-soft); color: var(--green); }
.frag-text { margin: 15px 0 0 35px; font-family: "Songti SC", "STSong", serif; font-size: 17px; line-height: 1.9; }
.frag-date { margin: 10px 0 0 35px; color: var(--muted); font-size: 12px; }
.gap-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 11px 12px; border: 1px dashed #e8b064; border-radius: var(--radius); background: var(--amber-soft); color: var(--amber); font-size: 13px; }
.chapter-continue { display: flex; width: 100%; align-items: center; justify-content: space-between; margin-top: 12px; padding: 10px 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--green); cursor: pointer; font-weight: 720; }
.memoir-empty-copy { padding-bottom: 14px; color: var(--muted); font-size: 13px; }
.memoir-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }

.elder-dialog {
  width: min(calc(100% - 32px), 480px);
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-dialog);
}

.elder-dialog::backdrop { background: rgba(16, 35, 61, 0.35); backdrop-filter: blur(2px); }
.elder-dialog form { display: grid; max-height: calc(100vh - 42px); gap: 16px; overflow-y: auto; padding: 22px; }
.dialog-header h2 { font-size: 21px; }
.elder-dialog label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 680; }
.elder-dialog input,
.elder-dialog select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--white); color: var(--ink); }
.elder-dialog textarea { width: 100%; resize: vertical; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.transcript-audio { width: 100%; min-height: 42px; }
.audio-segment-editor { display: grid; gap: 12px; padding: 12px 0; border-block: 1px solid var(--line); }
.audio-segment-editor[hidden] { display: none; }
.audio-segment-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--green-dark); }
.audio-segment-heading > div { display: grid; min-width: 0; gap: 2px; }
.audio-segment-heading strong { color: var(--ink); font-size: 14px; }
.audio-segment-heading span { color: var(--muted); font-size: 11px; font-weight: 500; }
.audio-segment-fields input { font-variant-numeric: tabular-nums; }
.audio-segment-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px; gap: 8px; }
.audio-segment-actions .btn { min-width: 0; min-height: 42px; padding-inline: 9px; font-size: 12px; white-space: normal; }
.audio-segment-actions .icon-btn { width: 42px; height: 42px; color: var(--danger); }
.dialog-help { margin-top: 3px; color: var(--muted); font-size: 12px; }
.consent-fieldset { display: grid; gap: 12px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.consent-fieldset legend { padding: 0 5px; color: var(--ink); font-weight: 720; }
.resolution-values { margin: 0; padding: 0; border: 0; }
.resolution-values legend { margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 680; }
.resolution-option { display: flex !important; grid-template-columns: none !important; align-items: flex-start; gap: 10px !important; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink) !important; cursor: pointer; }
.resolution-option:first-child { border-top: 1px solid var(--line); }
.resolution-option input { width: 18px !important; height: 18px !important; flex: 0 0 auto; margin-top: 2px; accent-color: var(--green); }
.resolution-option span { min-width: 0; }
.resolution-option strong { display: block; font-size: 14px; }
.resolution-option small { display: block; margin-top: 2px; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.resolution-warning { padding: 10px 12px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #8a4d08; font-size: 12px; line-height: 1.55; }
.person-evidence-values { min-width: 0; }
.person-evidence-option.is-pending { cursor: not-allowed; opacity: 0.62; }
.person-evidence-empty { margin: 0; padding: 12px 0; border-block: 1px solid var(--line); color: var(--muted); font-size: 12px; }
#factResolutionRevoke[hidden], #timelineResolutionRevoke[hidden], #personIdentityRevoke[hidden] { display: none !important; }
.elder-dialog .checkbox-row { display: flex; grid-template-columns: none; align-items: flex-start; gap: 9px; color: var(--ink); line-height: 1.5; }
.elder-dialog .checkbox-row input { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--green); }
.form-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.consent-current { display: grid; gap: 3px; padding: 11px 12px; border-left: 3px solid var(--green); background: var(--green-soft); color: var(--green-dark); font-size: 13px; }
.consent-current span { color: var(--muted); font-size: 12px; }
.consent-history { border-top: 1px solid var(--line); padding-top: 12px; }
.consent-history summary { color: var(--green-dark); cursor: pointer; font-size: 13px; font-weight: 700; }
.consent-history-row { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.consent-history-row span,
.consent-history-row small { color: var(--muted); }
.pending-queue-list { border-top: 1px solid var(--line); }
.pending-queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pending-queue-copy { min-width: 0; }
.pending-queue-copy strong { display: block; overflow-wrap: anywhere; }
.pending-queue-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.pending-queue-copy small { display: block; margin-top: 5px; color: var(--amber); font-size: 11px; }
.pending-queue-actions { display: flex; align-items: center; gap: 6px; }
.pending-queue-actions .btn { min-height: 36px; padding: 6px 9px; font-size: 12px; }
.pending-queue-empty { padding: 30px 0; color: var(--muted); text-align: center; }

.onboarding-dialog { width: min(calc(100% - 32px), 600px); }
.onboarding-shell { display: grid; max-height: calc(100vh - 42px); gap: 18px; overflow-y: auto; padding: 24px; }
.onboarding-kicker { margin: 0 0 2px; color: var(--green-dark); font-size: 12px; font-weight: 750; }
.onboarding-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.onboarding-step { display: grid; min-width: 0; justify-items: center; gap: 6px; padding: 13px 4px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.onboarding-step span { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--white); font-size: 12px; font-weight: 750; }
.onboarding-step span .icon { width: 15px; height: 15px; }
.onboarding-step small { overflow-wrap: anywhere; font-size: 11px; font-weight: 650; }
.onboarding-step.active { color: var(--green-dark); }
.onboarding-step.active span { border-color: var(--green); background: var(--green); color: var(--white); }
.onboarding-step.complete span { border-color: var(--green); color: var(--green-dark); }
.onboarding-body { min-height: 236px; }
.onboarding-lead { margin: 0 0 14px; color: var(--ink); font-size: 17px; font-weight: 720; }
.onboarding-body ol { display: grid; gap: 10px; margin: 0; padding-left: 26px; color: var(--ink); }
.onboarding-body li { padding-left: 4px; }
.onboarding-body li::marker { color: var(--green); font-weight: 750; }
.onboarding-note { display: flex; align-items: flex-start; gap: 9px; margin: 18px 0 0; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #7a470b; font-size: 12px; }
.onboarding-note .icon { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.onboarding-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; }
.onboarding-actions { display: flex; justify-content: flex-end; gap: 8px; }
.onboarding-footer .btn { min-height: 42px; padding: 9px 13px; font-size: 13px; text-decoration: none; }
.onboarding-footer .btn[hidden] { display: none; }

.client-guide-dialog { width: min(calc(100% - 32px), 1120px); height: min(calc(100vh - 32px), 900px); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow-dialog); }
.client-guide-dialog::backdrop { background: rgba(16, 35, 61, 0.4); backdrop-filter: blur(2px); }
.client-guide-shell { display: grid; height: 100%; grid-template-rows: auto minmax(0, 1fr); }
.client-guide-header { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 18px 10px 22px; border-bottom: 1px solid var(--line); background: var(--white); }
.client-guide-header p { margin: 0; color: var(--green-dark); font-size: 11px; font-weight: 720; }
.client-guide-header h2 { margin: 1px 0 0; font-size: 19px; }
.client-guide-actions { display: flex; align-items: center; gap: 8px; }
.client-guide-actions .btn { min-height: 38px; padding: 7px 11px; font-size: 12px; }
.client-guide-frame { width: 100%; height: 100%; border: 0; background: var(--white); }

.login-dialog {
  width: min(calc(100% - 32px), 420px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-dialog);
}
.login-dialog::backdrop { background: rgba(16, 35, 61, 0.62); backdrop-filter: blur(4px); }
.login-dialog form { display: grid; gap: 16px; padding: 26px; }
.login-brand { display: flex; align-items: center; gap: 13px; padding-bottom: 4px; }
.login-mark { display: grid; width: 46px; height: 46px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); }
.login-brand h1 { font-size: 22px; }
.login-brand p,
.login-footnote { color: var(--muted); font-size: 12px; }
.login-dialog label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 680; }
.login-dialog input { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--white); }
.login-deployment-notice,
.beta-data-notice { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-left: 3px solid #d97706; background: var(--amber-soft); color: #744006; font-size: 12px; line-height: 1.55; }
.login-deployment-notice[hidden],
.beta-data-notice[hidden],
.deployment-badge[hidden] { display: none; }
.login-deployment-notice .icon,
.beta-data-notice .icon { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; }
.beta-data-notice { width: min(100%, 680px); margin: 0 auto 16px; }
.login-alert { padding: 10px 12px; border-left: 3px solid var(--coral); background: var(--coral-soft); color: var(--danger); font-size: 13px; }
.login-footnote { text-align: center; }

.toast-region { position: fixed; right: 16px; bottom: calc(16px + var(--safe-bottom)); z-index: 100; display: grid; max-width: min(360px, calc(100% - 32px)); gap: 8px; }
.toast { padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--ink); color: var(--white); box-shadow: var(--shadow-dialog); font-size: 13px; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--green-dark); }

.guide-page { min-height: 100vh; background: var(--white); }
.guide-topbar { position: sticky; top: 0; z-index: 30; display: grid; min-height: 62px; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(12px); }
.guide-topbar > strong { font-size: 17px; }
.guide-back { display: inline-flex; width: fit-content; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.guide-print { width: fit-content; min-height: 40px; justify-self: end; padding: 8px 12px; font-size: 13px; }
.guide-layout { display: grid; width: min(100%, 1240px); grid-template-columns: 230px minmax(0, 820px); justify-content: center; gap: 54px; margin: 0 auto; padding: 46px 32px 90px; }
.guide-toc { position: sticky; top: 94px; align-self: start; display: grid; gap: 3px; padding-right: 26px; border-right: 1px solid var(--line); }
.guide-toc p { margin: 0 0 10px; color: var(--ink); font-size: 12px; font-weight: 760; }
.guide-toc a { padding: 6px 0; color: var(--muted); font-size: 12px; text-decoration: none; }
.guide-toc a:hover { color: var(--green-dark); }
.guide-content { min-width: 0; }
.guide-title-block { padding-bottom: 36px; border-bottom: 2px solid var(--ink); }
.guide-title-block > p:first-child { margin: 0 0 10px; color: var(--green-dark); font-size: 12px; font-weight: 720; }
.guide-title-block h1 { max-width: 690px; margin: 0; font-size: 38px; line-height: 1.22; }
.guide-intro { max-width: 720px; margin: 18px 0 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.guide-principle { display: flex; align-items: flex-start; gap: 11px; margin-top: 24px; padding: 15px 0 15px 16px; border-left: 4px solid var(--green); background: var(--green-soft); }
.guide-principle .icon { margin-top: 2px; color: var(--green-dark); }
.guide-principle p { margin: 0; padding-right: 16px; }
.guide-section { scroll-margin-top: 84px; padding: 42px 0; border-bottom: 1px solid var(--line); }
.guide-section h2 { margin: 0 0 20px; font-size: 25px; }
.guide-section h3 { margin: 28px 0 10px; font-size: 17px; }
.guide-section p { margin: 10px 0; color: #32445d; line-height: 1.8; }
.guide-definition-grid { display: grid; grid-template-columns: 1fr 1fr; border-block: 1px solid var(--line); }
.guide-definition-grid div { display: grid; gap: 5px; padding: 18px 18px 18px 0; border-bottom: 1px solid var(--line); }
.guide-definition-grid div:nth-child(odd) { border-right: 1px solid var(--line); }
.guide-definition-grid div:nth-child(even) { padding-left: 18px; }
.guide-definition-grid div:nth-last-child(-n + 2) { border-bottom: 0; }
.guide-definition-grid span { color: var(--muted); font-size: 13px; line-height: 1.7; }
.guide-table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.guide-table { width: 100%; min-width: 640px; border-collapse: collapse; }
.guide-table th, .guide-table td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.guide-table th { background: var(--surface); color: var(--muted); font-size: 12px; }
.guide-table td { color: #32445d; font-size: 13px; line-height: 1.65; }
.guide-table tbody tr:last-child td { border-bottom: 0; }
.guide-callout, .guide-warning { margin-top: 18px !important; padding: 13px 15px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #7a470b !important; font-size: 13px; }
.guide-warning { border-left-color: var(--coral); background: var(--coral-soft); color: #8f2924 !important; }
.guide-procedure { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: procedure; border-top: 1px solid var(--line); }
.guide-procedure li { position: relative; display: grid; min-height: 78px; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: start; padding: 17px 0 17px 48px; border-bottom: 1px solid var(--line); counter-increment: procedure; }
.guide-procedure li::before { content: counter(procedure); position: absolute; top: 15px; left: 0; display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); font-size: 12px; font-weight: 760; }
.guide-procedure span { color: var(--muted); font-size: 13px; line-height: 1.7; }
.guide-checklist { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.guide-checklist li { position: relative; padding-left: 26px; color: #32445d; }
.guide-checklist li::before { content: ""; position: absolute; top: 7px; left: 2px; width: 11px; height: 6px; border-bottom: 2px solid var(--green); border-left: 2px solid var(--green); transform: rotate(-45deg); }
.guide-example { margin-top: 22px; padding: 16px 18px; border-left: 3px solid #2e75b6; background: var(--blue-soft); }
.guide-example strong { display: block; color: #19568c; font-size: 12px; }
.guide-example p { margin: 3px 0 13px; }
.guide-example p:last-child { margin-bottom: 0; }
.guide-recovery-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.guide-recovery-list li { padding: 15px 0; border-bottom: 1px solid var(--line); color: #32445d; }
.guide-training-list { grid-template-columns: 1fr 1fr; gap: 14px 30px; }
.guide-final-note { margin-top: 26px !important; padding-top: 20px; border-top: 2px solid var(--ink); color: var(--ink) !important; font-weight: 650; }
.guide-embedded .guide-topbar { display: none; }
.guide-embedded .guide-layout { padding-top: 30px; }
.guide-embedded .guide-toc { top: 30px; }

@media (max-width: 820px) {
  .guide-topbar { grid-template-columns: 1fr auto; padding-inline: 20px; }
  .guide-topbar > strong { display: none; }
  .guide-layout { grid-template-columns: minmax(0, 1fr); padding: 30px 20px 70px; }
  .guide-toc { display: none; }
  .guide-title-block h1 { font-size: 31px; }
  .guide-definition-grid { grid-template-columns: 1fr; }
  .guide-definition-grid div, .guide-definition-grid div:nth-child(even) { padding: 15px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .guide-definition-grid div:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .guide-definition-grid div:last-child { border-bottom: 0; }
  .guide-procedure li { grid-template-columns: 1fr; gap: 4px; }
  .guide-training-list { grid-template-columns: 1fr; }
  .guide-embedded .guide-layout { padding-top: 24px; }
}

@media (max-width: 460px) {
  .guide-back span { display: none; }
  .guide-print { padding-inline: 10px; }
  .guide-layout { padding-inline: 18px; }
  .guide-title-block h1 { font-size: 28px; }
  .guide-section h2 { font-size: 22px; }
}

@media print {
  @page { size: A4; margin: 16mm; }
  .guide-topbar, .guide-toc { display: none !important; }
  .guide-layout { display: block; width: auto; padding: 0; }
  .guide-title-block h1 { font-size: 28pt; }
  .guide-section { break-inside: avoid; padding: 22px 0; }
  .guide-table-wrap { overflow: visible; }
  .guide-table { min-width: 0; }
  .guide-principle, .guide-callout, .guide-warning, .guide-example { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

@media (max-width: 560px) {
  html,
  body,
  .app-shell { max-width: 100%; overflow-x: hidden; }
  .app-shell { border-inline: 0; }
  body { min-height: 100dvh; }
  .topbar { min-height: calc(64px + var(--safe-top)); padding: calc(12px + var(--safe-top)) 20px 12px; }
  .page { min-height: calc(100dvh - 64px); padding: 22px 20px calc(92px + var(--safe-bottom)); }
  .workspace-page { padding-inline: 20px; }
  .organization-name { display: none; }
  .topbar-actions { gap: 6px; }
  .user-control { width: 36px; justify-content: center; }
  .user-control span { display: none; }
  .workspace-nav { display: none; }
  .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 25; display: flex; min-height: calc(62px + var(--safe-bottom)); align-items: stretch; padding: 4px max(8px, env(safe-area-inset-right)) var(--safe-bottom) max(8px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.98); box-shadow: 0 -8px 24px rgba(16, 35, 61, 0.06); backdrop-filter: blur(14px); }
  .mobile-nav button { position: relative; display: grid; min-width: 0; min-height: 56px; flex: 1; place-content: center; justify-items: center; gap: 2px; padding: 4px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 680; }
  .mobile-nav button[hidden] { display: none; }
  .mobile-nav button.active { color: var(--green-dark); }
  .mobile-nav button.active::before { content: ""; position: absolute; top: -5px; left: 50%; width: 32px; height: 3px; background: var(--green); transform: translateX(-50%); }
  .mobile-nav .icon { width: 21px; height: 21px; }
  input, select, textarea { font-size: 16px; }
  .workspace-heading { display: grid; grid-template-columns: minmax(0, 1fr); align-items: flex-start; }
  .project-title-group { display: grid; gap: 9px; }
  .project-title-group select { width: 100%; min-width: 0; max-width: none; }
  .workspace-actions { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .workspace-actions .btn { min-width: 0; min-height: 38px; padding: 7px 6px; font-size: 12px; white-space: nowrap; }
  .metric-band { grid-template-columns: 1fr 1fr; margin-inline: -20px; padding: 10px 20px; }
  .metric-item { padding: 10px 0; }
  .metric-item:nth-child(2) { border-right: 0; }
  .metric-value { font-size: 24px; }
  .agenda-heading { align-items: flex-start; }
  .agenda-summary { max-width: 190px; flex-wrap: wrap; justify-content: flex-end; }
  .agenda-list { grid-template-columns: 1fr; }
  .agenda-card-body { align-items: flex-end; }
  .project-layout { grid-template-columns: 1fr; }
  .task-surface { padding-right: 0; }
  .attention-rail { margin-top: 24px; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .asr-quality-metrics { grid-template-columns: 1fr 1fr; }
  .asr-quality-heading { align-items: flex-start; }
  .asr-quality-heading-actions { align-items: flex-end; flex-direction: column; gap: 7px; }
  .asr-quality-heading-actions .btn { min-height: 38px; }
  .asr-quality-metric:nth-child(2) { border-right: 0; }
  .asr-quality-metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .asr-quality-layout { grid-template-columns: 1fr; gap: 22px; }
  .asr-dialect-row:first-child { display: none; }
  .asr-dialect-row:not(:first-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px 0; }
  .asr-dialect-row:not(:first-child) strong { grid-column: 1 / -1; }
  .asr-dialect-row:not(:first-child) span { min-width: 0; text-align: left; overflow-wrap: anywhere; }
  .asr-dialect-row:not(:first-child) span::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: 10px; }
  .asr-evaluation-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; padding: 14px 0; }
  .asr-evaluation-name { grid-column: 1 / -1; }
  .asr-evaluation-score { grid-column: 1; }
  .asr-evaluation-meta { grid-column: 2; text-align: right; }
  .asr-evaluation-decision { grid-column: 2; grid-row: 2; }
  .task-table-wrap { overflow: visible; border: 0; }
  .task-table { min-width: 0; }
  .task-table thead { display: none; }
  .task-table tbody,
  .task-table tr,
  .task-table td { display: block; width: 100%; }
  .task-table tr { margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
  .task-table td { display: grid; grid-template-columns: 82px 1fr; min-height: 0; padding: 7px 0; border: 0; }
  .task-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .task-table td[colspan] { display: block; }
  .task-table td[colspan]::before { display: none; }
  .task-table td[colspan] .empty-state { padding: 38px 8px; }
  .task-progress { width: 100%; }
  .review-row,
  .audit-row { grid-template-columns: 1fr; gap: 6px; }
  .review-actions { justify-content: flex-start; margin-top: 6px; }
  .memoir-actions { grid-template-columns: 1fr; }
  .form-grid-two { grid-template-columns: 1fr; }
  .page-heading-row h1 { font-size: 27px; }
  .btn-compact { padding-inline: 11px; }
  .archive-toolbar { overflow-x: auto; margin-right: -20px; padding-right: 20px; scrollbar-width: none; }
  .archive-toolbar::-webkit-scrollbar { display: none; }
  .segmented-control { width: 100%; min-width: 0; }
  .segmented-control button { min-width: 0; flex: 1; padding-inline: 7px; }
  .elder-row { grid-template-columns: 52px minmax(0, 1fr); align-items: start; }
  .elder-row-actions { width: 100%; min-width: 0; grid-column: 2; }
  .elder-row-actions .btn { font-size: 13px; }
  .question-panel h1 { font-size: 21px; }
  .record-panel { grid-template-columns: minmax(0, 1fr) 82px 76px; padding-inline: 4px; }
  .record-status { font-size: 13px; }
  .record-status .icon { display: none; }
  .record-btn { width: 74px; height: 74px; }
  .record-core { width: 52px; height: 52px; }
  .record-timer { font-size: 13px; }
  .timeline-row.unplaced { grid-template-columns: 82px minmax(0, 1fr); }
  .timeline-event-heading { flex-wrap: wrap; }
  .timeline-event-actions { width: 100%; margin-left: 0; }
  .relationship-row { grid-template-columns: 78px minmax(0, 1fr); gap: 10px; }
  .relationship-heading { align-items: flex-start; }
  .onboarding-shell { gap: 15px; padding: 20px; }
  .onboarding-body { min-height: 260px; }
  .onboarding-footer { align-items: stretch; flex-direction: column; }
  .onboarding-guide-link { width: 100%; }
  .onboarding-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #onboardingPrevBtn[hidden] + #onboardingNextBtn { grid-column: 1 / -1; }
  .client-guide-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .client-guide-header { min-height: calc(62px + var(--safe-top)); padding: calc(9px + var(--safe-top)) 14px 9px 18px; }
  .client-guide-header h2 { font-size: 17px; }
  .client-guide-actions { gap: 5px; }
  .client-guide-actions .btn { width: 38px; min-height: 38px; padding: 0; font-size: 0; }
  .client-guide-actions .btn .icon { width: 19px; height: 19px; }
}

@media (max-width: 430px) {
  .status-control { width: 36px; min-height: 36px; justify-content: center; padding: 0; border-radius: 50%; }
  .status-control span:last-child { display: none; }
}

@media (max-width: 370px) {
  .page { padding-inline: 16px; }
  .topbar { padding-inline: 16px; }
  .brand-button { font-size: 19px; }
  .btn { padding-inline: 12px; }
  .elder-row-actions { grid-column: 1 / -1; }
  .record-panel { grid-template-columns: 1fr 76px 1fr; }
  .record-status { max-width: 84px; }
  .assistant-actions,
  .page-actions,
  .memoir-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Stitch Serene Archive visual migration */
:root {
  --canvas: #f7f9fb;
  --surface: #eef2f5;
  --ink: #10233d;
  --muted: #65748a;
  --faint: #8d99aa;
  --line: #dbe2e8;
  --line-strong: #c7d0da;
  --green: #079455;
  --green-dark: #067647;
  --green-soft: #e8f8f0;
  --amber: #a65b08;
  --amber-soft: #fff7e8;
  --blue-soft: #edf5ff;
  --radius: 12px;
  --radius-card: 16px;
  --shadow-card: 0 8px 28px rgba(16, 35, 61, 0.07);
  --shadow-action: 0 10px 24px rgba(7, 148, 85, 0.2);
  --shadow-dialog: 0 24px 64px rgba(16, 35, 61, 0.18);
}

body {
  background: var(--canvas);
  font-family: "Be Vietnam Pro", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(100%, 1440px);
  background: var(--canvas);
  border-inline: 0;
}

.topbar {
  min-height: 72px;
  padding: 12px 28px;
  border-bottom-color: rgba(219, 226, 232, 0.82);
  background: rgba(247, 249, 251, 0.94);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--green-dark);
  font-family: Manrope, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #bde7d1;
  border-radius: 10px;
  background: var(--green-soft);
}

.brand-mark .icon { width: 22px; height: 22px; }
.organization-name { border-left-color: var(--line); }

.workspace-nav {
  top: 72px;
  min-height: 52px;
  gap: 8px;
  padding: 0 28px;
  background: rgba(247, 249, 251, 0.96);
}

.workspace-nav button {
  min-width: 92px;
  margin: 7px 0;
  padding: 0 16px;
  border-radius: 10px;
}

.workspace-nav button:hover { background: #edf2f5; color: var(--ink); }
.workspace-nav button.active { background: var(--green-soft); color: var(--green-dark); }
.workspace-nav button.active::after { display: none; }
.focus-mode .topbar { display: none; }

.page {
  min-height: calc(100vh - 124px);
  padding: 34px 32px calc(48px + var(--safe-bottom));
}

.page:not(.workspace-page) { width: min(100%, 760px); }
#page-elders { width: min(100%, 960px); }
.workspace-page { padding: 30px 32px calc(48px + var(--safe-bottom)); }

.page-heading-row h1,
.workspace-heading h1,
.subpage-header h1,
.memoir-cover h2,
.dialog-header h2,
.login-brand h1 {
  font-family: Manrope, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-heading-row h1 { font-size: 30px; font-weight: 800; }
.page-intro { margin-top: 5px; color: var(--muted); font-size: 15px; }
.page-count { margin-top: 2px; color: var(--faint); font-size: 12px; }

.btn {
  min-height: 48px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 740;
}

.btn-primary { box-shadow: var(--shadow-action); }
.btn-primary:disabled { box-shadow: none; }
.btn-compact { min-height: 44px; }
.icon-btn { border-color: transparent; background: transparent; color: var(--green-dark); }
.icon-btn:hover { background: var(--green-soft); }

.search-field {
  height: 56px;
  margin: 26px 0 14px;
  padding-inline: 17px;
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: 0 3px 14px rgba(16, 35, 61, 0.04);
}

.search-field .icon { width: 22px; height: 22px; color: var(--faint); }
.archive-toolbar { margin-bottom: 18px; }

.segmented-control {
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.segmented-control button {
  min-width: 100px;
  min-height: 40px;
  padding-inline: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}

.segmented-control button.active {
  border-color: var(--green);
  background: var(--green-dark);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(7, 148, 85, 0.16);
}

.segmented-control button.active span { background: rgba(255, 255, 255, 0.16); color: var(--white); }

.pending-upload-summary {
  min-height: 48px;
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid #f2d7a7;
  border-left: 4px solid var(--amber);
  border-radius: 12px;
}

.archive-list {
  display: grid;
  gap: 14px;
  border-top: 0;
}

.elder-row {
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-card);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.elder-row:hover {
  border-color: #b7d9c8;
  box-shadow: 0 12px 32px rgba(16, 35, 61, 0.1);
  transform: translateY(-1px);
}

.elder-avatar,
.memoir-avatar {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green-dark);
}

.elder-name { font-size: 19px; font-weight: 780; }
.elder-meta { margin-top: 4px; }
.elder-progress { margin-top: 9px; }
.consent-badge,
.pending-upload-badge,
.task-status { border-radius: 999px; }

.elder-row-actions { width: 320px; }
.elder-row-actions .btn { min-height: 44px; }
.row-menu summary { border: 1px solid var(--line); }
.row-menu-panel { border-radius: 12px; }

.empty-state,
.error-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.55);
}

.metric-band {
  margin-top: 24px;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.agenda-card,
.task-table-wrap { border-radius: 12px; background: var(--white); }
.attention-icon { border-radius: 10px; }

.session-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  margin-bottom: 18px;
  text-align: center;
}

.session-header > div { min-width: 0; }
.session-header h1 { overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.session-header p { margin-bottom: 2px; color: var(--muted); font-size: 12px; }
.session-header .icon-btn { width: 44px; height: 44px; }

.session-strip {
  min-height: 42px;
  padding: 8px 13px;
  border: 0;
  border-radius: 12px;
  background: var(--blue-soft);
}

.resume-panel {
  border-color: var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 3px 14px rgba(16, 35, 61, 0.035);
}

.topic-selector {
  flex-wrap: nowrap;
  margin: 16px -2px 18px;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-selector::-webkit-scrollbar { display: none; }
.topic-tab { flex: 0 0 auto; min-height: 40px; border-radius: 999px; background: var(--white); }
.topic-tab.active { border-color: var(--green); background: var(--green-dark); color: var(--white); }

.record-panel {
  display: grid;
  min-height: 314px;
  grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr);
  grid-template-areas:
    "status status status"
    "waveform waveform waveform"
    "timer timer timer"
    ". record .";
  gap: 16px;
  margin-bottom: 18px;
  padding: 26px 28px;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.record-status {
  grid-area: status;
  justify-content: center;
  color: var(--green-dark);
  font-size: 15px;
}

.record-status .icon { width: 20px; height: 20px; }
.record-waveform { display: flex; height: 74px; grid-area: waveform; align-items: center; justify-content: center; gap: 6px; }
.record-waveform i { display: block; width: 4px; height: 28%; border-radius: 4px; background: var(--green); transform-origin: center; }
.record-waveform i:nth-child(3n + 1) { height: 68%; }
.record-waveform i:nth-child(4n + 2) { height: 44%; }
.record-waveform i:nth-child(5n) { height: 86%; }
.record-waveform i:nth-child(7n) { height: 58%; }

.record-panel.recording:not(.audio-reactive) .record-waveform i { animation: waveformPulse 850ms ease-in-out infinite alternate; }
.record-panel.recording:not(.audio-reactive) .record-waveform i:nth-child(3n) { animation-delay: -220ms; }
.record-panel.recording:not(.audio-reactive) .record-waveform i:nth-child(4n) { animation-delay: -410ms; }

@keyframes waveformPulse {
  from { transform: scaleY(0.55); opacity: 0.68; }
  to { transform: scaleY(1.08); opacity: 1; }
}

.record-timer {
  grid-area: timer;
  justify-content: center;
  color: var(--ink);
  font-family: Manrope, ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
}

.record-timer .icon { display: none; }
.record-btn { width: 88px; height: 88px; grid-area: record; border: 0; background: var(--green-dark); box-shadow: var(--shadow-action); }
.record-core { display: grid; width: 58px; height: 58px; place-items: center; background: transparent; color: var(--white); }
.record-core .icon { width: 32px; height: 32px; stroke-width: 2.2; }
.record-btn.recording { background: var(--white); border: 2px solid var(--coral); }
.record-btn.recording .record-core { width: 34px; height: 34px; background: var(--coral); }
.record-btn.recording .record-core .icon { display: none; }

.question-panel {
  margin-bottom: 18px;
  border: 0;
  border-left: 5px solid var(--green);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.eyebrow { color: var(--green-dark); }
.question-panel h1 { padding: 7px 18px 18px; font-size: 24px; line-height: 1.5; }
.assistant-link { border-color: #bce5d0; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); }
.question-choices { border-color: var(--line); }
.question-choice { border-radius: 10px; }

.transcript-panel,
.followup-panel {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--white);
}

.transcript-panel textarea,
.assistant-compose textarea,
.next-question-field input {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--canvas);
}

.followup-option { min-height: 58px; border-radius: 12px; }
.next-question-field { margin-top: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); }
.save-round { margin-top: 14px; box-shadow: var(--shadow-action); }
.history-section { margin-top: 8px; padding: 22px 20px 0; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); }

#page-magic { width: min(100%, 760px); }
.assistant-conversation { min-height: 280px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); box-shadow: var(--shadow-card); }
.assistant-turn { padding: 16px; border: 0; border-radius: 12px; background: var(--green-soft); }
.assistant-turn + .assistant-turn { margin-top: 12px; }
.assistant-user { color: var(--green-dark); font-weight: 700; }
.assistant-reply { padding-top: 10px; border-top: 1px solid #c7ead7; }
.assistant-compose { margin-top: 16px; padding: 20px; border: 1px solid #c6ead7; border-radius: var(--radius-card); background: #eefaf4; }

.memoir-cover {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.memoir-avatar { width: 72px; height: 72px; border-radius: 50%; border: 3px solid #b8ead1; }
.memoir-stats { gap: 7px; }
.memoir-stats span { padding: 4px 8px; border-radius: 999px; background: var(--amber-soft); }
.memoir-stats span:last-child { background: var(--green-soft); }
.memoir-timeline,
.memoir-relationships,
.memoir-conflict-panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); box-shadow: 0 4px 18px rgba(16, 35, 61, 0.045); }
.memoir-conflict-panel { border-left: 4px solid var(--coral); }
.memoir-conflict-panel.is-resolved { border-left-color: var(--green); }
.chapter-list { display: grid; gap: 12px; padding-left: 0; }
.chapter-list::before { display: none; }
.memoir-chapter { padding: 0 18px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); box-shadow: 0 4px 18px rgba(16, 35, 61, 0.04); }
.memoir-chapter::before { display: none; }
.memoir-chapter summary { min-height: 64px; }
.memoir-fragment { border-radius: 12px; background: var(--canvas); }

.elder-dialog,
.login-dialog,
.client-guide-dialog {
  border-color: transparent;
  border-radius: 18px;
}

.elder-dialog form { gap: 18px; padding: 26px; }
.elder-dialog input,
.elder-dialog select,
.elder-dialog textarea {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--canvas);
}

.consent-fieldset { border-radius: 12px; background: #fbfcfd; }
.consent-current { border: 1px solid #bce5d0; border-left: 4px solid var(--green); border-radius: 10px; }
.pending-queue-list { display: grid; gap: 12px; border-top: 0; }
.pending-queue-row { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); }

.login-dialog { width: min(calc(100% - 32px), 520px); }
.login-dialog::backdrop { background: rgba(247, 249, 251, 0.97); backdrop-filter: none; }
.login-dialog form { gap: 18px; padding: 34px; }
.login-brand { flex-direction: column; gap: 14px; padding-bottom: 8px; text-align: center; }
.login-mark { width: 72px; height: 72px; border-radius: 18px; }
.login-mark .icon { width: 34px; height: 34px; }
.login-brand h1 { font-size: 30px; }
.login-brand p { max-width: 360px; margin-top: 6px; font-size: 14px; line-height: 1.65; }
.login-dialog label { gap: 8px; font-size: 14px; }
.login-dialog input { height: 52px; padding-inline: 15px; border-color: var(--line); border-radius: 10px; background: var(--surface); }
.login-dialog .btn { min-height: 54px; font-size: 16px; }
.login-footnote { display: flex; align-items: center; justify-content: center; gap: 7px; padding-top: 4px; }
.login-footnote .icon { width: 16px; height: 16px; color: var(--green-dark); }

.onboarding-shell { padding: 28px; }
.onboarding-step span { width: 34px; height: 34px; }
.toast { border-radius: 12px; }

@media (max-width: 760px) {
  .topbar { min-height: calc(68px + var(--safe-top)); padding: calc(12px + var(--safe-top)) 20px 12px; }
  .brand-button { font-size: 19px; }
  .brand-mark { width: 36px; height: 36px; }
  .page { min-height: 100dvh; padding: 24px 20px calc(96px + var(--safe-bottom)); }
  .workspace-page { padding-inline: 20px; }
  .page-heading-row { align-items: flex-start; }
  .page-heading-row h1 { font-size: 27px; }
  .page-intro { font-size: 14px; }
  .archive-list { gap: 16px; }
  .elder-row { grid-template-columns: 64px minmax(0, 1fr); align-items: start; padding: 20px; }
  .elder-row-actions { width: 100%; grid-column: 1 / -1; }
  .elder-row-actions .btn { min-width: 0; }
  .segmented-control { width: max-content; min-width: 100%; }
  .segmented-control button { min-width: 90px; }
  .mobile-nav { min-height: calc(68px + var(--safe-bottom)); padding-top: 7px; background: rgba(255, 255, 255, 0.98); }
  .mobile-nav button { min-height: 56px; border-radius: 12px; }
  .mobile-nav button.active { background: var(--green-soft); color: var(--green-dark); }
  .mobile-nav button.active::before { display: none; }
  .focus-mode .page { padding-bottom: calc(34px + var(--safe-bottom)); }
  .session-header { margin-top: 0; }
  .record-panel { min-height: 292px; padding: 22px 18px; }
  .record-waveform { height: 62px; gap: 4px; }
  .record-waveform i { width: 3px; }
  .record-timer { font-size: 28px; }
  .question-panel h1 { font-size: 22px; }
  .transcript-panel,
  .followup-panel,
  .next-question-field,
  .history-section { padding-inline: 16px; }
  .memoir-cover { grid-template-columns: 64px minmax(0, 1fr); padding: 18px; }
  .memoir-avatar { width: 64px; height: 64px; }
  .memoir-cover h2 { font-size: 21px; }
  .memoir-timeline,
  .memoir-relationships,
  .memoir-conflict-panel { padding: 16px; }
  .login-dialog { width: min(calc(100% - 28px), 520px); }
  .login-dialog form { padding: 26px 22px; }
  .login-brand h1 { font-size: 27px; }
}

@media (max-width: 430px) {
  .page { padding-inline: 18px; }
  .topbar { padding-inline: 18px; }
  .page-heading-row .btn { width: 44px; min-width: 44px; padding: 0; font-size: 0; }
  .page-heading-row .btn .icon { width: 22px; height: 22px; }
  .search-field { margin-top: 22px; }
  .archive-toolbar { margin-right: -18px; padding-right: 18px; }
  .elder-row { padding: 18px; }
  .elder-row-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px; }
  .row-menu summary { width: 42px; height: 44px; }
  .record-waveform i:nth-child(even) { display: none; }
  .record-panel { min-height: 278px; }
  .record-btn { width: 82px; height: 82px; }
  .record-timer { font-size: 26px; }
  .session-header h1 { font-size: 18px; }
  .assistant-actions,
  .page-actions,
  .memoir-actions { grid-template-columns: 1fr; }
  .onboarding-shell { padding: 22px 18px; }
}

/* Stitch prototype fidelity pass: structure and metrics follow the supplied screens. */
:root {
  --stitch-bg: #f8f9fb;
  --stitch-card: #ffffff;
  --stitch-ink: #10233d;
  --stitch-muted: #65748a;
  --stitch-weak: #8d99aa;
  --stitch-line: #dbe2e8;
  --stitch-green: #006a3b;
  --stitch-action: #079455;
  --stitch-green-soft: #e8f8f0;
  --stitch-amber: #904d00;
  --stitch-amber-soft: #fff7e8;
  --stitch-danger: #c4322b;
  --stitch-shadow: 0 4px 20px rgba(16, 35, 61, 0.05);
}

html,
body {
  background: var(--stitch-bg);
  color: var(--stitch-ink);
  font-family: "Be Vietnam Pro", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

h1,
h2,
h3,
.brand-button,
.elder-name,
.btn-primary {
  font-family: Manrope, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  background: var(--stitch-bg);
}

.topbar {
  width: min(100%, 720px);
  min-height: 72px;
  margin: 0 auto;
  padding: 12px 20px;
  border: 0;
  background: rgba(248, 249, 251, 0.94);
  backdrop-filter: blur(12px);
}

.brand-button {
  gap: 10px;
  color: var(--stitch-green);
  font-size: 20px;
  font-weight: 700;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.brand-mark .icon { width: 27px; height: 27px; stroke-width: 2; }
.organization-name { color: var(--stitch-muted); }

.workspace-nav {
  top: 72px;
  width: min(100%, 1140px);
  min-height: 50px;
  margin: 0 auto;
  padding: 0 20px;
  border-color: rgba(219, 226, 232, 0.55);
  background: rgba(248, 249, 251, 0.96);
}

.workspace-nav button {
  min-width: 86px;
  border-radius: 10px;
  color: var(--stitch-muted);
}

.workspace-nav button.active { background: var(--stitch-green-soft); color: var(--stitch-green); }

.page,
.page:not(.workspace-page),
#page-elders,
#page-magic {
  width: min(100%, 720px);
  max-width: 720px;
  padding: 32px 20px calc(104px + var(--safe-bottom));
}

.workspace-page { width: min(100%, 1140px); max-width: 1140px; }

#page-elders { padding-top: 30px; }

.page-heading-row {
  align-items: center;
  margin-bottom: 0;
}

.page-heading-row h1 {
  color: var(--stitch-ink);
  font-size: 26px;
  line-height: 34px;
  font-weight: 700;
}

.page-intro {
  margin-top: 2px;
  color: var(--stitch-muted);
  font-size: 14px;
  line-height: 22px;
}

.page-count { color: var(--stitch-weak); }

.btn {
  min-height: 48px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary,
.btn-accent {
  border-color: var(--stitch-action);
  background: var(--stitch-action);
  color: white;
  box-shadow: 0 8px 18px rgba(0, 106, 59, 0.16);
}

.btn-secondary { border-color: var(--stitch-line); background: white; color: var(--stitch-ink); }

#newElderBtn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
}

.search-field {
  height: 58px;
  margin: 26px 0 16px;
  padding: 0 17px;
  border: 1px solid var(--stitch-line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 2px 6px rgba(16, 35, 61, 0.04);
}

.search-field input { color: var(--stitch-ink); font-size: 16px; }
.search-field input::placeholder { color: var(--stitch-muted); }
.search-field .icon { color: var(--stitch-weak); }

.archive-toolbar { margin-bottom: 28px; }

.segmented-control {
  width: auto;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.segmented-control button {
  min-width: 88px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--stitch-line);
  border-radius: 999px;
  background: white;
  color: var(--stitch-muted);
  font-size: 14px;
}

.segmented-control button span { display: inline; margin-left: 3px; font-size: 12px; opacity: 0.76; }

.segmented-control button.active {
  border-color: var(--stitch-green);
  background: var(--stitch-green);
  color: white;
  box-shadow: 0 5px 12px rgba(0, 106, 59, 0.18);
}

.archive-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.elder-row {
  display: block;
  min-height: 250px;
  padding: 20px;
  border: 1px solid transparent;
  border-radius: 24px;
  background: white;
  box-shadow: var(--stitch-shadow);
  transform: none;
}

.elder-row:hover { border-color: rgba(0, 106, 59, 0.2); box-shadow: var(--stitch-shadow); transform: none; }

.elder-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 66px;
}

.elder-avatar {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 16px;
  background: var(--stitch-green-soft);
  color: var(--stitch-green);
  box-shadow: inset 0 0 0 1px rgba(0, 106, 59, 0.06);
}

.elder-avatar.portrait-2 { background: #fff2e8; color: var(--stitch-amber); }
.elder-avatar.portrait-3 { background: #e9f0ff; color: #4b5d7a; }

.consent-badge {
  display: inline-flex;
  width: auto;
  margin: 0;
  padding: 5px 11px;
  border: 0;
  border-radius: 8px;
  background: var(--stitch-amber-soft);
  color: var(--stitch-amber);
  font-size: 12px;
  line-height: 16px;
}

.consent-badge.active { background: var(--stitch-green-soft); color: var(--stitch-green); }
.consent-badge.withdrawn { background: #ffdad6; color: var(--stitch-danger); }

.elder-copy { margin-top: 14px; }
.elder-name { color: var(--stitch-ink); font-size: 20px; line-height: 28px; font-weight: 700; }
.elder-meta { margin-top: 4px; color: var(--stitch-muted); font-size: 14px; line-height: 22px; }
.elder-progress { margin-top: 8px; color: var(--stitch-muted); font-size: 12px; line-height: 18px; }
.elder-progress:not(.empty) { color: var(--stitch-green); }
.pending-upload-badge { margin-top: 8px; }

.elder-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--stitch-line);
}

.elder-role-markers { display: flex; padding-left: 2px; }
.elder-role-markers span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  margin-left: -5px;
  border: 2px solid white;
  border-radius: 50%;
  background: #fd9c44;
  color: white;
  font-size: 10px;
  font-weight: 700;
}
.elder-role-markers span:last-child { background: #4b5d7a; }

.elder-row-actions {
  display: flex;
  width: auto;
  align-items: center;
  gap: 6px;
}

.elder-row-actions .btn {
  width: auto;
  min-width: 44px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--stitch-green);
  box-shadow: none;
}

.elder-row-actions .row-menu summary { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--stitch-green); box-shadow: none; }
.elder-row-actions .btn span { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: 12px; white-space: nowrap; }
.elder-row-actions .btn .icon { width: 18px; height: 18px; }
.elder-row-actions .elder-primary-action .icon { transform: rotate(0deg); }
.elder-row-actions .elder-primary-action { background: var(--stitch-green-soft); }
.elder-row-actions .elder-memoir-action { color: var(--stitch-muted); }
.row-menu { height: 36px; }
.row-menu summary { display: grid; place-items: center; }

.weekly-plan-card {
  position: relative;
  display: grid;
  min-height: 154px;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 14px;
  margin-top: 24px;
  padding: 24px;
  overflow: hidden;
  border-radius: 24px;
  background: #102846;
  color: white;
}

.weekly-plan-card > div { align-self: start; }
.weekly-plan-card strong,
.weekly-plan-card span { display: block; }
.weekly-plan-card strong { font-size: 18px; }
.weekly-plan-card span { margin-top: 5px; color: #d5e3ff; font-size: 14px; }
.weekly-plan-card .btn { width: max-content; min-height: 40px; padding: 0 16px; border-color: #536985; background: #314966; color: white; }
.weekly-plan-card > .icon { position: absolute; right: 22px; bottom: 19px; width: 74px; height: 74px; color: #2a4463; }
.weekly-plan-card .btn { position: relative; z-index: 1; }

.archive-add-tile {
  display: flex;
  min-height: 180px;
  width: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  border: 2px dashed var(--stitch-line);
  border-radius: 24px;
  background: transparent;
  color: var(--stitch-muted);
}

.archive-add-tile > span {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--stitch-line);
  border-radius: 50%;
  background: white;
  color: var(--stitch-weak);
}

.archive-add-tile > span .icon:last-child { width: 22px; height: 22px; }
.archive-add-tile > span .icon:first-child { position: absolute; top: 8px; right: 8px; width: 12px; height: 12px; }
.archive-add-tile strong { font-size: 14px; font-weight: 500; }
.archive-add-tile:hover { border-color: var(--stitch-green); color: var(--stitch-green); }

/* P07: interview workspace */
#page-session.active { display: flex; flex-direction: column; }

.focus-mode .topbar,
.focus-mode .workspace-nav { display: none; }

.session-header,
.memoir-header,
#page-magic > .subpage-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  min-height: 64px;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  margin: -16px 0 10px;
  background: rgba(248, 249, 251, 0.94);
  text-align: center;
  backdrop-filter: blur(12px);
}

.session-header p { display: block; color: var(--stitch-muted); font-size: 11px; line-height: 16px; }
.session-header h1,
.memoir-header h1,
#page-magic > .subpage-header h1 { color: var(--stitch-green); font-size: 20px; line-height: 28px; font-weight: 700; }
.session-header .icon-btn,
.memoir-header .icon-btn,
#page-magic > .subpage-header .icon-btn { width: 40px; height: 40px; border: 0; color: var(--stitch-green); }
.subpage-more { display: grid; width: 40px; height: 40px; place-items: center; color: var(--stitch-green); }
.subpage-more .icon { width: 22px; height: 22px; }

.session-strip,
.resume-panel,
.topic-selector { border-radius: 12px; }

.record-panel {
  display: grid;
  min-height: 510px;
  grid-template-columns: 1fr;
  grid-template-areas: "status" "waveform" "timer" "controls";
  align-content: center;
  gap: 28px;
  margin: 4px 0 18px;
  padding: 48px 16px 34px;
  border: 0;
  border-radius: 0;
  background: radial-gradient(circle at center, rgba(0, 106, 59, 0.1), rgba(248, 249, 251, 0) 56%);
  box-shadow: none;
}

.record-status { grid-area: status; justify-content: center; color: var(--stitch-green); opacity: 1; }
.record-waveform { display: flex; height: 126px; grid-area: waveform; gap: 7px; }
.record-waveform i { width: 5px; min-height: 22px; border-radius: 5px; background: var(--stitch-green); }
.record-timer { grid-area: timer; color: var(--stitch-ink); font-family: Manrope, ui-monospace, monospace; font-size: 42px; line-height: 50px; font-weight: 700; letter-spacing: 4px; }

.record-controls {
  display: grid;
  width: min(100%, 400px);
  grid-area: controls;
  grid-template-columns: 1fr 112px 1fr;
  align-items: center;
  justify-self: center;
  gap: 30px;
}

.record-btn { width: 108px; height: 108px; grid-area: auto; border: 0; background: var(--stitch-green); box-shadow: 0 12px 28px rgba(0, 106, 59, 0.24); }
.record-core { width: 72px; height: 72px; }
.record-core .icon { width: 40px; height: 40px; }

.record-side-control { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 0; border: 0; background: transparent; color: var(--stitch-muted); font-family: inherit; font-size: 13px; cursor: pointer; }
.record-side-control > span:first-child { display: grid; width: 54px; height: 54px; place-items: center; border: 1px solid var(--stitch-line); border-radius: 50%; background: rgba(255,255,255,.55); }
.record-side-control .icon { width: 22px; height: 22px; }
.record-side-control:disabled { opacity: .38; cursor: default; }
.record-side-control:not(:disabled):hover > span:first-child { border-color: var(--stitch-green); color: var(--stitch-green); }
.pause-bars { position: relative; }
.pause-bars::before,
.pause-bars::after { content: ""; position: absolute; top: 17px; width: 5px; height: 18px; border: 2px solid var(--stitch-muted); }
.pause-bars::before { left: 16px; }
.pause-bars::after { right: 16px; }
.record-side-control.stop { color: var(--stitch-muted); }
.record-side-control.stop:not(:disabled):hover > span:first-child { border-color: var(--stitch-danger); color: var(--stitch-danger); }
.stop-square { position: relative; }
.stop-square::after { content: ""; position: absolute; inset: 18px; border: 2px solid var(--stitch-danger); }

.question-panel {
  margin: 0 0 22px;
  padding-top: 16px;
  border: 0;
  border-left: 5px solid var(--stitch-green);
  border-radius: 16px;
  background: white;
  box-shadow: var(--stitch-shadow);
}

.eyebrow { padding: 0 20px; color: var(--stitch-green); font-size: 13px; }
.question-panel h1 { padding: 12px 20px 20px; color: var(--stitch-ink); font-size: 26px; line-height: 1.45; font-weight: 700; }
.assistant-link { min-height: 52px; border: 0; border-radius: 0 0 16px 16px; background: transparent; color: var(--stitch-muted); }
.assistant-link span { font-weight: 500; }
.assistant-link .icon { color: var(--stitch-green); }
.question-choices { border-color: var(--stitch-line); }

.followup-panel,
.transcript-panel,
.next-question-field,
.history-section {
  border-color: var(--stitch-line);
  border-radius: 16px;
  background: white;
}

.followup-option { min-height: 74px; border-color: var(--stitch-line); border-radius: 14px; background: white; }
.followup-option::before { content: "✦"; margin-right: 10px; color: var(--stitch-action); font-size: 20px; }

/* P08: assistant screen and drawer */
#page-magic { padding-top: 20px; }
#page-magic > .subpage-header p { display: block; color: var(--stitch-muted); font-size: 11px; line-height: 16px; }
.assistant-recording-hero {
  display: flex;
  min-height: 520px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
  padding: 28px;
  border-radius: 16px;
  background: white;
  box-shadow: var(--stitch-shadow);
}

.assistant-wave-orbit { display: grid; width: 220px; height: 220px; place-items: center; border-radius: 50%; background: rgba(232, 248, 240, 0.62); animation: assistantPulse 2.2s ease-in-out infinite; }
.assistant-wave-art { display: flex; width: 180px; height: 180px; align-items: center; justify-content: center; gap: 7px; border-radius: 50%; background: #f9fffc; box-shadow: 0 12px 28px rgba(16,35,61,.09); }
.assistant-wave-art i { width: 5px; height: 44px; border-radius: 5px; background: #53cfa0; transform: rotate(12deg); }
.assistant-wave-art i:nth-child(2n) { height: 72px; background: #7fc9df; }
.assistant-wave-art i:nth-child(3n) { height: 96px; background: #9aa8e8; }
@keyframes assistantPulse { 50% { transform: scale(1.04); opacity: .82; } }
.assistant-recording-hero.recording:not(.audio-reactive) .assistant-wave-art i { animation: waveformPulse 780ms ease-in-out infinite alternate; }
.assistant-recording-hero.recording:not(.audio-reactive) .assistant-wave-art i:nth-child(2n) { animation-delay: -260ms; }
.assistant-recording-hero.paused .assistant-wave-orbit { animation-play-state: paused; opacity: .72; }
.assistant-recording-hero h2 { margin-top: 16px; font-size: 20px; }
.assistant-recording-hero p { color: var(--stitch-muted); }
.assistant-recording-hero > span { display: inline-flex; align-items: center; gap: 8px; padding: 5px 16px; border-radius: 999px; background: var(--stitch-green-soft); color: var(--stitch-green); }
.assistant-recording-hero > span b { width: 9px; height: 9px; border-radius: 50%; background: var(--stitch-action); }
.assistant-recording-hero:not(.recording) > span b { background: var(--stitch-weak); }

.assistant-record-controls { position: fixed; bottom: calc(14px + var(--safe-bottom)); left: 50%; z-index: 34; display: grid; width: min(calc(100% - 40px), 420px); grid-template-columns: 76px 112px 76px; align-items: end; justify-content: space-between; transform: translateX(-50%); }
.assistant-control-btn,
.assistant-record-btn { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; border: 1px solid var(--stitch-line); border-radius: 50%; background: white; color: var(--stitch-muted); box-shadow: 0 10px 26px rgba(16,35,61,.14); font-family: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.assistant-control-btn { width: 72px; height: 72px; justify-self: center; }
.assistant-control-btn .icon { width: 19px; height: 19px; }
.assistant-control-btn.danger { border-color: #ffc6c0; background: #ffe4e1; color: var(--stitch-danger); }
.assistant-control-btn:disabled { opacity: .38; cursor: default; }
.assistant-record-btn { width: 108px; height: 108px; justify-self: center; border-color: var(--stitch-green); background: var(--stitch-green); color: white; font-size: 12px; }
.assistant-record-btn .icon { width: 34px; height: 34px; }
.assistant-record-btn.recording { border-color: var(--stitch-danger); background: var(--stitch-danger); }
.assistant-record-btn.paused { border-color: var(--stitch-amber); background: var(--stitch-amber); }
.assistant-record-btn:disabled { opacity: .56; cursor: default; }
.record-btn.paused { animation: none; }

.assistant-live-preview { margin: 24px 0; }
.assistant-live-preview .section-heading { margin-bottom: 14px; }
.assistant-live-preview .section-heading span { display: inline-flex; align-items: center; gap: 5px; color: var(--stitch-green); font-size: 12px; }
.assistant-live-preview article { display: flex; gap: 12px; padding: 18px; border-left: 4px solid var(--stitch-green); border-radius: 14px; background: white; box-shadow: var(--stitch-shadow); }
.assistant-live-preview article > div { min-width: 0; }
.assistant-speaker-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #eceef0; color: var(--stitch-muted); }
.assistant-live-preview article p { margin-top: 5px; color: var(--stitch-muted); font-size: 14px; line-height: 1.65; }
.assistant-transcript-action { width: 100%; min-height: 48px; margin-top: 12px; }

.assistant-drawer {
  position: fixed;
  inset: auto 0 0;
  z-index: 30;
  height: min(57dvh, 900px);
  max-height: min(57dvh, 900px);
  margin: 0;
  padding: 12px max(20px, calc((100vw - 760px) / 2 + 20px)) calc(152px + var(--safe-bottom));
  overflow-y: auto;
  border: 1px solid rgba(0,106,59,.1);
  border-radius: 32px 32px 0 0;
  background: var(--stitch-green-soft);
  box-shadow: 0 -8px 40px rgba(0,106,59,.1);
  overscroll-behavior: contain;
}

.assistant-drawer-handle { width: 54px; height: 6px; margin: 0 auto 20px; border-radius: 999px; background: rgba(0,106,59,.2); }
.assistant-drawer-title { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.assistant-drawer-title > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--stitch-green); color: white; }
.assistant-drawer-title h2 { color: var(--stitch-green); font-size: 20px; }
.assistant-drawer-title p { color: #00522c; font-size: 12px; }

.assistant-conversation {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.assistant-empty,
.assistant-turn { border-radius: 14px; background: rgba(255,255,255,.9); }
.assistant-empty { min-height: 120px; }
.assistant-turn { border: 1px solid rgba(0,106,59,.06); }
.assistant-compose { margin-top: 16px; padding: 18px; border: 0; border-radius: 14px; background: rgba(255,255,255,.9); }
.assistant-compose textarea { background: white; }
.assistant-drawer .followup-option { background: rgba(255,255,255,.9); }

/* P10: memoir directory */
.memoir-page { padding-top: 20px; }
.memoir-header { margin-bottom: 18px; }
.memoir-cover {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--stitch-line);
  border-radius: 14px;
  background: white;
  box-shadow: var(--stitch-shadow);
}
.memoir-avatar { position: relative; width: 80px; height: 80px; border: 2px solid #69dd95; border-radius: 50%; background: var(--stitch-green-soft); color: var(--stitch-green); box-shadow: 0 0 0 4px var(--stitch-green-soft); }
.memoir-avatar > .icon { width: 34px; height: 34px; }
.memoir-avatar span { position: absolute; right: -2px; bottom: -2px; display: grid; width: 25px; height: 25px; place-items: center; border: 2px solid white; border-radius: 50%; background: var(--stitch-green); color: white; }
.memoir-avatar span .icon { width: 14px; height: 14px; }
.memoir-cover h2 { color: var(--stitch-ink); font-size: 20px; line-height: 28px; }
.memoir-subtitle { margin-top: 2px; color: var(--stitch-muted); font-size: 12px; }
.memoir-cover-status { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.memoir-cover-status span { padding: 3px 9px; border-radius: 8px; background: var(--stitch-green-soft); color: var(--stitch-green); font-size: 12px; }
.memoir-cover-status small { color: var(--stitch-muted); }
.memoir-progress { margin-top: 12px; }
.memoir-progress > div { display: flex; justify-content: space-between; color: var(--stitch-muted); font-size: 12px; }
.memoir-progress strong { color: var(--stitch-green); font-size: 14px; }
.memoir-progress > i { display: block; height: 7px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: var(--stitch-green-soft); }
.memoir-progress > i b { display: block; height: 100%; border-radius: inherit; background: var(--stitch-green); }
.memoir-section-title { margin: 28px 2px 14px; }
.memoir-section-title h2 { font-size: 20px; }
.memoir-section-title > span { display: inline-flex; align-items: center; color: var(--stitch-green); font-size: 14px; }
.memoir-section-title > span .icon { width: 18px; height: 18px; }

.chapter-list { gap: 16px; }
.memoir-chapter { padding: 0 22px; border: 1px solid var(--stitch-line); border-radius: 14px; background: white; box-shadow: var(--stitch-shadow); }
.memoir-chapter summary { min-height: 92px; color: var(--stitch-ink); font-size: 20px; font-weight: 700; }
.memoir-chapter .chapter-state { color: var(--stitch-muted); font-size: 12px; font-weight: 500; }
.memoir-chapter[open] .chapter-body { padding-bottom: 18px; }
.memoir-fragment { border-radius: 10px; background: #f8f9fb; }

.memoir-insight { position: relative; margin-top: 24px; padding: 28px; overflow: hidden; border: 1px solid #edf0f5; border-radius: 18px; background: #fefcff; }
.memoir-insight > .icon { position: absolute; top: 22px; right: 22px; width: 78px; height: 78px; color: #e2e5eb; }
.memoir-insight h2 { font-size: 16px; font-weight: 500; }
.memoir-insight > div { display: flex; gap: 32px; margin-top: 18px; }
.memoir-insight > div > span { display: flex; min-width: 110px; flex-direction: column; }
.memoir-insight > div > span + span { padding-left: 28px; border-left: 1px solid var(--stitch-line); }
.memoir-insight strong { font-family: Manrope, sans-serif; color: var(--stitch-ink); font-size: 30px; line-height: 34px; }
.memoir-insight small { color: var(--stitch-muted); }
.memoir-insight p { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: var(--stitch-muted); font-size: 12px; }
.memoir-actions { position: fixed; right: max(20px, calc((100vw - 680px) / 2)); bottom: calc(14px + var(--safe-bottom)); left: max(20px, calc((100vw - 680px) / 2)); z-index: 45; display: grid; grid-template-columns: 48px 48px minmax(0, 1fr); gap: 10px; margin: 0; }
.memoir-actions .btn-secondary { width: 48px; padding: 0; font-size: 0; border-radius: 50%; box-shadow: var(--stitch-shadow); }
.memoir-actions .btn-secondary .icon { width: 20px; height: 20px; }
.memoir-review-cta { min-height: 64px; font-size: 18px; }

/* Full-height task dialogs: P02, P04, P05, P09 and P13. */
#elderDialog,
#consentDialog,
#transcriptDialog,
#pendingQueueDialog,
.onboarding-dialog,
.login-dialog {
  width: min(100%, 720px);
  height: 100dvh;
  max-width: 720px;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--stitch-bg);
  box-shadow: none;
}

#elderDialog::backdrop,
#consentDialog::backdrop,
#transcriptDialog::backdrop,
#pendingQueueDialog::backdrop,
.onboarding-dialog::backdrop,
.login-dialog::backdrop { background: rgba(248,249,251,.98); }

#elderDialog form,
#consentDialog form,
#transcriptDialog form,
#pendingQueueDialog form {
  display: flex;
  height: 100%;
  gap: 24px;
  padding: 0 24px 32px;
  overflow-y: auto;
  flex-direction: column;
  background: var(--stitch-bg);
}

#elderDialog .dialog-header,
#consentDialog .dialog-header,
#transcriptDialog .dialog-header,
#pendingQueueDialog .dialog-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  min-height: 72px;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  margin: 0 -24px;
  padding: 10px 24px;
  background: rgba(248,249,251,.96);
  text-align: center;
  backdrop-filter: blur(12px);
}

.dialog-header h2 { color: var(--stitch-green); font-size: 20px; font-weight: 700; }
.dialog-header .dialog-help { margin-top: 0; overflow: hidden; color: var(--stitch-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dialog-back { width: 40px; height: 40px; justify-self: start; }
.dialog-more { display: grid; width: 40px; height: 40px; place-items: center; justify-self: end; color: var(--stitch-green); }
.dialog-more .icon { width: 22px; height: 22px; }
.dialog-save-link { border: 0; background: transparent; color: var(--stitch-green); font-size: 14px; }
.dialog-task-intro h3 { font-size: 20px; font-weight: 500; }
.dialog-task-intro p { margin-top: 5px; color: var(--stitch-muted); font-size: 14px; line-height: 1.65; }

.dialog-form-card {
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid rgba(219,226,232,.4);
  border-radius: 14px;
  background: white;
  box-shadow: var(--stitch-shadow);
}

#elderDialog label,
#consentDialog label { gap: 8px; color: var(--stitch-ink); font-size: 14px; }
#elderDialog input,
#elderDialog select,
#consentDialog input,
#consentDialog select,
#consentDialog textarea { min-height: 52px; border: 1px solid var(--stitch-line); border-radius: 9px; background: #f2f4f6; color: var(--stitch-ink); font-size: 15px; }
.consent-toggle-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.consent-toggle-heading h3 { display: flex; align-items: center; gap: 10px; color: var(--stitch-ink); font-family: Manrope, sans-serif; font-size: 18px; font-weight: 600; }
.consent-toggle-heading h3 .icon { color: var(--stitch-green); }
.consent-toggle { position: relative; display: block; flex: 0 0 auto; }
.consent-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.consent-toggle > span[aria-hidden] { position: relative; display: block; width: 46px; height: 24px; border-radius: 999px; background: #cfd6dc; transition: background .18s ease; }
.consent-toggle > span[aria-hidden]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(16,35,61,.2); transition: transform .18s ease; }
.consent-toggle input:checked + span { background: var(--stitch-action); }
.consent-toggle input:checked + span::after { transform: translateX(22px); }
.consent-toggle input:focus-visible + span { outline: 3px solid rgba(7,148,85,.2); outline-offset: 2px; }
.consent-fieldset > p { color: var(--stitch-muted); font-size: 14px; line-height: 1.65; }
.profile-photo-placeholder { display: flex; min-height: 220px; align-items: center; justify-content: center; flex-direction: column; gap: 8px; border: 2px dashed var(--stitch-line); border-radius: 14px; color: var(--stitch-muted); }
.profile-photo-placeholder > span { position: relative; display: grid; width: 86px; height: 86px; place-items: center; margin-bottom: 6px; border-radius: 50%; background: #e0e3e5; }
.profile-photo-placeholder > span .icon:last-child { width: 34px; height: 34px; }
.profile-photo-placeholder > span .icon:first-child { position: absolute; top: 18px; right: 19px; width: 14px; height: 14px; }
.profile-photo-placeholder strong { font-weight: 500; }
.profile-photo-placeholder small { color: var(--stitch-weak); }
.dialog-sticky-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-top: auto; }
.dialog-sticky-actions .btn { min-height: 64px; }

/* P05 authorization */
.consent-profile-card { display: flex; align-items: center; gap: 22px; padding: 28px; border-radius: 16px; background: white; box-shadow: var(--stitch-shadow); }
.consent-profile-avatar { position: relative; display: grid; width: 82px; height: 82px; place-items: center; border: 2px solid #c7ead7; border-radius: 50%; background: var(--stitch-green-soft); color: var(--stitch-green); }
.consent-profile-avatar > .icon { width: 34px; height: 34px; }
.consent-profile-avatar span { position: absolute; right: 0; bottom: 0; display: grid; width: 25px; height: 25px; place-items: center; border: 2px solid white; border-radius: 50%; background: var(--stitch-green); color: white; }
.consent-profile-avatar span .icon { width: 13px; height: 13px; }
.consent-profile-card h3 { font-size: 20px; font-weight: 500; }
.consent-profile-card p { margin-top: 6px; padding: 3px 9px; border-radius: 6px; background: #f2f4f6; color: var(--stitch-muted); }
.consent-current { min-height: 150px; padding: 28px; border: 1px solid #bce5d0; border-radius: 16px; background: var(--stitch-green-soft); }
.consent-current strong { color: var(--stitch-green); font-size: 18px; }
.consent-current span { margin-top: 8px; color: var(--stitch-muted); line-height: 1.7; }
.consent-history { order: 3; padding: 0; border: 0; background: transparent; }
.consent-history summary { display: flex; align-items: center; gap: 10px; min-height: 48px; color: var(--stitch-ink); font-size: 18px; }
.consent-history summary .icon { color: var(--stitch-green); }
.consent-history-row { position: relative; margin: 0 0 18px 54px; padding: 20px; border: 1px solid rgba(219,226,232,.7); border-radius: 14px; background: white; box-shadow: var(--stitch-shadow); }
.consent-history-row::before { content: "✓"; position: absolute; top: 0; left: -54px; display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--stitch-action); color: white; }
.consent-audit-note { order: 4; display: flex; gap: 12px; padding: 18px; border: 1px solid var(--stitch-line); border-radius: 14px; background: #f2f4f6; color: var(--stitch-muted); font-size: 14px; line-height: 1.7; }
#consentDialog > form > label,
#consentDialog #consentSubmitBtn { order: 5; }
#consentWithdrawBtn { order: 6; min-height: 60px; border: 2px solid var(--stitch-danger); background: white; color: var(--stitch-danger); }

/* P09 transcription review */
#transcriptDialog { max-width: 760px; }
.transcript-audio-card { padding: 24px; border-radius: 14px; background: white; box-shadow: var(--stitch-shadow); }
.transcript-audio-heading { display: flex; align-items: center; gap: 14px; }
.transcript-audio-heading > span { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; background: var(--stitch-green-soft); color: var(--stitch-green); }
.transcript-audio-heading strong,
.transcript-audio-heading small { display: block; }
.transcript-audio-heading strong { font-size: 18px; font-weight: 500; }
.transcript-audio-heading small { margin-top: 2px; color: var(--stitch-muted); }
.transcript-review-waveform { display: flex; height: 92px; align-items: end; justify-content: center; gap: 3px; margin: 18px 0; }
.transcript-review-waveform i { width: 4px; height: 45%; border-radius: 3px; background: var(--stitch-action); }
.transcript-review-waveform i:nth-child(3n) { height: 82%; }
.transcript-review-waveform i:nth-child(4n) { height: 62%; }
.transcript-review-waveform i:nth-child(5n) { height: 96%; }
.transcript-audio { width: 100%; }
.audio-segment-editor { margin-top: 18px; }
.transcript-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.transcript-original-panel,
.transcript-edit-panel { min-width: 0; }
.transcript-panel-label { display: flex; align-items: center; justify-content: space-between; min-height: 38px; padding: 0 8px; color: var(--stitch-muted); font-size: 14px; }
.transcript-panel-label > span { display: flex; align-items: center; gap: 7px; }
.transcript-panel-label small { padding: 3px 9px; border-radius: 999px; background: #f2f4f6; color: var(--stitch-weak); }
.transcript-original-panel > div:last-child,
.transcript-edit-panel textarea { width: 100%; min-height: 420px; padding: 22px; border: 1px solid var(--stitch-line); border-radius: 14px; background: white; color: var(--stitch-muted); font-size: 15px; font-style: italic; line-height: 1.85; white-space: pre-wrap; }
.transcript-edit-panel textarea { border: 2px solid rgba(0,106,59,.22); color: var(--stitch-ink); font-style: normal; }
.transcript-edit-tools { display: flex; gap: 8px; margin: -54px 14px 14px; overflow: hidden; }
.transcript-edit-tools i { flex: 0 0 auto; padding: 5px 10px; border-radius: 8px; background: #eceef0; color: var(--stitch-muted); font-size: 12px; font-style: normal; }
.transcript-confirmation { padding: 14px; border-radius: 12px; background: var(--stitch-green-soft); }
.transcript-sticky-actions { position: sticky; bottom: -32px; z-index: 8; display: grid; grid-template-columns: 1fr 1.5fr; gap: 14px; margin: 0 -24px -32px; padding: 16px 24px calc(24px + var(--safe-bottom)); border-top: 1px solid rgba(219,226,232,.5); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }

/* P13 pending uploads */
.pending-network-warning { display: flex; gap: 14px; padding: 20px; border: 1px solid #f2d29e; border-radius: 14px; background: var(--stitch-amber-soft); color: var(--stitch-amber); }
.pending-network-warning > .icon { flex: 0 0 auto; }
.pending-network-warning strong,
.pending-network-warning span { display: block; }
.pending-network-warning span { margin-top: 4px; font-size: 14px; line-height: 1.65; }
.pending-queue-list { display: grid; gap: 18px; }
.pending-queue-row { display: flex; min-height: 210px; align-items: stretch; justify-content: space-between; flex-direction: column; gap: 22px; padding: 24px; border: 1px solid rgba(219,226,232,.35); border-radius: 14px; background: white; box-shadow: var(--stitch-shadow); }
.pending-queue-copy strong { font-size: 18px; font-weight: 500; }
.pending-queue-copy span { margin-top: 8px; color: var(--stitch-muted); line-height: 1.6; }
.pending-queue-copy small { margin-top: 12px; padding: 8px; border-radius: 8px; background: #fff8f7; color: var(--stitch-danger); }
.pending-queue-actions { display: grid; grid-template-columns: 1fr 52px; gap: 12px; }
.pending-queue-actions .btn { min-height: 56px; background: var(--stitch-action); color: white; }
.pending-queue-actions .icon-btn { width: 52px; height: 52px; color: var(--stitch-danger); }
.pending-wifi-hint { display: flex; min-height: 170px; align-items: center; justify-content: center; flex-direction: column; gap: 12px; color: #a6abb2; }
.pending-wifi-hint .icon { width: 40px; height: 40px; }

/* P01 secure login */
.login-dialog { display: none; max-width: 706px; overflow-y: auto; }
.login-dialog[open] { display: flex; flex-direction: column; }
.login-topbar { display: flex; min-height: 96px; align-items: center; justify-content: space-between; padding: 24px 36px; color: var(--stitch-green); }
.login-topbar span { display: flex; align-items: center; gap: 12px; font-family: Manrope, sans-serif; font-size: 22px; font-weight: 700; }
.login-topbar span .icon { width: 32px; height: 32px; }
.login-topbar > .icon { width: 28px; height: 28px; color: #3e4a40; }
.login-dialog form { display: grid; width: min(calc(100% - 48px), 630px); gap: 18px; margin: 100px auto 0; padding: 32px 44px 38px; border: 1px solid rgba(219,226,232,.55); border-radius: 18px; background: white; box-shadow: var(--stitch-shadow); }
.login-brand { gap: 18px; }
.login-mark { width: 74px; height: 74px; border-radius: 20px; }
.login-brand h1 { color: var(--stitch-ink); font-size: 34px; line-height: 42px; }
.login-brand p { color: var(--stitch-muted); font-size: 16px; }
.login-dialog label { gap: 7px; color: var(--stitch-muted); font-size: 14px; }
.login-dialog input { height: 54px; border: 1px solid var(--stitch-line); border-radius: 10px; background: #f2f4f6; font-size: 16px; }
.login-options { display: flex; align-items: center; justify-content: space-between; }
.login-options label { display: flex; align-items: center; flex-direction: row; gap: 10px; }
.login-options input { width: 22px; height: 22px; }
.login-options button { border: 0; background: transparent; color: var(--stitch-green); }
.login-dialog .btn-primary { min-height: 64px; font-size: 18px; }
.login-footnote { margin: 46px auto 0; padding: 10px 18px; border: 1px solid var(--stitch-line); border-radius: 999px; background: #f2f4f6; color: var(--stitch-weak); }
.login-copyright { margin: 24px auto 40px; color: var(--stitch-weak); font-size: 12px; line-height: 1.7; text-align: center; }

/* P02 onboarding */
.onboarding-dialog { max-width: 706px; }
.onboarding-shell { display: flex; min-height: 100%; gap: 0; padding: 0 36px 28px; overflow-y: auto; flex-direction: column; }
.onboarding-steps,
.onboarding-visual,
.onboarding-title-block,
.onboarding-body,
.onboarding-footer { flex: 0 0 auto; }
.onboarding-brandbar { display: flex; min-height: 88px; align-items: center; justify-content: space-between; color: var(--stitch-green); }
.onboarding-brandbar span { display: flex; align-items: center; gap: 10px; font-family: Manrope, sans-serif; font-size: 20px; font-weight: 700; }
.onboarding-brandbar .icon { width: 28px; height: 28px; }
.onboarding-brandbar button { border: 0; background: transparent; color: var(--stitch-muted); font-size: 14px; }
.onboarding-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.onboarding-step { display: block; min-height: 38px; padding: 0; overflow: visible; border: 0; background: transparent; color: var(--stitch-muted); font-size: 11px; }
.onboarding-step span { display: block; width: 100%; height: 7px; border: 0; border-radius: 999px; background: #eceef0; font-size: 0; }
.onboarding-step small { display: block; margin-top: 7px; overflow-wrap: anywhere; font-size: 11px; line-height: 16px; }
.onboarding-step.active span,
.onboarding-step.complete span { background: var(--stitch-green); }
.onboarding-step.active small,
.onboarding-step.complete small { color: var(--stitch-green); font-weight: 700; }
.onboarding-visual { position: relative; display: flex; min-height: 440px; align-items: center; justify-content: center; gap: 26px; border-radius: 50%; background: rgba(255,255,255,.72); }
.onboarding-portrait { display: grid; width: 132px; height: 178px; place-items: center; border-radius: 60px 60px 24px 24px; box-shadow: var(--stitch-shadow); }
.onboarding-portrait .icon { width: 58px; height: 58px; }
.onboarding-portrait.elder { background: #e5efe7; color: var(--stitch-green); }
.onboarding-portrait.interviewer { background: #e8f8f0; color: var(--stitch-action); }
.onboarding-conversation { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 50%; background: white; color: var(--stitch-amber); box-shadow: var(--stitch-shadow); }
.onboarding-chip { position: absolute; display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: white; box-shadow: var(--stitch-shadow); color: var(--stitch-ink); font-size: 12px; }
.onboarding-chip .icon { width: 18px; height: 18px; }
.onboarding-chip.warm { top: 18px; right: -4px; background: var(--stitch-green-soft); color: var(--stitch-green); }
.onboarding-chip.pro { bottom: 46px; left: -8px; color: var(--stitch-amber); }
.onboarding-title-block { margin-top: 26px; text-align: center; }
.onboarding-kicker { display: block; }
.onboarding-title-block h2 { color: var(--stitch-ink); font-size: 30px; line-height: 40px; }
.onboarding-body { min-height: 0; margin-top: 12px; text-align: center; }
.onboarding-lead { color: var(--stitch-muted); font-size: 16px; line-height: 1.75; }
.onboarding-body ol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; text-align: left; }
.onboarding-body li { min-height: 112px; padding: 18px; border: 0; border-radius: 16px; background: white; box-shadow: var(--stitch-shadow); }
.onboarding-note { display: flex; text-align: left; }
.onboarding-footer { margin-top: auto; padding-top: 24px; }
.onboarding-guide-link { display: inline-flex; }
.onboarding-actions { width: auto; flex: 1; }
.onboarding-actions .btn { min-height: 64px; }

.mobile-tools-dialog {
  width: min(100%, 720px);
  max-width: 720px;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: white;
  box-shadow: 0 -18px 50px rgba(16, 35, 61, 0.16);
}
.mobile-tools-dialog::backdrop { background: rgba(16, 35, 61, 0.42); backdrop-filter: blur(2px); }
.mobile-tools-shell { padding: 18px 20px calc(22px + var(--safe-bottom)); }
.mobile-tools-shell header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--stitch-line); }
.mobile-tools-shell header p { margin: 0; color: var(--stitch-green); font-size: 11px; font-weight: 700; }
.mobile-tools-shell header h2 { margin: 2px 0 0; font-size: 20px; }
.mobile-tools-list { display: grid; gap: 2px; padding-top: 10px; }
.mobile-tools-list > button { display: grid; width: 100%; min-height: 72px; grid-template-columns: 42px minmax(0, 1fr) 22px; align-items: center; gap: 12px; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--stitch-line); background: transparent; color: var(--stitch-ink); cursor: pointer; text-align: left; }
.mobile-tools-list > button:last-child { border-bottom: 0; }
.mobile-tools-list > button > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: var(--stitch-green-soft); color: var(--stitch-green); }
.mobile-tools-list > button > div { min-width: 0; }
.mobile-tools-list strong,
.mobile-tools-list small { display: block; }
.mobile-tools-list strong { font-size: 15px; }
.mobile-tools-list small { margin-top: 3px; color: var(--stitch-muted); font-size: 12px; line-height: 17px; }
.mobile-tools-list > button > .icon { color: var(--stitch-weak); }

.service-status-dialog {
  width: min(calc(100% - 32px), 640px);
  max-height: min(calc(100dvh - 32px), 820px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--stitch-line);
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-dialog);
}
.service-status-dialog::backdrop { background: rgba(16, 35, 61, .42); backdrop-filter: blur(2px); }
.service-status-shell { display: flex; max-height: min(calc(100dvh - 32px), 820px); flex-direction: column; }
.service-status-shell > header { display: flex; min-height: 72px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--stitch-line); }
.service-status-shell > header p { margin: 0; color: var(--stitch-green); font-size: 11px; font-weight: 700; }
.service-status-shell > header h2 { margin: 2px 0 0; font-size: 20px; }
.service-readiness-summary { flex: 0 0 auto; padding: 20px; border-bottom: 1px solid var(--stitch-line); background: var(--stitch-green-soft); }
.service-readiness-summary > span { color: var(--stitch-green); font-size: 11px; font-weight: 750; }
.service-readiness-summary h3 { margin: 5px 0 0; font-size: 21px; }
.service-readiness-summary p { margin: 5px 0 0; color: var(--stitch-muted); font-size: 13px; line-height: 1.55; }
.service-readiness-summary small { display: block; margin-top: 12px; color: var(--stitch-muted); font-size: 11px; }
.service-readiness-summary.pilot,
.service-readiness-summary.loading { background: var(--amber-soft); }
.service-readiness-summary.pilot > span,
.service-readiness-summary.loading > span { color: #8a4d08; }
.service-readiness-summary.failed { background: var(--coral-soft); }
.service-readiness-summary.failed > span { color: var(--danger); }
.service-readiness-summary.beta { background: var(--blue-soft); }
.service-readiness-summary.beta > span { color: #19568c; }
.service-readiness-checks { min-height: 0; overflow-y: auto; padding: 0 20px; }
.service-readiness-row { display: grid; min-height: 68px; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--stitch-line); }
.service-readiness-row:last-child { border-bottom: 0; }
.service-readiness-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--stitch-green-soft); color: var(--stitch-green); }
.service-readiness-icon .icon { width: 16px; height: 16px; }
.service-readiness-row.warning .service-readiness-icon { background: var(--amber-soft); color: #9b5b0b; }
.service-readiness-row.fail .service-readiness-icon { background: var(--coral-soft); color: var(--danger); }
.service-readiness-row > div { min-width: 0; }
.service-readiness-row strong { display: block; font-size: 13px; }
.service-readiness-row p { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--stitch-muted); font-size: 11px; line-height: 1.5; }
.service-readiness-label { padding: 4px 7px; border-radius: 6px; background: var(--stitch-green-soft); color: var(--stitch-green); font-size: 10px; font-weight: 700; }
.service-readiness-row.warning .service-readiness-label { background: var(--amber-soft); color: #8a4d08; }
.service-readiness-row.fail .service-readiness-label { background: var(--coral-soft); color: var(--danger); }
.service-readiness-checks > .empty-state,
.service-readiness-checks > .error-state { min-height: 180px; border: 0; }
.service-status-shell > footer { display: flex; min-height: 70px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 20px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--stitch-line); background: white; }
.service-status-shell > footer > span { color: var(--stitch-muted); font-size: 11px; }

.recording-check-dialog { width: min(100% - 32px, 560px); max-height: min(calc(100dvh - 40px), 760px); padding: 0; border: 0; border-radius: 10px; background: var(--white); color: var(--stitch-ink); box-shadow: var(--shadow-dialog); }
.recording-check-dialog::backdrop { background: rgba(16, 35, 61, 0.38); }
.recording-check-shell { display: flex; max-height: min(calc(100dvh - 40px), 760px); flex-direction: column; }
.recording-check-shell > header { display: flex; min-height: 72px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--stitch-line); }
.recording-check-shell > header p { margin: 0; color: var(--stitch-green); font-size: 11px; font-weight: 700; }
.recording-check-shell > header h2 { margin: 2px 0 0; font-size: 20px; }
.recording-check-summary { flex: 0 0 auto; padding: 20px; border-bottom: 1px solid var(--stitch-line); background: var(--stitch-green-soft); }
.recording-check-summary > span { color: var(--stitch-green); font-size: 11px; font-weight: 750; }
.recording-check-summary h3 { margin: 5px 0 0; font-size: 21px; }
.recording-check-summary p { margin: 5px 0 0; color: var(--stitch-muted); font-size: 13px; line-height: 1.55; }
.recording-check-summary.warning { background: var(--amber-soft); }
.recording-check-summary.warning > span { color: #8a4d08; }
.recording-check-summary.failed { background: var(--coral-soft); }
.recording-check-summary.failed > span { color: var(--danger); }
.recording-check-list { min-height: 0; overflow-y: auto; padding: 0 20px; }
.recording-check-row { display: grid; min-height: 68px; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--stitch-line); }
.recording-check-row > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--stitch-green-soft); color: var(--stitch-green); }
.recording-check-row > span .icon { width: 16px; height: 16px; }
.recording-check-row.warning > span { background: var(--amber-soft); color: #9b5b0b; }
.recording-check-row.fail > span { background: var(--coral-soft); color: var(--danger); }
.recording-check-row > div { min-width: 0; }
.recording-check-row strong { display: block; font-size: 13px; }
.recording-check-row p { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--stitch-muted); font-size: 11px; line-height: 1.5; }
.recording-check-row b { padding: 4px 7px; border-radius: 6px; background: var(--stitch-green-soft); color: var(--stitch-green); font-size: 10px; }
.recording-check-row.warning b { background: var(--amber-soft); color: #8a4d08; }
.recording-check-row.fail b { background: var(--coral-soft); color: var(--danger); }
.recording-check-shell > footer { display: flex; min-height: 70px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 20px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--stitch-line); background: var(--white); }
.recording-check-shell > footer > span { color: var(--stitch-muted); font-size: 11px; }
.recording-check-shell > footer > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.recording-check-shell > footer .btn { min-height: 40px; padding-inline: 10px; font-size: 12px; }

@media (max-width: 760px) {
  .topbar { position: fixed; inset: 0 0 auto; z-index: 40; width: 100%; min-height: calc(72px + var(--safe-top)); padding-top: calc(12px + var(--safe-top)); }
  .organization-name,
  .topbar-actions { display: none; }
  .workspace-nav { display: none; }
  #page-elders { padding-top: calc(102px + var(--safe-top)); }
  #page-review { padding-top: calc(96px + var(--safe-top)); }
  #page-elders .page-heading-row { position: static; }
  #page-elders .page-count { display: block; }
  #newElderBtn { position: fixed; top: calc(14px + var(--safe-top)); right: 20px; z-index: 45; }
  .archive-list { grid-template-columns: 1fr; }
  .review-mode-toolbar { margin: 14px 0 22px; overflow-x: auto; scrollbar-width: none; }
  .review-mode-toolbar::-webkit-scrollbar { display: none; }
  .review-mode-control { min-width: 100%; }
  .review-mode-control button { min-width: 0; flex: 1; }
  .review-section-heading { align-items: flex-start; }
  .transcript-review-live-status { padding-top: 1px; white-space: nowrap; }
  .transcript-review-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .transcript-review-filters select,
  .transcript-review-search { font-size: 16px; }
  .transcript-review-search { grid-column: 1 / -1; }
  .transcript-review-clear { justify-self: end; }
  .transcript-review-progress { padding-top: 14px; }
  .transcript-review-summary { grid-template-columns: 1fr 1fr; }
  .transcript-review-summary > div:nth-child(2) { border-right: 0; }
  .transcript-review-summary > div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .transcript-review-row { grid-template-columns: minmax(0, 1fr) auto; gap: 9px 12px; padding: 16px 0; }
  .transcript-review-person { grid-column: 1; grid-row: 1; }
  .transcript-review-source { grid-column: 2; grid-row: 1; text-align: right; }
  .transcript-review-copy { grid-column: 1 / -1; grid-row: 2; }
  .transcript-review-meta { grid-column: 1; grid-row: 3; text-align: left; }
  .transcript-review-claim-status { margin-left: 0; }
  .transcript-review-row > .btn { grid-column: 2; grid-row: 3; min-width: 0; }
  .service-status-dialog { width: 100%; max-width: 100%; max-height: calc(92dvh - var(--safe-top)); margin: auto auto 0; border: 0; border-radius: 18px 18px 0 0; }
  .service-status-shell { max-height: calc(92dvh - var(--safe-top)); }
  .recording-check-dialog { width: 100%; max-width: 100%; max-height: calc(92dvh - var(--safe-top)); margin: auto auto 0; border-radius: 18px 18px 0 0; }
  .recording-check-shell { max-height: calc(92dvh - var(--safe-top)); }
  .recording-check-summary { padding: 18px 20px; }
  .recording-check-row { min-height: 66px; }
  .recording-check-shell > footer { align-items: flex-start; flex-direction: column; }
  .recording-check-shell > footer > div { width: 100%; }
  .recording-check-shell > footer .btn { flex: 1; }
  .service-readiness-summary { padding: 18px 20px; }
  .service-readiness-row { min-height: 66px; }
  .service-status-shell > footer { padding-bottom: calc(12px + var(--safe-bottom)); }
  .memoir-page { padding-bottom: calc(106px + var(--safe-bottom)); }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 25;
    display: flex;
    width: 100%;
    min-height: calc(76px + var(--safe-bottom));
    align-items: stretch;
    margin: 0;
    padding: 8px 20px var(--safe-bottom);
    border-top: 1px solid var(--stitch-line);
    border-radius: 16px 16px 0 0;
    background: rgba(255,255,255,.98);
    box-shadow: 0 -4px 20px rgba(16,35,61,.05);
  }
  .mobile-nav button {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 58px;
    flex: 1 1 0;
    place-content: center;
    justify-items: center;
    gap: 2px;
    margin: 0;
    padding: 4px;
    border: 0;
    border-radius: 14px;
    appearance: none;
    background: transparent;
    color: var(--stitch-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 680;
    line-height: 1.2;
    text-align: center;
    -webkit-appearance: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .mobile-nav button[hidden] { display: none; }
  .mobile-nav button.active { background: var(--stitch-green-soft); color: var(--stitch-green); }
  .mobile-nav .icon { width: 21px; height: 21px; pointer-events: none; }
  .mobile-nav button span { display: block; pointer-events: none; }
  .page { padding-inline: 20px; }
  .focus-mode .page { padding: 20px 20px calc(34px + var(--safe-bottom)); }
  .session-header,
  .memoir-header,
  #page-magic > .subpage-header { margin-top: -20px; }
  .record-panel { min-height: 470px; padding-inline: 0; }
  .record-status { max-width: none; justify-self: center; white-space: nowrap; }
  .record-waveform { gap: 5px; }
  .record-waveform i { width: 4px; }
  .record-timer { font-size: 38px; }
  .question-panel h1 { font-size: 24px; }
  .assistant-recording-hero { min-height: 500px; }
  .memoir-actions { grid-template-columns: 46px 46px minmax(0,1fr); }
  .memoir-review-cta { font-size: 16px; }
  .transcript-compare-grid { grid-template-columns: 1fr; gap: 22px; }
  .transcript-original-panel > div:last-child,
  .transcript-edit-panel textarea { min-height: 360px; }
  .login-dialog form { margin-top: 70px; }
  .onboarding-visual { min-height: 240px; }
  .onboarding-portrait { width: 92px; height: 128px; }
  .onboarding-body ol { grid-template-columns: 1fr; }
  .onboarding-body li { min-height: 0; }
  .onboarding-footer { align-items: stretch; flex-direction: column; }
  .onboarding-guide-link { width: 100%; }
  .client-guide-header { gap: 8px; padding-inline: 14px; }
  .client-guide-actions .btn { width: auto; min-width: 44px; padding: 0 10px; font-size: 12px; }
}

@media (max-width: 430px) {
  .page-heading-row h1 { font-size: 26px; }
  #newElderBtn { width: auto; min-width: 44px; padding: 0 13px; font-size: 13px; }
  #newElderBtn .icon { width: 20px; height: 20px; }
  .archive-toolbar { margin-right: -20px; padding-right: 20px; }
  .segmented-control { width: max-content; min-width: max-content; }
  .segmented-control button { min-width: 86px; }
  .review-mode-control { width: 100%; min-width: 100%; }
  .review-mode-control button { min-width: 0; flex: 1; padding-inline: 8px; white-space: nowrap; }
  .elder-row { min-height: 250px; padding: 20px; }
  .weekly-plan-card { grid-template-columns: 1fr; }
  .record-panel { min-height: 440px; gap: 22px; padding-top: 34px; }
  .record-waveform i:nth-child(even) { display: block; }
  .record-waveform i { width: 3px; }
  .record-controls { grid-template-columns: 1fr 96px 1fr; gap: 18px; }
  .record-btn { width: 94px; height: 94px; }
  .record-core { width: 62px; height: 62px; }
  .record-side-control > span:first-child { width: 50px; height: 50px; }
  .record-timer { font-size: 34px; letter-spacing: 3px; }
  .assistant-recording-hero { min-height: 370px; padding-inline: 16px; }
  .assistant-wave-orbit { width: 170px; height: 170px; }
  .assistant-wave-art { width: 140px; height: 140px; }
  .assistant-drawer { max-height: 58dvh; }
  .assistant-record-controls { width: calc(100% - 40px); grid-template-columns: 64px 104px 64px; }
  .assistant-control-btn { width: 64px; height: 64px; }
  .assistant-record-btn { width: 100px; height: 100px; }
  .memoir-cover { grid-template-columns: 74px minmax(0,1fr); gap: 16px; padding: 20px; }
  .memoir-avatar { width: 70px; height: 70px; }
  .memoir-insight { padding: 24px; }
  .memoir-insight > div { gap: 16px; }
  .memoir-insight > div > span { min-width: 94px; }
  .memoir-insight > div > span + span { padding-left: 16px; }
  #elderDialog form,
  #consentDialog form,
  #transcriptDialog form,
  #pendingQueueDialog form { padding-inline: 20px; }
  #elderDialog .dialog-header,
  #consentDialog .dialog-header,
  #transcriptDialog .dialog-header,
  #pendingQueueDialog .dialog-header { margin-inline: -20px; padding-inline: 20px; }
  .dialog-form-card { padding: 24px; }
  .transcript-sticky-actions { margin-inline: -20px; padding-inline: 20px; }
  .login-topbar { min-height: 80px; padding: 18px 24px; }
  .login-dialog form { width: calc(100% - 40px); margin-top: 56px; padding: 26px 22px 30px; }
  .login-brand h1 { font-size: 30px; }
  .login-footnote { margin-top: 34px; }
  .onboarding-shell { padding-inline: 20px; }
  .onboarding-visual { min-height: 220px; }
  .onboarding-portrait { width: 112px; height: 158px; }
  .onboarding-body ol { gap: 12px; }
  .onboarding-body li { padding: 15px; }
}

@media (max-width: 360px) {
  #newElderBtn span { display: none; }
  .segmented-control button { min-width: 82px; padding-inline: 12px; }
  .record-waveform { gap: 4px; }
  .record-controls { gap: 10px; }
  .record-side-control { font-size: 11px; }
  .memoir-cover { grid-template-columns: 64px minmax(0,1fr); }
  .memoir-avatar { width: 62px; height: 62px; }
  .memoir-actions { grid-template-columns: 42px 42px minmax(0,1fr); }
  .memoir-actions .btn-secondary { width: 42px; }
  .dialog-form-card { padding: 20px; }
  .login-topbar span { font-size: 18px; }
  .onboarding-portrait { width: 98px; }
}

/* V41: strict Stitch reference clone. Business controls remain intact. */
.elder-avatar,
.consent-profile-avatar,
.memoir-avatar,
.assistant-wave-art {
  overflow: hidden;
}

.elder-avatar img,
.consent-profile-avatar img,
.memoir-avatar img,
.assistant-wave-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.elder-avatar {
  flex: 0 0 64px;
  padding: 0;
}

.elder-avatar img {
  border-radius: inherit;
}

.consent-profile-avatar {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  border: 0;
  background: transparent;
}

.consent-profile-avatar img {
  border-radius: 50%;
}

.memoir-avatar {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.memoir-avatar img {
  border-radius: 50%;
}

.assistant-wave-orbit {
  width: 240px;
  height: 240px;
  background: rgba(232, 248, 240, 0.72);
}

.assistant-wave-art {
  width: 180px;
  height: 180px;
  padding: 0;
  background: white;
}

.assistant-wave-art img {
  border-radius: 50%;
  transition: transform 90ms linear, filter 120ms linear;
  will-change: transform, filter;
}

.assistant-recording-hero.recording:not(.audio-reactive) .assistant-wave-art img {
  animation: stitchSoundPulse 1.7s ease-in-out infinite;
}

@keyframes stitchSoundPulse {
  50% { transform: scale(1.045); filter: saturate(1.12); }
}

.onboarding-visual {
  isolation: isolate;
  min-height: 472px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.72);
}

.onboarding-visual::before {
  content: "";
  position: absolute;
  inset: 20px 38px;
  z-index: -1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
}

.onboarding-reference-image {
  display: block;
  width: 272px;
  height: auto;
  max-height: 430px;
  object-fit: contain;
  border: 1px solid rgba(219, 226, 232, 0.55);
  border-radius: 10px;
  background: white;
  box-shadow: 0 14px 38px rgba(16, 35, 61, 0.12);
}

.onboarding-chip.warm {
  top: 32px;
  right: 36px;
}

.onboarding-chip.pro {
  bottom: 58px;
  left: 34px;
}

#page-elders .page-count {
  margin-top: 4px;
  font-size: 12px;
}

.elder-row {
  min-height: 0;
  padding: 20px;
}

.elder-card-top {
  min-height: 64px;
  margin-bottom: 16px;
}

.elder-copy {
  margin-top: 0;
}

.elder-progress {
  min-height: 18px;
  margin-top: 6px;
}

.elder-card-footer {
  min-height: 42px;
  margin-top: 18px;
  padding-top: 12px;
}

.elder-row-actions .btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.elder-row-actions .btn span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.elder-row-actions .elder-primary-action {
  background: transparent;
  color: var(--stitch-green);
}

.elder-row-actions .elder-memoir-action {
  background: transparent;
  color: var(--stitch-weak);
}

.elder-role-markers span {
  width: 32px;
  height: 32px;
}

.archive-add-tile,
.weekly-plan-card {
  border-radius: 24px;
}

.session-strip {
  padding-block: 8px;
  color: var(--stitch-muted);
  font-size: 12px;
}

.resume-panel {
  background: rgba(255, 255, 255, 0.72);
}

.record-panel {
  min-height: 470px;
  gap: 20px;
  padding-top: 34px;
  padding-bottom: 24px;
}

.record-waveform {
  height: 128px;
}

.record-controls {
  grid-template-columns: 1fr 76px 1fr;
  gap: 36px;
}

.record-btn {
  width: 76px;
  height: 76px;
}

.record-core {
  width: 54px;
  height: 54px;
}

.record-core .icon {
  width: 31px;
  height: 31px;
}

.question-panel h1 {
  font-size: 20px;
  line-height: 1.55;
}

.assistant-recording-hero {
  min-height: 500px;
  margin-top: 24px;
  padding: 38px 24px;
}

.assistant-recording-hero h2 {
  margin-top: 20px;
  font-size: 18px;
}

.assistant-recording-hero p {
  max-width: 430px;
  text-align: center;
}

.assistant-drawer {
  border-radius: 30px 30px 0 0;
}

.transcript-original-panel > div:last-child,
.transcript-edit-panel textarea {
  overflow-y: auto;
}

.pending-queue-row {
  min-height: 196px;
}

.login-mark {
  display: grid;
  place-items: center;
  background: var(--stitch-green-soft);
  color: var(--stitch-green);
}

.login-mark .icon {
  width: 38px;
  height: 38px;
}

.login-dialog > .login-brand {
  display: flex;
  width: min(calc(100% - 48px), 630px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  margin: 110px auto 0;
  text-align: center;
}

.login-dialog > .login-brand .login-mark {
  width: 92px;
  height: 92px;
  border-radius: 24px;
}

.login-dialog > .login-brand .login-mark .icon {
  width: 46px;
  height: 46px;
}

.login-dialog > .login-brand h1 {
  color: var(--stitch-ink);
  font-size: 38px;
  line-height: 46px;
}

.login-dialog > .login-brand p {
  max-width: 540px;
  margin-top: 6px;
  color: var(--stitch-muted);
  font-size: 18px;
  line-height: 1.75;
}

.login-dialog > .login-brand + form {
  margin-top: 44px;
}

@media (min-width: 761px) {
  #page-elders .archive-add-tile {
    width: calc(50% - 8px);
  }
}

@media (max-width: 760px) {
  #page-elders .page-count {
    display: none;
  }

  .archive-list {
    gap: 16px;
  }

  .elder-row {
    min-height: 214px;
  }

  .elder-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .elder-row-actions {
    gap: 2px;
  }

  .archive-add-tile {
    min-height: 180px;
  }

  .focus-mode:has(#page-session.active) .mobile-nav,
  .focus-mode:has(#page-memoir.active) .mobile-nav {
    display: flex !important;
  }

  .focus-mode:has(#page-session.active) #page-session,
  .focus-mode:has(#page-memoir.active) #page-memoir {
    padding-bottom: calc(112px + var(--safe-bottom));
  }

  .focus-mode:has(#page-memoir.active) #page-memoir {
    padding-bottom: calc(188px + var(--safe-bottom));
  }

  .focus-mode:has(#page-memoir.active) .memoir-actions {
    bottom: calc(88px + var(--safe-bottom));
  }

  .record-panel {
    min-height: 430px;
  }

  .record-controls {
    grid-template-columns: 1fr 76px 1fr;
    gap: 28px;
  }

  .assistant-recording-hero {
    min-height: 464px;
  }

  .assistant-wave-orbit {
    width: 226px;
    height: 226px;
  }

  .assistant-wave-art {
    width: 166px;
    height: 166px;
  }

  .onboarding-visual {
    min-height: 390px;
  }

  .onboarding-reference-image {
    width: 228px;
    max-height: 370px;
  }

  .onboarding-chip.warm {
    top: 22px;
    right: 8px;
  }

  .onboarding-chip.pro {
    bottom: 38px;
    left: 4px;
  }
}

@media (max-width: 430px) {
  .topbar {
    min-height: calc(68px + var(--safe-top));
  }

  #page-elders {
    padding-top: calc(96px + var(--safe-top));
  }

  .brand-button {
    font-size: 19px;
  }

  .search-field {
    height: 54px;
    margin-top: 22px;
  }

  .archive-toolbar {
    margin-bottom: 24px;
  }

  .elder-row {
    min-height: 210px;
  }

  .weekly-plan-card {
    min-height: 166px;
  }

  .record-panel {
    min-height: 412px;
    gap: 18px;
    padding-top: 24px;
  }

  .record-waveform {
    height: 108px;
  }

  .record-controls {
    grid-template-columns: 1fr 76px 1fr;
    gap: 24px;
  }

  .record-btn {
    width: 76px;
    height: 76px;
  }

  .record-core {
    width: 54px;
    height: 54px;
  }

  .assistant-recording-hero {
    min-height: 390px;
  }

  .assistant-wave-orbit {
    width: 200px;
    height: 200px;
  }

  .assistant-wave-art {
    width: 154px;
    height: 154px;
  }

  .memoir-avatar {
    width: 72px;
    height: 72px;
  }

  .consent-profile-card {
    gap: 18px;
    padding: 22px;
  }

  .consent-profile-avatar {
    width: 78px;
    height: 78px;
    flex-basis: 78px;
  }

  .onboarding-brandbar {
    min-height: 76px;
  }

  .onboarding-steps {
    gap: 8px;
    margin-bottom: 18px;
  }

  .onboarding-visual {
    min-height: 332px;
  }

  .onboarding-reference-image {
    width: 190px;
    max-height: 320px;
  }

  .onboarding-chip {
    padding: 7px 10px;
    font-size: 11px;
  }

  .onboarding-chip.warm {
    top: 18px;
    right: 0;
  }

  .onboarding-chip.pro {
    bottom: 28px;
    left: 0;
  }

  .onboarding-title-block {
    margin-top: 20px;
  }

  .onboarding-title-block h2 {
    font-size: 27px;
    line-height: 35px;
  }

  .login-dialog form {
    margin-top: 34px;
  }

  .login-dialog > .login-brand {
    gap: 18px;
    margin-top: 56px;
  }

  .login-dialog > .login-brand .login-mark {
    width: 76px;
    height: 76px;
    border-radius: 20px;
  }

  .login-dialog > .login-brand .login-mark .icon {
    width: 38px;
    height: 38px;
  }

  .login-dialog > .login-brand h1 {
    font-size: 31px;
    line-height: 39px;
  }

  .login-dialog > .login-brand p {
    font-size: 15px;
  }
}

@media (max-width: 360px) {
  .onboarding-reference-image {
    width: 172px;
  }

  .onboarding-chip {
    font-size: 10px;
  }
}
