:root {
  color-scheme: light;
  --ink: #17263b;
  --muted: #5a687a;
  --line: #d9e1e9;
  --paper: #ffffff;
  --canvas: #f3f6f7;
  --teal: #087f77;
  --teal-dark: #0b4744;
  --orange: #ee8b2d;
  --rose: #c94766;
  --blue: #2866b1;
  --danger: #b73545;
  --shadow: 0 14px 36px rgba(22, 45, 63, 0.1);
  font-family: Inter, ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(8, 127, 119, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(8, 127, 119, 0.05) 1px, transparent 1px),
    var(--canvas);
  background-size: 28px 28px;
}

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

button,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px max(24px, env(safe-area-inset-right)) 12px max(24px, env(safe-area-inset-left));
  color: #fff;
  background: var(--teal-dark);
  border-bottom: 5px solid var(--orange);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--teal-dark);
  background: #fff;
  font-size: 15px;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand-copy span {
  color: #bcd8d5;
  font-size: 12px;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #d8e8e6;
  font-size: 13px;
  font-weight: 750;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #f0b34c;
  box-shadow: 0 0 0 4px rgba(240, 179, 76, 0.18);
}

.service-state.is-ready .status-dot {
  background: #5fd6a4;
  box-shadow: 0 0 0 4px rgba(95, 214, 164, 0.18);
}

.service-state.is-unavailable .status-dot {
  background: #ff9a9a;
  box-shadow: 0 0 0 4px rgba(255, 154, 154, 0.18);
}

