:root {
  --canvas: #0c0a09;
  --canvas-soft: #14110f;
  --panel: #1b1714;
  --panel-soft: #211d19;
  --panel-strong: #292524;
  --ink: #f8f3ea;
  --body: #d8d0c7;
  --muted: #a8a29e;
  --muted-soft: #78716c;
  --hairline: rgba(245, 245, 244, 0.11);
  --hairline-strong: rgba(245, 245, 244, 0.2);
  --success: #86efac;
  --success-bg: rgba(22, 163, 74, 0.14);
  --warning: #f8d49b;
  --warning-bg: rgba(244, 197, 168, 0.14);
  --danger: #fca5a5;
  --danger-bg: rgba(220, 38, 38, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background:
    linear-gradient(180deg, rgba(245, 245, 244, 0.04), rgba(12, 10, 9, 0) 220px),
    var(--canvas);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.app-shell {
  min-height: 100vh;
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 26px;
  background: rgba(12, 10, 9, 0.86);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(20px);
}

.title-group {
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex: 1;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 36px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink);
}

h2 {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink);
}

h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}

.live-model,
.status-line {
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  display: inline-block;
}

.dot.ok {
  background: var(--success);
  box-shadow: 0 0 18px rgba(134, 239, 172, 0.36);
}

.dot.neutral {
  background: var(--muted-soft);
}

.status-pill {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(470px, 1.23fr) minmax(370px, 0.96fr);
  gap: 16px;
  padding: 18px;
  height: calc(100vh - 78px);
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)), var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-bottom: 1px solid var(--hairline);
}

.panel-header.compact {
  padding: 18px 20px;
}

.panel-kicker {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.status-pill.active {
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid rgba(134, 239, 172, 0.24);
}

.call-panel,
.claim-panel,
.right-rail {
  min-height: 0;
}

.call-panel,
.claim-panel {
  display: flex;
  flex-direction: column;
}

.voice-stage {
  height: 214px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  border-bottom: 1px solid var(--hairline);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.03)),
    var(--canvas-soft);
  position: relative;
  overflow: hidden;
}

.voice-stage::before,
.voice-stage::after {
  content: "";
  position: absolute;
  inset: 24px auto 24px 24px;
  width: 1px;
  background: var(--hairline);
}

.voice-stage::after {
  left: auto;
  right: 24px;
}

.mic-button {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  outline: 14px solid rgba(245, 245, 244, 0.055);
  background: var(--ink);
  box-shadow:
    0 0 0 28px rgba(245, 245, 244, 0.025),
    0 24px 60px rgba(0, 0, 0, 0.42);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.mic-button.recording {
  background: #f8f3ea;
  animation: pulse 1.35s infinite;
}

.mic-icon {
  width: 24px;
  height: 38px;
  border: 4px solid var(--canvas);
  border-radius: 16px;
  position: relative;
}

.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 4px;
  height: 16px;
  background: var(--canvas);
  transform: translateX(-50%);
}

.mic-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -24px;
  width: 30px;
  height: 4px;
  background: var(--canvas);
  border-radius: 4px;
  transform: translateX(-50%);
}

@keyframes pulse {
  0% {
    box-shadow:
      0 0 0 28px rgba(245, 245, 244, 0.025),
      0 0 0 0 rgba(248, 243, 234, 0.18);
  }
  100% {
    box-shadow:
      0 0 0 28px rgba(245, 245, 244, 0.025),
      0 0 0 24px rgba(248, 243, 234, 0);
  }
}

.wave {
  display: flex;
  gap: 5px;
  align-items: center;
  height: 58px;
}

.wave span {
  width: 3px;
  border-radius: 4px;
  background: rgba(248, 243, 234, 0.72);
  animation: wave 1s ease-in-out infinite alternate;
}

.wave span:nth-child(1) { height: 10px; }
.wave span:nth-child(2) { height: 22px; animation-delay: 0.1s; }
.wave span:nth-child(3) { height: 36px; animation-delay: 0.2s; }
.wave span:nth-child(4) { height: 54px; animation-delay: 0.3s; }
.wave span:nth-child(5) { height: 28px; animation-delay: 0.4s; }
.wave span:nth-child(6) { height: 14px; animation-delay: 0.5s; }

@keyframes wave {
  to {
    transform: scaleY(0.48);
    opacity: 0.48;
  }
}

.call-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px 20px 0;
}

.primary-action,
.secondary-action,
.packet-button,
.text-entry button,
.dialog-header button {
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 16px;
  cursor: pointer;
}

.primary-action,
.text-entry button,
.packet-button {
  background: var(--ink);
  color: var(--canvas);
  border-color: var(--ink);
}

.secondary-action,
.dialog-header button {
  background: rgba(255, 255, 255, 0.03);
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 10px;
}

.transcript-header span {
  color: var(--muted);
  font-size: 12px;
}

.transcript {
  flex: 1;
  min-height: 230px;
  overflow: auto;
  padding: 0 20px 12px;
}

.turn {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 11px;
  margin-bottom: 12px;
}

