* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e2e5ee;
  --text: #1a1d26;
  --text-secondary: #5c6370;
  --primary: #2563eb;
  --caller-bg: #eff6ff;
  --caller-border: #3b82f6;
  --translation-bg: #f0fdf4;
  --translation-border: #22c55e;
  --status-active: #22c55e;
  --status-ended: #94a3b8;
  --status-documenting: #f59e0b;
  --danger: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.header h1 span {
  color: var(--primary);
}

.config-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}

.config-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.config-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.config-controls select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  min-width: 180px;
}

.webhook-display {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.webhook-display span {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.webhook-display code {
  flex: 1;
  font-size: 12px;
  color: var(--primary);
  word-break: break-all;
  user-select: all;
}

.sync-status {
  font-size: 12px;
  white-space: nowrap;
}

.session-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.session-bar label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.session-bar select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  min-width: 200px;
}

.session-info {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.status-dot.active { background: var(--status-active); animation: pulse 2s infinite; }
.status-dot.ended { background: var(--status-ended); }
.status-dot.documenting { background: var(--status-documenting); animation: pulse 1s infinite; }
.status-dot.completed { background: var(--status-ended); }

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

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

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

.panel-header h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.transcript-feed {
  padding: 16px 20px;
  max-height: 450px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.transcript-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 20px;
  font-size: 14px;
}

.transcript-line {
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 8px;
  border-left: 3px solid;
  font-size: 14px;
}

.transcript-line.caller {
  background: var(--caller-bg);
  border-color: var(--caller-border);
}

.transcript-line.translation {
  background: var(--translation-bg);
  border-color: var(--translation-border);
}

.transcript-line.system {
  background: #fef9c3;
  border-color: #eab308;
  font-style: italic;
}

.transcript-line.system .meta { color: #a16207; }

.transcript-line .meta {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transcript-line.caller .meta { color: var(--caller-border); }
.transcript-line.translation .meta { color: var(--translation-border); }

.transcript-line .text {
  color: var(--text);
  line-height: 1.6;
}

.streaming-indicator {
  animation: blink 1s infinite;
  color: var(--text-secondary);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.document-panel {
  padding: 20px;
}

.document-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 14px;
}

.soap-note {
  font-size: 14px;
}

.soap-section {
  margin-bottom: 20px;
}

.soap-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.soap-field {
  margin-bottom: 6px;
}

.soap-field strong {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.soap-field p {
  margin-top: 2px;
}

.entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.entity-tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
}

.disclaimer {
  margin-top: 20px;
  padding: 12px 16px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
}

.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; }

.actions {
  display: flex;
  gap: 8px;
}

.mode-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  letter-spacing: 0.5px;
}

.connection-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--bg);
}

.connection-status.connected { color: var(--status-active); }
.connection-status.disconnected { color: var(--danger); }

.no-session {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-secondary);
}

.no-session h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.no-session p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .session-bar { padding: 10px 16px; }
  .main { padding: 16px; }
  .transcript-feed { max-height: 350px; }
}
