:root {
  --bg: #f4f9f8;
  --panel: #ffffff;
  --border: #d4e8e4;
  --text: #1a2e2a;
  --muted: #5a7570;
  --accent: #0d9488;
  --accent-soft: #14b8a6;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #e6f5f2 0%, var(--bg) 55%);
  color: var(--text);
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #065f46);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: white;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
}

header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.pill.idle { background: #eef6f4; color: var(--muted); }
.pill.connecting { background: #fef3c7; color: var(--amber); border-color: #fcd34d; }
.pill.live { background: #d1fae5; color: var(--green); border-color: #6ee7b7; animation: pulse 2s infinite; }
.pill.error { background: #fee2e2; color: var(--red); border-color: #fca5a5; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

main {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(13, 148, 136, 0.06);
}

.call-panel {
  grid-column: 1 / -1;
  text-align: center;
}

.transcript-panel {
  grid-column: 1;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.recording-panel {
  grid-column: 1 / -1;
}

.recording-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.recording-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  text-align: left;
}

.recording-item.latest {
  border-color: var(--accent);
  background: #f0fdfa;
}

.recording-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.recording-item audio {
  width: 100%;
}

.recording-turns {
  margin: 0.7rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.flow-panel h2,
.transcript-panel h2,
.recording-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.wave {
  display: flex;
  justify-content: center;
  gap: 6px;
  height: 48px;
  align-items: end;
  margin: 0.5rem 0 1rem;
}

.wave span {
  width: 6px;
  height: 8px;
  background: var(--accent-soft);
  border-radius: 4px;
  transition: height 0.1s;
}

.wave.active span {
  animation: wave 0.8s ease-in-out infinite;
}

.wave.active span:nth-child(2) { animation-delay: 0.1s; }
.wave.active span:nth-child(3) { animation-delay: 0.2s; }
.wave.active span:nth-child(4) { animation-delay: 0.3s; }
.wave.active span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 40px; }
}

.hint {
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 1.25rem;
  line-height: 1.5;
}

.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-soft);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.mic-note {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.flow-steps {
  list-style: none;
  padding: 0;
  margin: 0;
}

.flow-steps li {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  border: 1px solid transparent;
}

.flow-steps li.active {
  color: var(--text);
  background: #ecfdf5;
  border-color: var(--accent);
}

.flow-steps li.done {
  color: var(--green);
}

.flow-hint {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.transcript {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.25rem;
}

.line {
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  line-height: 1.45;
  font-size: 0.92rem;
}

.line.anna {
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  align-self: flex-start;
  max-width: 92%;
}

.line.caller {
  background: #f8fafc;
  border: 1px solid var(--border);
  align-self: flex-end;
  max-width: 92%;
}

.line .who {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 800px) {
  main { grid-template-columns: 1fr; }
  .flow-panel { order: -1; }
}