.speaker-icon {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.turn.agent .speaker-icon {
  background: rgba(245, 245, 244, 0.1);
}

.bubble {
  border-radius: 8px;
  background: rgba(245, 245, 244, 0.04);
  padding: 12px 13px;
  border: 1px solid var(--hairline);
}

.bubble strong {
  font-size: 12px;
  margin-right: 8px;
  color: var(--ink);
}

.bubble time {
  color: var(--muted-soft);
  font-size: 11px;
}

.bubble p {
  margin-top: 8px;
  color: var(--body);
  font-size: 14px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.text-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 16px 20px 20px;
}

.text-entry input {
  height: 44px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  outline: none;
}

.text-entry input::placeholder {
  color: var(--muted-soft);
}

.text-entry input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(248, 243, 234, 0.08);
}

.claim-sections {
  overflow: auto;
  padding: 0 20px 20px;
}

.field-group {
  padding: 19px 0 17px;
  border-bottom: 1px solid var(--hairline);
}

.field-group:last-child {
  border-bottom: 0;
}

.group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 13px;
}

.group-title h3 {
  font-size: 15px;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.72fr) minmax(180px, 1.12fr) minmax(120px, 0.86fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.field-label {
  color: var(--body);
  font-size: 13px;
}

.field-value,
.field-source {
  min-height: 36px;
  display: flex;
  align-items: center;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.25;
  background: rgba(255, 255, 255, 0.035);
  color: var(--body);
}

.field-source {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
}

.field-value.complete {
  color: var(--success);
  border-color: rgba(134, 239, 172, 0.24);
  background: var(--success-bg);
}

.field-value.pending,
.field-value.missing {
  color: var(--warning);
  border-color: rgba(248, 212, 155, 0.24);
  background: var(--warning-bg);
}

.field-value.urgent {
  color: var(--danger);
  border-color: rgba(252, 165, 165, 0.26);
  background: var(--danger-bg);
}

.right-rail {
  display: grid;
  grid-template-rows: minmax(380px, 1fr) minmax(260px, 0.78fr);
  gap: 16px;
  min-height: 0;
}

.timeline-panel,
.handoff-panel {
  min-height: 0;
  overflow: hidden;
}

.operator-workbench {
  overflow: auto;
  height: calc(100% - 73px);
  padding: 16px 20px 20px;
}

.decision-card,
.operator-card,
.audit-details {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: rgba(245, 245, 244, 0.04);
  padding: 15px;
  margin-bottom: 12px;
}

.decision-card {
  border-color: rgba(248, 212, 155, 0.23);
  background: var(--warning-bg);
}

.decision-card.success {
  border-color: rgba(134, 239, 172, 0.24);
  background: var(--success-bg);
}

.decision-card.danger {
  border-color: rgba(252, 165, 165, 0.26);
  background: var(--danger-bg);
}

.decision-label,
.operator-card-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.decision-card strong {
  display: block;
  margin-top: 8px;
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.05;
  color: var(--ink);
}

.decision-card p,
.operator-card p {
  margin-top: 9px;
  color: var(--body);
  font-size: 13px;
  line-height: 1.45;
}

.ask-card p {
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
}

.missing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.missing-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(248, 212, 155, 0.24);
  background: rgba(248, 212, 155, 0.1);
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
}

.readiness-meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(245, 245, 244, 0.09);
  margin-top: 12px;
}

.readiness-meter div {
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
}

.readiness-copy {
  color: var(--muted);
}

.audit-details {
  background: rgba(245, 245, 244, 0.025);
}

.audit-details summary {
  cursor: pointer;
  color: var(--body);
  font-size: 13px;
  font-weight: 600;
}

.audit-list {
  margin-top: 14px;
}

.event {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  padding: 0 0 17px;
  position: relative;
}

.event::before {
  content: "";
  position: absolute;
  left: 80px;
  top: 17px;
  bottom: 0;
  width: 1px;
  background: var(--hairline);
}

.event:last-child::before {
  display: none;
}

.event-time {
  color: var(--muted-soft);
  font-size: 12px;
}

.event-body {
  position: relative;
  padding-left: 18px;
}

.event-body::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--hairline-strong);
}

.event.warning .event-body::before { background: var(--warning); }
.event.danger .event-body::before { background: var(--danger); }
.event.success .event-body::before { background: var(--success); }

.event-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.event-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.38;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.rule-id {
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 700;
}

.handoff-list {
  margin: 0;
  padding: 12px 20px 10px;
  overflow: auto;
  max-height: calc(100% - 124px);
}

.handoff-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}

.handoff-row dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.handoff-row dd {
  margin: 0;
  color: var(--body);
  font-size: 12px;
  line-height: 1.45;
}

.progress-ring {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 5px solid rgba(245, 245, 244, 0.1);
  border-right-color: var(--ink);
  border-radius: 50%;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.packet-button {
  width: calc(100% - 40px);
  margin: 0 20px 20px;
}

.packet-dialog {
  width: min(860px, calc(100vw - 48px));
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
  padding: 0;
  background: var(--panel);
  color: var(--ink);
}

.packet-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--hairline);
}

.packet-dialog pre {
  white-space: pre-wrap;
  margin: 0;
  padding: 20px;
  color: var(--body);
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 68vh;
  overflow: auto;
}

@media (max-width: 980px) {
  body {
    min-width: 0;
  }

  .topbar {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    padding: 16px;
  }

  .title-group {
    min-width: 0;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  h1 {
    font-size: 32px;
  }

  .dashboard {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px;
  }

  .right-rail {
    grid-template-rows: auto auto;
  }

  .call-panel,
  .claim-panel,
  .timeline-panel,
  .handoff-panel {
    min-height: 520px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 14px;
  }

  .field-value,
  .field-source {
    width: 100%;
  }

  .handoff-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
