:root {
  color-scheme: dark;
  --black: #020202;
  --graphite: #0a0a0a;
  --panel: #10100f;
  --panel-soft: #171612;
  --panel-light: #201d16;
  --gold: #f5d77b;
  --gold-mid: #c9952d;
  --gold-deep: #7a4d0f;
  --champagne: #fff0b8;
  --ink: #f8f3df;
  --muted: #b9b29d;
  --dim: #817965;
  --line: rgba(245, 215, 123, 0.22);
  --line-strong: rgba(245, 215, 123, 0.42);
  --success: #6ee7a8;
  --warning: #f3bf55;
  --danger: #ff9a7a;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(50% - 1px), rgba(245, 215, 123, 0.055) 50%, transparent calc(50% + 1px)),
    linear-gradient(135deg, rgba(245, 215, 123, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(122, 77, 15, 0.18), transparent 38%),
    var(--black);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
textarea,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.customer-experience {
  width: min(1120px, 100%);
  min-height: calc(100vh - 36px);
  min-height: calc(100dvh - 36px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(470px, 1fr) auto auto;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 240, 184, 0.035), transparent 260px),
    var(--graphite);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.customer-header {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 24px 30px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(245, 215, 123, 0.12), transparent 42%),
    #050505;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(245, 215, 123, 0.5);
  background: #000000;
  box-shadow: 0 0 32px rgba(245, 215, 123, 0.16);
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.welcome-kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  color: var(--champagne);
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  font-weight: 900;
}

h2 {
  color: var(--ink);
  font-size: clamp(1.35rem, 2.7vw, 2.25rem);
  font-weight: 850;
}

.brand-tagline {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.header-panel {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.status-chips {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chips span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(245, 215, 123, 0.24);
  background: rgba(255, 240, 184, 0.045);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.mode-control {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line-strong);
  background: #050505;
}

.mode-button {
  min-width: 88px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.mode-button + .mode-button {
  border-left: 1px solid var(--line);
}

.mode-button.active {
  background: linear-gradient(180deg, var(--champagne), var(--gold-mid));
  color: #130d03;
}

.welcome-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 318px);
  gap: 30px;
  align-items: stretch;
  padding: 30px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(120deg, rgba(245, 215, 123, 0.08), transparent 48%),
    var(--panel);
}

.welcome-copy {
  align-self: center;
}

.welcome-band p {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.58;
}

.experience-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.experience-strip span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid rgba(245, 215, 123, 0.2);
  background: rgba(255, 255, 255, 0.035);
  color: var(--champagne);
  font-size: 0.8rem;
  font-weight: 850;
}

.progress-card {
  min-height: 150px;
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(160deg, rgba(245, 215, 123, 0.12), transparent 54%),
    #070707;
}

.progress-card > div:first-child {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.progress-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.progress-card strong {
  color: var(--gold);
  font-size: 2rem;
  line-height: 1;
}

.progress-card p {
  margin: 0;
  color: var(--dim);
  font-size: 0.82rem;
  font-weight: 800;
}

.progress-rail {
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--champagne));
  transition: width 180ms ease;
}

.intake-card {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(360px, 1fr);
  gap: 28px;
  align-items: start;
  padding: 30px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(140deg, rgba(245, 215, 123, 0.09), transparent 54%),
    #0d0c0a;
}

.intake-card[hidden],
.conversation-card[hidden] {
  display: none;
}

.intake-copy p:not(.welcome-kicker) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.intake-form {
  padding: 18px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(160deg, rgba(255, 240, 184, 0.055), transparent 58%),
    #080808;
}

.intake-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

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

.form-field label {
  color: var(--champagne);
  font-size: 0.8rem;
  font-weight: 900;
}

.form-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(245, 215, 123, 0.3);
  padding: 11px 13px;
  color: var(--ink);
  background: #11100e;
  outline: none;
  font-size: 1rem;
}

.form-field input::placeholder {
  color: #8d846d;
}

.form-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 215, 123, 0.12);
}

.intake-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.conversation-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
}

.conversation-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 30px;
  border-bottom: 1px solid rgba(245, 215, 123, 0.14);
  background: #080808;
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 850;
}

