:root {
  --ink: #18201e;
  --muted: #64706c;
  --paper: #f5f3ec;
  --surface: #fffdf7;
  --line: #d8d9d1;
  --teal: #087f73;
  --teal-dark: #075f58;
  --coral: #e4644b;
  --lime: #d9f26a;
  --danger: #a3322b;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  letter-spacing: 0;
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(24,32,30,.08) 1px, transparent 0);
  background-size: 24px 24px;
}
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

.page-shell { min-height: 100vh; background: rgba(245,243,236,.9); }
.topbar {
  height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,253,247,.92);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; background: var(--ink); color: var(--lime); font-family: "Newsreader", serif; font-size: 21px; }
.live-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.live-status span { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(8,127,115,.12); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 72px; }
.intro { max-width: 760px; margin-bottom: 36px; }
.eyebrow { margin: 0 0 10px; color: var(--teal-dark); font-weight: 700; text-transform: uppercase; font-size: 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-family: "Newsreader", serif; font-size: clamp(46px, 7vw, 78px); line-height: .96; font-weight: 600; }
.intro-copy { color: var(--muted); font-size: 18px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 260px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 22px 60px rgba(24,32,30,.08); }
.primary-pane { min-height: 530px; padding: clamp(24px, 4vw, 52px); }
.session-pane { border-left: 1px solid var(--line); background: #edf0e9; padding: 30px 24px; display: grid; align-content: start; gap: 28px; }
.session-pane div { display: grid; gap: 6px; }
.aside-label { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 700; }
.privacy-note { padding-top: 22px; border-top: 1px solid #cfd2c9; color: var(--muted); font-size: 13px; line-height: 1.5; }

.view { max-width: 720px; }
.view-heading { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 32px; }
.view-heading h2 { margin-bottom: 4px; font-family: "Newsreader", serif; font-size: 31px; }
.view-heading p { color: var(--muted); margin-bottom: 0; }
.step { width: 42px; height: 30px; display: grid; place-items: center; background: var(--lime); font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field-wide { grid-column: 1 / -1; }
.field { display: grid; gap: 8px; font-size: 13px; font-weight: 700; }
.field input, .field select {
  width: 100%; height: 48px; border: 1px solid #bfc4bb; border-radius: 4px; padding: 0 13px; color: var(--ink); background: #fff;
}
.field input:focus, .field select:focus { outline: 3px solid rgba(8,127,115,.16); border-color: var(--teal); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); }
.field-error { min-height: 16px; color: var(--danger); font-size: 12px; font-weight: 500; }
.consent { display: flex; gap: 10px; margin: 22px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.consent input { width: 18px; height: 18px; accent-color: var(--teal); flex: 0 0 auto; }
.primary-action { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 4px; padding: 0 20px; background: var(--ink); color: #fff; text-decoration: none; font-weight: 700; cursor: pointer; }
.primary-action:hover { background: var(--teal-dark); }
.primary-action:disabled { opacity: .55; cursor: wait; }
.code-field { max-width: 320px; margin-bottom: 22px; }
.code-field input { font-size: 24px; letter-spacing: 8px; text-align: center; }

.error-panel { border-left: 4px solid var(--coral); background: #fff0eb; padding: 16px 18px; margin-bottom: 24px; }
.error-panel strong { color: var(--danger); }
.error-panel p { margin: 5px 0; }
.error-panel small { color: var(--muted); }
.number-display { padding: 28px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.number-display span { font-family: "Newsreader", serif; font-size: clamp(27px, 5vw, 42px); white-space: nowrap; }
.number-display .primary-action { background: var(--lime); color: var(--ink); }
.carrier-note { margin: 12px 0 28px; color: var(--muted); font-size: 13px; }
.call-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.call-progress div { min-height: 68px; padding: 12px; background: var(--surface); color: var(--muted); display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 700; }
.call-progress span { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #9da49e; }
.call-progress div.active { color: var(--ink); background: #edf7ef; }
.call-progress div.active span { border-color: var(--teal); background: var(--teal); }

.summary-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 0 0 30px; }
.summary-list div { padding: 14px; background: var(--surface); }
.summary-list dt { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 700; }
.summary-list dd { margin: 5px 0 0; }
.recording-block, .transcript-block { margin-top: 30px; }
.recording-block h3, .transcript-block h3 { font-family: "Newsreader", serif; font-size: 24px; }
#waveform { width: 100%; height: 100px; display: block; background: #edf0e9; border: 1px solid var(--line); }
audio { width: 100%; margin-top: 12px; }
.transcript { border-top: 1px solid var(--line); }
.utterance { display: grid; grid-template-columns: 82px 1fr; gap: 16px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.utterance strong { color: var(--teal-dark); font-size: 12px; text-transform: uppercase; }
.utterance p { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }

[hidden] { display: none !important; }
@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr; }
  .session-pane { border-left: 0; border-top: 1px solid var(--line); grid-template-columns: repeat(3, 1fr); }
  .privacy-note { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .topbar { height: 64px; padding: 0 16px; }
  .live-status { font-size: 12px; }
  main { width: min(100% - 24px, 1180px); padding-top: 36px; }
  h1 { font-size: 48px; }
  .primary-pane { padding: 24px 18px; min-height: 0; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .session-pane { grid-template-columns: 1fr 1fr; }
  .number-display { align-items: stretch; flex-direction: column; }
  .number-display span { white-space: normal; }
  .call-progress { grid-template-columns: 1fr 1fr; }
  .summary-list { grid-template-columns: 1fr; }
  .utterance { grid-template-columns: 1fr; gap: 5px; }
}

.admin-body { background: #eef0eb; }
.admin-public-link { color: var(--teal-dark); font-weight: 700; text-decoration: none; }
.admin-main { width: min(1440px, calc(100% - 40px)); }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.admin-heading h1 { font-size: clamp(42px, 6vw, 68px); margin: 0; }
.admin-layout { display: grid; grid-template-columns: minmax(540px, 1.15fr) minmax(380px, .85fr); border: 1px solid var(--line); background: var(--surface); min-height: 570px; }
.admin-list-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { padding: 14px 16px; text-align: left; color: var(--muted); text-transform: uppercase; font-size: 10px; background: #edf0e9; }
.admin-table td { padding: 15px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table td:first-child { display: grid; gap: 4px; }
.admin-table small { color: var(--muted); }
.status-pill { display: inline-flex; padding: 4px 7px; border: 1px solid var(--line); border-radius: 3px; text-transform: capitalize; }
.row-action { border: 0; background: transparent; color: var(--teal-dark); font-weight: 700; cursor: pointer; }
.admin-detail { border-left: 1px solid var(--line); padding: 28px; min-width: 0; overflow-y: auto; max-height: 75vh; }
.empty-detail { color: var(--muted); }
.detail-heading h2 { font-family: "Newsreader", serif; font-size: 32px; margin-bottom: 4px; }
.detail-heading p { color: var(--muted); overflow-wrap: anywhere; }
.admin-cost-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin: 24px 0; background: var(--line); border: 1px solid var(--line); }
.admin-cost-grid div { padding: 10px; background: #fff; }
.admin-cost-grid dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.admin-cost-grid dd { margin: 5px 0 0; font-weight: 700; }
.admin-summary { padding: 16px; background: #edf0e9; margin: 20px 0; }
.admin-summary p:last-child { margin-bottom: 0; }
.admin-detail audio { width: 100%; }
.admin-transcript { margin-top: 24px; }
.turnstile-slot { min-height: 65px; margin: 6px 0 18px; }
@media (max-width: 1000px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-detail { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
}
@media (max-width: 620px) {
  .admin-main { width: min(100% - 20px, 1440px); }
  .admin-cost-grid { grid-template-columns: repeat(2, 1fr); }
}