:root {
  --ink: #102f35;
  --muted: #718487;
  --line: #dce6e4;
  --surface: #ffffff;
  --canvas: #f3f7f6;
  --teal: #0b756e;
  --teal-dark: #075c57;
  --teal-soft: #e7f3f1;
  --blue: #3572c6;
  --violet: #7656b6;
  --amber: #b96726;
  --amber-soft: #fff2e6;
  --red: #b43d35;
  --shadow: 0 14px 40px rgba(21, 59, 61, 0.1);
}

* { box-sizing: border-box; }

html { background: #dfe8e6; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(255,255,255,.95), transparent 35%),
    #dfe8e6;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
button, .task-card { -webkit-tap-highlight-color: transparent; }

.app-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  overflow: hidden;
  background: var(--canvas);
  box-shadow: 0 0 60px rgba(18, 51, 54, .14);
}
.topbar { order: 1; }
.page-intro { order: 2; }
.status-grid { order: 3; }
.capture-preview-block { order: 4; }
.intelligence-card { order: 5; }
.smart-actions-block { order: 6; }
.workflow-block { order: 7; }
.bottom-spacer { order: 8; }
.voice-fab, .bottom-nav { order: 9; }

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 8px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid rgba(205, 221, 218, .8);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 34px;
  height: 34px;
  position: relative;
  display: grid;
  place-items: center;
}
.brand-mark span {
  position: absolute;
  width: 13px;
  height: 22px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  transform-origin: center;
}
.brand-mark span:nth-child(2) { transform: rotate(60deg); }
.brand-mark span:nth-child(3) { transform: rotate(120deg); }

.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { letter-spacing: -.02em; font-size: 17px; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 8px; letter-spacing: .16em; font-weight: 800; }

.icon-button, .avatar, .scan-button, .plain-button, .text-action, .nav-item, .ai-action-card, .smart-action-card, .capture-preview-card, .capture-continue, .dialogue-back, .dialogue-record-button {
  border: 0;
  background: transparent;
  color: inherit;
}

.notification-button {
  margin-left: auto;
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
}
.notification-button svg, .scan-button svg, .nav-item svg, .chevron, .text-action svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notification-dot {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--red);
  border: 2px solid white;
  border-radius: 9px;
  font-size: 9px;
  font-weight: 800;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #234b54, #0b756e);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 5px 12px rgba(11,117,110,.2);
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 28px 20px 20px;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .12em;
}
.page-intro h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -.025em;
  font-weight: 600;
}
.page-intro > div > p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.case-stage-pill {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 9px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 8px;
  font-size: 8px;
  font-weight: 850;
}
.scan-button {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--teal);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(25, 60, 63, .07);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 20px 20px;
}
.status-card {
  min-width: 0;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  text-align: left;
  transition: .2s ease;
}
.status-card.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 10px 22px rgba(11, 117, 110, .22);
}
.status-card.alert:not(.active) { border-color: #edc9a9; }
.status-label { font-size: 10px; font-weight: 750; white-space: nowrap; opacity: .82; }
.status-card strong { margin-top: 4px; font-family: Georgia, serif; font-size: 24px; line-height: 1; }
.status-card small { margin-top: 3px; font-size: 10px; opacity: .65; }

.intelligence-card {
  margin: 0 20px 28px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(245,251,249,.96)),
    var(--surface);
  border: 1px solid #badbd5;
  border-radius: 21px;
  box-shadow: var(--shadow);
}
.intelligence-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}
.intelligence-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 13px;
}
.intelligence-icon svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.intelligence-heading .eyebrow { margin-bottom: 3px; font-size: 8px; }
.intelligence-heading h2, .section-heading h2, .bottom-sheet h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.02em;
}
.priority-pill {
  margin-left: auto;
  padding: 6px 8px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.intelligence-summary {
  margin: 15px 0 16px;
  color: #4c6366;
  font-size: 13px;
  line-height: 1.5;
}
.intelligence-summary strong { color: var(--ink); }
.embryo-chain {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 12px;
  background: #f1f7f5;
  border-radius: 14px;
}
.embryo-chain div { display: flex; flex-direction: column; align-items: center; }
.embryo-chain strong { font-family: Georgia, serif; font-size: 18px; }
.embryo-chain span { margin-top: 2px; color: var(--muted); font-size: 8px; }
.embryo-chain i { width: 17px; height: 1px; background: #b8cbc7; position: relative; }
.embryo-chain i::after {
  content: "";
  position: absolute;
  right: 0;
  top: -2px;
  border-left: 4px solid #b8cbc7;
  border-top: 2.5px solid transparent;
  border-bottom: 2.5px solid transparent;
}
.embryo-chain .chain-alert strong { color: var(--amber); }
.compact-chain { margin-top: 14px; }
.ai-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ai-action-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: #f4faf8;
  border: 1px solid #d8e8e5;
  border-radius: 13px;
  text-align: left;
}
.ai-action-card.alert-card {
  background: var(--amber-soft);
  border-color: #edc9a9;
}
.ai-action-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 900;
}
.ai-action-icon.amber { color: var(--amber); background: var(--amber-soft); }
.ai-action-icon.blue { color: var(--blue); background: #eaf2fd; }
.ai-action-icon.teal { color: var(--teal); background: var(--teal-soft); }
.ai-action-card strong { font-size: 11px; }
.ai-action-card small {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}
.text-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 12px;
  padding: 4px 0 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}