.conversation-toolbar span:first-child {
  color: var(--gold);
}

.conversation {
  min-height: 320px;
  overflow-y: auto;
  padding: 30px;
  background:
    linear-gradient(180deg, rgba(255, 240, 184, 0.03), transparent 180px),
    #0d0d0c;
}

.message-row {
  display: flex;
  margin-bottom: 15px;
}

.message-row.user {
  justify-content: flex-end;
}

.message-bubble {
  width: fit-content;
  max-width: min(720px, 86%);
  padding: 14px 16px;
  border: 1px solid rgba(245, 215, 123, 0.18);
  background: #151410;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.message-row.agent .message-bubble {
  border-left: 4px solid var(--gold);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

.message-row.user .message-bubble {
  background: linear-gradient(180deg, #3b2b0d, #1d1608);
  border-color: rgba(245, 215, 123, 0.42);
  color: #fff7db;
}

.reply-form {
  padding: 18px 30px 24px;
  border-top: 1px solid var(--line);
  background: #070707;
}

.reply-context {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

textarea {
  width: 100%;
  min-height: 104px;
  max-height: 230px;
  resize: vertical;
  border: 1px solid rgba(245, 215, 123, 0.3);
  padding: 14px 15px;
  color: var(--ink);
  background: #11100e;
  outline: none;
  font-size: 1rem;
  line-height: 1.45;
}

textarea::placeholder {
  color: #8d846d;
}

textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 215, 123, 0.12);
}

.voice-panel {
  display: grid;
  gap: 11px;
  margin-top: 13px;
  padding: 13px;
  border: 1px solid rgba(245, 215, 123, 0.28);
  background: #11100d;
}

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

.voice-actions,
.reply-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.mic-meter {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.mic-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #766f60;
  box-shadow: 0 0 0 4px rgba(245, 215, 123, 0.08);
}

.mic-indicator.active {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(110, 231, 168, 0.16);
}

.mic-meter-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.mic-meter-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--champagne));
  transition: width 80ms linear;
}

.voice-hint {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid rgba(245, 215, 123, 0.32);
  background: rgba(245, 215, 123, 0.08);
  color: var(--champagne);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.4;
}

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

.voice-status {
  margin: 0;
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: right;
}

.voice-status.error {
  color: var(--danger);
}

.reply-actions {
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-weight: 900;
}

.primary-button {
  background: linear-gradient(180deg, var(--champagne), var(--gold-mid));
  border-color: rgba(255, 240, 184, 0.52);
  color: #130d03;
}

.primary-button:hover {
  background: linear-gradient(180deg, #fff8d2, #e0aa3e);
}

.secondary-button {
  background: #0b0b0b;
  border-color: rgba(245, 215, 123, 0.28);
  color: var(--champagne);
}

.secondary-button:hover {
  border-color: var(--gold);
  color: #ffffff;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.submission-status {
  min-height: 46px;
  margin: 0;
  padding: 13px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
  background: #070707;
}

.submission-status[data-tone="success"] {
  color: var(--success);
  font-weight: 850;
}

.submission-status[data-tone="warning"] {
  color: var(--warning);
  font-weight: 850;
}

.completion-screen {
  margin: 0 30px 26px;
  padding: 28px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(140deg, rgba(245, 215, 123, 0.1), transparent 54%),
    #11100d;
}

.review-screen {
  margin: 0 30px 26px;
  padding: 28px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(140deg, rgba(245, 215, 123, 0.08), transparent 54%),
    #0d0c0a;
}

.review-screen[hidden] {
  display: none;
}

.review-screen p:not(.welcome-kicker) {
  max-width: 760px;
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.55;
}

.review-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.review-item {
  padding: 16px;
  border: 1px solid rgba(245, 215, 123, 0.22);
  background: rgba(255, 255, 255, 0.025);
}

.review-item h3 {
  margin: 0;
  color: var(--champagne);
  font-size: 1rem;
}

.review-question {
  margin: 8px 0 12px !important;
  max-width: none !important;
  color: var(--muted) !important;
  font-size: 0.92rem;
}

.review-answer {
  min-height: 86px;
  max-height: 180px;
}

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

.completion-screen[hidden] {
  display: none;
}

.completion-screen p:not(.welcome-kicker) {
  max-width: 680px;
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.55;
}

.customer-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 30px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.82rem;
  background: #050505;
}