.report-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.step-rail {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.step-chip {
  min-width: 112px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #7a8795;
}

.step-chip > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid #cbd5de;
  border-radius: 50%;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.step-chip strong {
  font-size: 13px;
}

.step-chip.is-current,
.step-chip.is-complete {
  color: var(--teal-dark);
}

.step-chip.is-current > span {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.step-chip.is-complete > span {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.step-line {
  width: clamp(36px, 7vw, 90px);
  height: 2px;
  margin: 0 12px;
  background: #ccd6df;
}

.report-stage {
  min-height: 540px;
  padding: clamp(24px, 4vw, 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 7px solid var(--teal);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.report-stage[hidden] {
  display: none;
}

.stage-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.stage-heading h1,
.completion-stage h1 {
  max-width: 800px;
  margin: 5px 0 10px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.06;
  letter-spacing: 0;
}

.compact-heading h1 {
  font-size: clamp(27px, 3.4vw, 40px);
}

.stage-heading > p:not(.eyebrow),
.completion-stage > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.details-form {
  max-width: 860px;
}

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

.form-grid label,
.review-editor {
  display: grid;
  gap: 7px;
}

.form-grid label > span,
.review-editor > span {
  color: #34445a;
  font-size: 13px;
  font-weight: 850;
}

.form-wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  border: 1px solid #bfcbd7;
  border-radius: 6px;
  background: #fff;
  outline: none;
}

input,
select {
  min-height: 48px;
  padding: 0 13px;
}

textarea {
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
summary:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 102, 177, 0.18);
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 18px 0 12px;
  color: #46566a;
  font-size: 13px;
  line-height: 1.5;
}

.consent-row input {
  width: 20px;
  min-height: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 1px 0 0;
}

.collection-notice {
  margin-bottom: 20px;
  border: 1px solid #d6dee6;
  border-radius: 6px;
  background: #f8fafb;
}

.collection-notice summary {
  padding: 12px 14px;
  color: #34445a;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.collection-notice > div {
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.collection-notice p {
  margin: 7px 0;
}

.primary-command,
.secondary-command {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 850;
}

.primary-command {
  color: #fff;
  background: var(--teal);
}

.primary-command:hover:not(:disabled) {
  background: #066b65;
}

.primary-command:disabled {
  color: #87919c;
  background: #dfe5e8;
}

.secondary-command {
  color: var(--ink);
  border-color: #c8d3dc;
  background: #fff;
}

.primary-command svg,
.secondary-command svg {
  width: 18px;
  height: 18px;
}

.form-error {
  margin: 12px 0;
  padding: 10px 12px;
  color: #8f2233;
  border-left: 4px solid var(--danger);
  background: #fff2f4;
  font-size: 13px;
  font-weight: 750;
}

.record-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 1.14fr);
  gap: 24px;
  align-items: stretch;
}

.record-console {
  min-width: 0;
}

.recorder {
  min-height: 292px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid #d5dfe5;
  border-radius: 8px;
  background: #f4f9f8;
}

.timer {
  min-width: 122px;
  color: var(--teal-dark);
  font-variant-numeric: tabular-nums;
  font-size: 36px;
  font-weight: 900;
  text-align: center;
}

.sound-meter {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sound-meter span {
  width: 6px;
  height: 8px;
  border-radius: 3px;
  background: #a5c7c4;
}

.recorder.is-recording .sound-meter span {
  background: var(--rose);
  animation: pulse-level 0.8s ease-in-out infinite alternate;
}

.recorder.is-recording .sound-meter span:nth-child(2),
.recorder.is-recording .sound-meter span:nth-child(6) {
  animation-delay: 0.15s;
}

.recorder.is-recording .sound-meter span:nth-child(3),
.recorder.is-recording .sound-meter span:nth-child(5) {
  animation-delay: 0.28s;
}

.recorder.is-recording .sound-meter span:nth-child(4) {
  animation-delay: 0.4s;
}

@keyframes pulse-level {
  from { height: 8px; }
  to { height: 34px; }
}

.record-button {
  width: 98px;
  height: 98px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: #fff;
  border: 7px solid #d7edeb;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 8px 20px rgba(8, 127, 119, 0.22);
}

.record-button:hover:not(:disabled) {
  background: #066b65;
}

.recorder.is-recording .record-button {
  border-color: #f5d4dc;
  background: var(--rose);
}

.record-button svg {
  width: 28px;
  height: 28px;
}

.record-button span {
  font-size: 12px;
  font-weight: 900;
}

.recorder > p {
  max-width: 320px;
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.transcript-panel {
  min-height: 480px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid #ced9e2;
  border-radius: 8px;
  background: #fff;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  color: #fff;
  background: var(--blue);
}

.panel-heading > div {
  display: grid;
  gap: 3px;
}

.panel-heading span {
  font-size: 13px;
  font-weight: 900;
}

.panel-heading strong {
  color: #dcecff;
  font-size: 11px;
}

.panel-heading svg {
  width: 22px;
  height: 22px;
}

#liveTranscript {
  min-height: 0;
  height: 100%;
  padding: 18px;
  border: 0;
  border-radius: 0;
  color: #26364a;
  background: #fff;
  resize: none;
  font-size: 17px;
  line-height: 1.65;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.4fr);
  gap: 20px;
}

.review-editor textarea {
  min-height: 290px;
  font-size: 16px;
}

.review-summary {
  display: grid;
  align-content: start;
  border: 1px solid #d4dde5;
  border-radius: 8px;
  background: #f8fafb;
}

.review-summary > div {
  display: grid;
  gap: 4px;
  padding: 15px;
  border-bottom: 1px solid #dde4e9;
}

.review-summary > div:last-child {
  border-bottom: 0;
}

.review-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.review-summary strong {
  font-size: 14px;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.completion-stage {
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.completion-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  color: #fff;
  border-radius: 50%;
  background: var(--teal);
}

.completion-mark svg {
  width: 38px;
  height: 38px;
}

.receipt {
  width: min(680px, 100%);
  margin: 22px 0;
  padding: 18px;
  color: #304056;
  border-left: 5px solid var(--orange);
  background: #fff8ee;
  text-align: left;
}

.receipt strong,
.receipt span {
  display: block;
}

.receipt strong {
  margin-bottom: 5px;
}

.receipt span,
.receipt li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.receipt ul {
  margin: 9px 0 0;
  padding-left: 20px;
}

.app-footer {
  min-height: 58px;
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 15px 24px calc(15px + env(safe-area-inset-bottom));
  color: #687687;
  border-top: 1px solid #d9e1e7;
  background: #fff;
  font-size: 12px;
}

@media (max-width: 900px) {
  .report-shell {
    width: min(100% - 28px, 760px);
    padding-top: 16px;
  }

  .report-stage {
    min-height: 0;
    padding: 26px;
  }

  .record-layout,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .record-layout {
    gap: 18px;
  }

  .recorder {
    min-height: 240px;
  }

  .transcript-panel {
    min-height: 300px;
  }
}

@media (max-width: 620px) {
  .app-header {
    min-height: 68px;
    padding: 10px 14px;
  }

  .brand-copy span,
  .service-state span:last-child {
    display: none;
  }

  .report-shell {
    width: calc(100% - 18px);
  }

  .step-chip {
    min-width: 30px;
  }

  .step-chip strong {
    display: none;
  }

  .step-line {
    width: 42px;
  }

  .report-stage {
    padding: 21px 16px;
  }

  .stage-heading h1,
  .completion-stage h1 {
    font-size: 29px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-wide {
    grid-column: auto;
  }

  .review-actions {
    flex-direction: column-reverse;
  }

  .review-actions button,
  .details-form > .primary-command {
    width: 100%;
  }

  .app-footer {
    display: grid;
    gap: 4px;
    text-align: center;
  }
}

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