.text-action svg { width: 16px; }

.section-block { padding: 0 20px 26px; }
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-heading .eyebrow { margin-bottom: 4px; font-size: 8px; }
.section-heading h2 { font-size: 20px; }
.plain-button { padding: 5px 0; color: var(--teal); font-size: 11px; font-weight: 800; }

.smart-actions-block { padding-bottom: 24px; }
.smart-action-list { display: flex; flex-direction: column; gap: 8px; }
.smart-action-card {
  width: 100%;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  text-align: left;
}
.action-rank {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
}
.smart-action-card h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: -.01em;
}
.smart-action-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}
.action-kind {
  padding: 5px 7px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 7px;
  font-size: 8px;
  font-weight: 850;
}

.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-card {
  width: 100%;
  min-height: 110px;
  display: grid;
  grid-template-columns: 54px 1px 1fr 18px;
  align-items: stretch;
  gap: 12px;
  padding: 14px;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  text-align: left;
  box-shadow: 0 6px 15px rgba(24, 58, 61, .035);
}
.task-time { display: flex; flex-direction: column; align-items: flex-start; }
.task-time strong { font-size: 14px; }
.task-time span { margin-top: 7px; color: var(--teal); font-size: 8px; font-weight: 800; line-height: 1.2; }
.task-time .attention-text { color: var(--amber); }
.task-line { width: 1px; background: var(--line); }
.task-copy { min-width: 0; }
.task-title-row { display: flex; align-items: center; gap: 10px; }
.task-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
}
.task-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.task-icon.blue { color: var(--blue); background: #eaf2fd; }
.task-icon.violet { color: var(--violet); background: #f0ecf8; }
.task-icon.teal { color: var(--teal); background: var(--teal-soft); }
.task-card h3 { margin: 0; font-size: 13px; letter-spacing: -.01em; }
.task-card p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.progress { height: 4px; margin: 13px 0 5px; overflow: hidden; background: #e5eceb; border-radius: 3px; }
.progress span { display: block; height: 100%; background: var(--teal); border-radius: inherit; }
.task-copy > small { color: var(--muted); font-size: 8px; }
.micro-alert {
  display: inline-block;
  margin-top: 13px;
  padding: 5px 7px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 6px;
  font-size: 8px;
  font-weight: 800;
}
.task-tags { display: flex; gap: 5px; margin-top: 13px; }
.task-tags span { padding: 5px 7px; color: var(--teal-dark); background: var(--teal-soft); border-radius: 6px; font-size: 8px; font-weight: 750; }
.chevron { align-self: center; width: 17px; color: #8ca09e; }

.count-badge {
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 13px;
  font-size: 11px;
  font-weight: 850;
}
.capture-preview-block { padding-bottom: 26px; }
.voice-operation-picker {
  margin-bottom: 10px;
  padding: 12px;
  background: #edf6f4;
  border: 1px solid #cfe2df;
  border-radius: 16px;
}
.voice-operation-picker > p {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
}
.voice-operation-picker > p strong { font-size: 12px; }
.voice-operation-picker > p span { color: var(--muted); font-size: 10px; }
.voice-operation-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.voice-operation {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 7px;
  row-gap: 2px;
  padding: 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d9e7e4;
  border-radius: 11px;
  text-align: left;
}
.voice-operation > span {
  grid-row: 1 / span 2;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 900;
}
.voice-operation strong { font-size: 11px; }
.voice-operation small { color: var(--muted); font-size: 9px; line-height: 1.25; }
.voice-operation.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 7px 16px rgba(11,117,110,.18);
}
.voice-operation.active > span { color: var(--teal); background: #fff; }
.voice-operation.active small { color: rgba(255,255,255,.76); }
.capture-preview-card {
  width: 100%;
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid #cfe2df;
  border-radius: 17px;
  box-shadow: 0 8px 20px rgba(24, 58, 61, .04);
  text-align: left;
}
.capture-dialogue-page {
  position: relative;
  min-height: calc(100vh - 116px);
  padding-bottom: 112px;
  align-content: start;
}
.dialogue-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 2px;
}
.dialogue-back {
  min-width: 74px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid #cfe2df;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 850;
}
.dialogue-back svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dialogue-header div {
  display: grid;
  gap: 2px;
}
.dialogue-header strong {
  font-size: 16px;
  letter-spacing: -.02em;
}
.dialogue-header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.capture-actions { display: grid; grid-template-columns: 1fr 84px 1.2fr; align-items: center; gap: 8px; }
.capture-continue, .capture-edit, .capture-upload {
  padding: 11px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 850;
}
.capture-continue { color: #22626a; background: #edf6f4; border: 1px solid #cfe2df; }
.capture-edit { color: var(--teal); background: #fff; border: 1px solid #cfe2df; }
.capture-upload { color: #fff; background: var(--teal); border: 1px solid var(--teal); }
.capture-continue:disabled,
.capture-edit:disabled,
.capture-upload:disabled { color: var(--teal); background: var(--teal-soft); border-color: transparent; }
.transcript-bubble {
  padding: 12px;
  background: #edf6f4;
  border-radius: 13px;
}
.transcript-bubble span {
  display: block;
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.transcript-bubble p {
  margin: 0;
  color: #405b5e;
  font-size: 12px;
  line-height: 1.45;
}
.voice-dialogue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
  padding: 2px;
}
/* Two-way chat bubbles: user on the right, assistant on the left. */
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.chat-row--user { justify-content: flex-end; }
.chat-row--assistant { justify-content: flex-start; }
.chat-avatar {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #eaf2ef;
  color: #4a6b6f;
  font-size: 9px;
  font-weight: 800;
  display: grid;
  place-items: center;
  text-transform: uppercase;
}
.chat-row--user .chat-avatar { background: #d4ebe1; color: #2f6b4f; }
.chat-bubble {
  max-width: 76%;
  padding: 7px 10px;
  border-radius: 14px;
  font-size: 11px;
  line-height: 1.4;
}
.chat-row--user .chat-bubble {
  background: #e7f6ee;
  color: #1f4a36;
  border-bottom-right-radius: 4px;
}
.chat-row--assistant .chat-bubble {
  background: #eef3f6;
  color: #3a4a52;
  border-bottom-left-radius: 4px;
}
.chat-bubble__tag {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 2px;
}
.chat-bubble__body { word-break: break-word; }
/* Typing indicator shown while the assistant is parsing. */
.chat-typing { display: inline-flex; gap: 3px; align-items: center; }
.chat-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6f8893;
  display: inline-block;
  animation: chat-typing 1.1s infinite ease-in-out;
}
.chat-typing i:nth-child(2) { animation-delay: 0.15s; }
.chat-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}
.parse-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  margin-top: 7px;
  border: 1px solid #d8e8f3;
  border-radius: 12px;
  background: #f3f9fd;
  color: #1f5f7a;
  font-size: 11px;
  font-weight: 700;
}
.parse-status[hidden] { display: none; }
.parse-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid #bcdcec;
  border-top-color: #2f8fc4;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  animation: parse-spin 0.8s linear infinite;
}
.parse-status.is-error {
  border-color: #f0c9c0;
  background: #fdf2ef;
  color: #9a3b1c;
}
.parse-status.is-error .parse-spinner { display: none; }
@keyframes parse-spin { to { transform: rotate(360deg); } }
.missing-field-alert {
  padding: 10px 11px;
  color: #8a4f18;
  background: var(--amber-soft);
  border: 1px solid #f1d4ba;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.field-grid span {
  padding: 8px;
  color: var(--ink);
  background: #f8fbfa;
  border: 1px solid #e1ebe9;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
}
.field-grid strong {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.field-grid .field-warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f1d4ba;
}
.parsed-record-list {
  display: grid;
  gap: 7px;
}
.parsed-record-list article {
  display: grid;
  grid-template-columns: minmax(70px, .8fr) repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #f8fbfa;
  border: 1px solid #e1ebe9;
  border-radius: 12px;
  cursor: pointer;
}
.parsed-record-list strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}
.parsed-record-list span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
}
.parsed-record-list b {
  display: block;
  margin-bottom: 2px;
  color: #789094;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.parsed-record-list em {
  justify-self: end;
  min-width: 62px;
  padding: 6px 8px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  text-align: center;
}
.parsed-record-list input {
  width: 100%;
  padding: 6px 7px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfe2df;
  border-radius: 8px;
  font: inherit;
  font-weight: 850;
}
.dialogue-record-button {
  justify-self: center;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: -24px auto 0;
  color: #fff;
  background: linear-gradient(145deg, #13857c, #075f59);
  border: 6px solid #fff;
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(11,117,110,.32);
}
.dialogue-record-button svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.dialogue-record-button strong {
  margin-top: -5px;
  font-size: 10px;
}
.dialogue-record-button:disabled {
  color: var(--teal);
  background: var(--teal-soft);
  box-shadow: none;
}
.bottom-spacer { height: 105px; }

.dialogue-active .page-intro,
.dialogue-active .status-grid,
.dialogue-active .intelligence-card,
.dialogue-active .smart-actions-block,
.dialogue-active .workflow-block,
.dialogue-active .bottom-nav,
.dialogue-active .bottom-spacer {
  display: none !important;
}
.dialogue-active .capture-preview-block {
  flex: 1;
  padding-bottom: 0;
}
.dialogue-active .capture-preview-block > .section-heading {
  display: none;
}
.dialogue-active .capture-dialogue-page {
  min-height: calc(100vh - 74px);
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  box-shadow: none;
}
.dialogue-active .capture-actions {
  position: fixed;
  z-index: 35;
  left: 50%;
  bottom: 0;
  width: min(100%, 480px);
  min-height: 92px;
  transform: translateX(-50%);
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 30px rgba(27,54,56,.08);
  backdrop-filter: blur(20px);
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  width: min(100%, 480px);
  height: 78px;
  display: grid;
  grid-template-columns: 1fr 1fr 70px 1fr 1fr;
  align-items: center;
  transform: translateX(-50%);
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(27, 54, 56, .07);
  backdrop-filter: blur(20px);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #859695;
  font-size: 8px;
  font-weight: 750;
}
.nav-item svg { width: 21px; }
.nav-item.active { color: var(--teal); }

.voice-fab {
  display: none;
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 29px;
  width: 66px;
  height: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  color: #fff;
  background: linear-gradient(145deg, #13857c, #075f59);
  border: 5px solid var(--canvas);
  border-radius: 50%;
  box-shadow: 0 10px 25px rgba(11, 117, 110, .34);
}
.voice-fab svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.voice-fab > span:last-child { margin-top: 2px; font-size: 7px; font-weight: 800; }
.voice-fab { display: none !important; }

.sheet-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: rgba(5, 27, 30, .48);
  backdrop-filter: blur(3px);
}
.bottom-sheet {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 0;
  width: min(100%, 480px);
  transform: translateX(-50%);
  padding: 12px 28px 34px;
  background: #fff;
  border-radius: 28px 28px 0 0;
  text-align: center;
  box-shadow: 0 -20px 50px rgba(4, 29, 31, .2);
}
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 18px; background: #d7e1df; border-radius: 4px; }
.sheet-close { position: absolute; right: 18px; top: 18px; width: 32px; height: 32px; border: 0; border-radius: 50%; color: var(--muted); background: #f1f5f4; font-size: 22px; }
.sheet-voice-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 4px auto 16px;
  color: #fff;
  background: var(--teal);
  border-radius: 50%;
  box-shadow: 0 0 0 9px var(--teal-soft);
}
.sheet-voice-icon svg { width: 29px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.bottom-sheet .eyebrow { margin-top: 12px; }
.bottom-sheet h2 { font-size: 22px; }
.bottom-sheet > p:not(.eyebrow) { margin: 9px auto 19px; max-width: 310px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.capture-edit-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: min(52vh, 430px);
  margin: 4px 0 17px;
  padding-right: 4px;
  overflow: auto;
  text-align: left;
}
.capture-edit-fields label { color: var(--muted); font-size: 10px; font-weight: 800; }
.capture-edit-fields input {
  width: 100%;
  margin-top: 5px;
  padding: 10px;
  color: var(--ink);
  background: #f8fbfa;
  border: 1px solid #dfe9e7;
  border-radius: 9px;
  font: inherit;
}
.capture-edit-fields .missing-field input { border-color: #e2ad7f; background: var(--amber-soft); }
.waveform { height: 42px; display: flex; align-items: center; justify-content: center; gap: 5px; margin-bottom: 18px; }
.waveform span { width: 4px; height: 13px; background: var(--teal); border-radius: 4px; animation: wave 1s ease-in-out infinite; }
.waveform span:nth-child(2), .waveform span:nth-child(8) { animation-delay: .1s; height: 24px; }
.waveform span:nth-child(3), .waveform span:nth-child(7) { animation-delay: .2s; height: 34px; }
.waveform span:nth-child(4), .waveform span:nth-child(6) { animation-delay: .3s; height: 26px; }
.waveform span:nth-child(5) { animation-delay: .4s; height: 40px; }
@keyframes wave { 0%,100% { transform: scaleY(.45); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }
.stop-recording { width: 100%; padding: 15px; color: #fff; background: var(--teal); border: 0; border-radius: 14px; font-size: 13px; font-weight: 800; }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 100px;
  max-width: 330px;
  transform: translate(-50%, 20px);
  padding: 11px 15px;
  color: #fff;
  background: #173d41;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }
.filtered-out { display: none; }

@media (min-width: 768px) {
  body { padding: 24px; }
  .app-shell {
    width: min(100%, 1120px);
    min-height: calc(100vh - 48px);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
    align-content: start;
    column-gap: 24px;
    border-radius: 28px;
  }
  .topbar, .page-intro, .status-grid { grid-column: 1 / -1; }
  .topbar { padding-left: 30px; padding-right: 30px; }
  .page-intro { padding: 34px 30px 22px; }
  .page-intro h1 { font-size: 34px; }
  .status-grid { padding: 0 30px 24px; }
  .status-card { min-height: 94px; padding: 15px; }
  .capture-preview-block {
    grid-column: 1 / -1;
    grid-row: 4;
    padding-left: 30px;
    padding-right: 30px;
  }
  .capture-preview-block .voice-operation-grid { grid-template-columns: repeat(2, 1fr); }
  .capture-preview-block .capture-preview-card {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: start;
  }
  .capture-preview-block .capture-dialogue-page {
    grid-template-columns: 1fr;
  }
  .capture-preview-block .capture-actions { grid-column: 1 / -1; }
  .dialogue-active .topbar,
  .dialogue-active .capture-preview-block {
    grid-column: 1 / -1;
  }
  .dialogue-active .capture-preview-block {
    grid-row: 2;
    padding: 0;
  }
  .dialogue-active .capture-dialogue-page {
    min-height: calc(100vh - 122px);
  }
  .dialogue-active .capture-actions {
    width: min(calc(100% - 48px), 1120px);
    bottom: 24px;
    border-radius: 0 0 28px 28px;
  }
  .intelligence-card {
    grid-column: 1;
    grid-row: 5;
    margin: 0 0 28px 30px;
  }
  .smart-actions-block {
    grid-column: 2;
    grid-row: 5;
    padding: 0 30px 28px 0;
  }
  .workflow-block {
    grid-column: 1;
    grid-row: 6;
    padding-left: 30px;
    padding-right: 0;
  }
  .bottom-spacer { grid-column: 1 / -1; height: 90px; }
  .bottom-nav {
    bottom: 24px;
    width: min(calc(100% - 48px), 1120px);
    border-radius: 0 0 28px 28px;
  }
  .dialogue-active .capture-actions {
    left: max(24px, calc((100vw - 1280px) / 2));
    right: max(24px, calc((100vw - 1280px) / 2));
    width: auto;
    transform: none;
    border-radius: 0 0 28px 28px;
  }
  .voice-fab { bottom: 53px; }
  .bottom-sheet {
    left: auto;
    right: 32px;
    bottom: 32px;
    width: 430px;
    transform: none;
    border-radius: 28px;
  }
  .ai-action-card { min-height: 112px; }
  .task-card { min-height: 122px; }
}

@media (min-width: 1200px) {
  .app-shell {
    width: min(100%, 1280px);
    grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr);
    padding-left: 84px;
  }
  .bottom-nav {
    top: 24px;
    bottom: 24px;
    left: max(24px, calc((100vw - 1280px) / 2));
    width: 84px;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, 82px);
    align-content: center;
    transform: none;
    border-top: 0;
    border-right: 1px solid var(--line);
    border-radius: 28px 0 0 28px;
    box-shadow: 8px 0 24px rgba(27,54,56,.05);
  }
  .nav-gap { display: none; }
  .nav-item { font-size: 9px; }
  .nav-item svg { width: 24px; }
  .voice-fab {
    left: auto;
    right: max(42px, calc((100vw - 1280px) / 2 + 24px));
    bottom: 42px;
    transform: none;
    border-color: #fff;
  }
  .bottom-sheet { right: max(32px, calc((100vw - 1280px) / 2 + 32px)); }
}

@media (max-width: 370px) {
  .status-grid, .page-intro, .section-block { padding-left: 14px; padding-right: 14px; }
  .intelligence-card { margin-left: 14px; margin-right: 14px; }
  .status-card { padding: 8px; }
  .status-label { font-size: 8px; }
}

/* Presentation readability pass for the lab operations demo. */
.brand-copy small,
.case-stage-pill,
.intelligence-heading .eyebrow,
.section-heading .eyebrow,
.priority-pill,
.embryo-chain span,
.ai-action-card small,
.smart-action-card p,
.action-kind,
.task-time span,
.task-copy > small,
.micro-alert,
.task-tags span,
.transcript-bubble span,
.field-grid strong,
.nav-item,
.voice-fab > span:last-child {
  font-size: 10px;
}

.status-label,
.status-card small,
.plain-button,
.task-card p,
.field-grid span,
.capture-continue,
.parsed-record-list strong,
.parsed-record-list span,
.parsed-record-list em,
.parsed-record-list b,
.voice-dialogue p,
.missing-field-alert,
.toast {
  font-size: 11px;
}

.page-intro > div > p:not(.eyebrow),
.intelligence-summary,
.ai-action-card strong,
.smart-action-card h3,
.transcript-bubble p,
.bottom-sheet > p:not(.eyebrow) {
  font-size: 13px;
}

.task-card h3,
.stop-recording {
  font-size: 14px;
}

/* ---- Voice capture: recording state & ASR JSON block -------------------- */

/* Recording state on the dialogue Record button (#continueCapture). */
.dialogue-record-button.is-recording {
  background: linear-gradient(145deg, #d94545, #b02020);
  border-color: #ffe9e9;
  box-shadow: 0 0 0 6px rgba(217, 69, 69, 0.18), 0 12px 28px rgba(176, 32, 32, 0.32);
  animation: voice-record-pulse 1.1s ease-in-out infinite;
}

.dialogue-record-button.is-recording strong {
  color: #fff;
}

@keyframes voice-record-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Collapsible ASR result block, styled to match .transcript-bubble. */
.voice-json-block {
  margin-top: 7px;
  padding: 12px;
  background: var(--teal-soft, #edf6f4);
  border-radius: 13px;
}

.voice-json-block[hidden] {
  display: none;
}

.voice-json-block summary {
  list-style: none;
  cursor: pointer;
  color: var(--teal, #13857c);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  user-select: none;
}

.voice-json-block summary::-webkit-details-marker {
  display: none;
}

.voice-json-block summary::before {
  content: "▸ ";
}

.voice-json-block[open] summary::before {
  content: "▾ ";
}

.voice-json-block pre {
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
  color: #405b5e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Inline recording status chip shown in the dialogue header area. */
.recording-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 3px 9px;
  background: #fdecec;
  color: #b02020;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
}

.recording-status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d94545;
  animation: voice-record-pulse 1.1s ease-in-out infinite;
}