.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;
}

@media (max-width: 880px) {
  .app-shell {
    padding: 12px;
  }

  .customer-experience {
    min-height: calc(100vh - 24px);
    min-height: calc(100dvh - 24px);
    grid-template-rows: auto auto minmax(380px, 1fr) auto auto;
  }

  .customer-header,
  .welcome-band,
  .intake-card,
  .customer-footer {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .header-panel {
    width: 100%;
    justify-items: stretch;
  }

  .status-chips {
    justify-content: flex-start;
  }

  .welcome-band {
    gap: 18px;
  }

  .progress-card {
    width: 100%;
    min-height: 104px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 0;
  }

  .customer-experience {
    min-height: 100vh;
    min-height: 100dvh;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  }

  .customer-header,
  .welcome-band,
  .intake-card,
  .conversation-toolbar,
  .conversation,
  .reply-form,
  .submission-status,
  .review-screen,
  .completion-screen,
  .customer-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .customer-header {
    min-height: 0;
    gap: 16px;
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: 16px;
  }

  .brand-lockup {
    width: 100%;
    align-items: center;
    gap: 12px;
  }

  .brand-logo {
    width: 64px;
    height: 64px;
  }

  .eyebrow,
  .welcome-kicker {
    font-size: 0.69rem;
  }

  h1 {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1.28rem;
  }

  .brand-tagline {
    font-size: 0.78rem;
  }

  .mode-control,
  .reply-actions,
  .voice-actions {
    width: 100%;
  }

  .mode-control {
    grid-template-columns: 1fr 1fr;
  }

  .status-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .status-chips span {
    justify-content: center;
    text-align: center;
  }

  .welcome-band {
    gap: 16px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .intake-card {
    gap: 18px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

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

  .intake-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .welcome-band p {
    margin-top: 9px;
    font-size: 0.94rem;
    line-height: 1.48;
  }

  .experience-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 14px;
  }

  .progress-card {
    min-height: 88px;
    padding: 14px;
    gap: 10px;
  }

  .progress-card strong {
    font-size: 1.45rem;
  }

  .conversation-card {
    min-height: 0;
    grid-template-rows: auto minmax(255px, 1fr) auto;
  }

  .conversation-toolbar {
    display: grid;
    gap: 4px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .conversation {
    min-height: 255px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .reply-form {
    padding-top: 14px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  textarea {
    min-height: 92px;
    max-height: 170px;
    padding: 12px;
  }

  .voice-panel {
    padding: 11px;
  }

  .reply-actions,
  .voice-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mic-meter {
    grid-template-columns: auto 1fr;
  }

  #micLevelText {
    grid-column: 1 / -1;
  }

  .message-bubble {
    max-width: 96%;
    padding: 12px 13px;
    font-size: 0.95rem;
  }

  .voice-status {
    text-align: left;
  }

  .submission-status {
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .completion-screen {
    margin-left: 16px;
    margin-right: 16px;
    padding: 22px 16px;
  }

  .review-screen {
    margin-left: 16px;
    margin-right: 16px;
    padding: 22px 16px;
  }

  .review-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .customer-footer {
    gap: 8px;
    padding-top: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .customer-header,
  .welcome-band,
  .intake-card,
  .conversation-toolbar,
  .conversation,
  .reply-form,
  .submission-status,
  .review-screen,
  .completion-screen,
  .customer-footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
  }

  h1 {
    font-size: 1.2rem;
  }

  .brand-tagline {
    font-size: 0.74rem;
  }

  .mode-button,
  .primary-button,
  .secondary-button {
    padding-left: 10px;
    padding-right: 10px;
  }

  .conversation-card {
    grid-template-rows: auto minmax(230px, 1fr) auto;
  }

  .conversation {
    min-height: 230px;
  }
}
