/* ══════════════════════════════════════════════════
   AGENT COUNCIL — Carpathian Jerky AI Platform
   Dark, Premium, Cinematic Design System
   ══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@300;400;500&family=Playfair+Display:wght@400;600;700&display=swap');

:root {
  --bg-primary: #0D0D0F;
  --bg-secondary: #141417;
  --bg-panel: rgba(255,255,255,0.03);
  --bg-glass: rgba(255,255,255,0.06);
  --border-subtle: rgba(255,255,255,0.07);
  --border-accent: rgba(155,29,32,0.4);
  --crimson: #9B1D20;
  --crimson-bright: #C4272B;
  --crimson-glow: rgba(155,29,32,0.15);
  --gold: #C9A84C;
  --gold-muted: rgba(201,168,76,0.6);
  --text-primary: #F0EDE8;
  --text-secondary: #8A8680;
  --text-muted: #4A4845;
  --status-idle: #4A4845;
  --status-thinking: #C9A84C;
  --status-speaking: #2D9B50;
  --status-meeting: #9B1D20;
  --font-heading: 'Bebas Neue', 'Playfair Display', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--crimson); border-radius: 3px; }

/* ── Header ───────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(13,13,15,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-brand .logo-dot {
  width: 8px;
  height: 8px;
  background: var(--crimson);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--crimson-glow);
  animation: pulse-dot 2s infinite;
}

.header-brand h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  letter-spacing: 2px;
  font-weight: 400;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.header-status .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-idle);
  transition: background var(--transition);
}

.header-status .status-dot.connected {
  background: var(--status-speaking);
  box-shadow: 0 0 6px rgba(45,155,80,0.4);
}

.header-nav {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover { border-color: var(--border-accent); background: var(--crimson-glow); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.btn-primary:hover { background: var(--crimson-bright); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { width: 100%; justify-content: center; padding: 14px; font-size: 14px; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.back-btn { margin-bottom: 12px; }

.section-title {
  font-family: var(--font-heading);
  font-size: 28px;
  letter-spacing: 2px;
  margin-bottom: 20px;
}

/* ── Sections ─────────────────────────────────── */
.section { display: none; padding: 20px; min-height: calc(100vh - 56px); min-height: calc(100dvh - 56px); }
.section.active { display: block; }

/* ── Agent Grid ───────────────────────────────── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.agent-card {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(20px);
  transition: all var(--transition);
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--agent-color, var(--crimson));
  opacity: 0.5;
  transition: opacity var(--transition);
}

.agent-card:hover { transform: translateY(-3px); border-color: var(--agent-color, var(--border-accent)); box-shadow: 0 16px 48px rgba(0,0,0,0.4); }
.agent-card:hover::before { opacity: 1; }

.agent-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }

.agent-avatar { position: relative; width: 60px; height: 60px; flex-shrink: 0; }
.agent-avatar img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--agent-color, var(--border-subtle)); }
.agent-avatar .status-indicator { position: absolute; bottom: 1px; right: 1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg-primary); background: var(--status-idle); transition: background var(--transition); }
.agent-avatar .status-indicator.thinking { background: var(--status-thinking); animation: pulse-dot 1s infinite; }
.agent-avatar .status-indicator.speaking { background: var(--status-speaking); animation: pulse-dot 0.6s infinite; }
.agent-avatar .status-indicator.in-meeting { background: var(--status-meeting); }

.settings-btn { position: absolute !important; top: 12px; right: 12px; font-size: 14px; }

.agent-info h3 { font-family: var(--font-heading); font-size: 18px; letter-spacing: 1.5px; font-weight: 400; margin-bottom: 2px; }
.agent-info .agent-role { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.agent-info .agent-id { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); margin-top: 2px; }

.agent-capabilities { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.agent-capabilities .tag { font-size: 9px; font-family: var(--font-mono); padding: 2px 6px; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: 3px; color: var(--text-secondary); }

.agent-actions { display: flex; gap: 8px; }
.agent-actions .btn { flex: 1; justify-content: center; font-size: 11px; padding: 7px 6px; }

.agent-waveform { display: none; align-items: flex-end; gap: 2px; height: 20px; margin-top: 10px; }
.agent-card.speaking .agent-waveform { display: flex; }
.agent-waveform .bar { width: 3px; background: var(--status-speaking); border-radius: 2px; animation: waveform-bar 0.6s ease-in-out infinite alternate; }
.agent-waveform .bar:nth-child(1) { animation-delay: 0s; height: 6px; }
.agent-waveform .bar:nth-child(2) { animation-delay: 0.1s; height: 14px; }
.agent-waveform .bar:nth-child(3) { animation-delay: 0.2s; height: 10px; }
.agent-waveform .bar:nth-child(4) { animation-delay: 0.3s; height: 18px; }
.agent-waveform .bar:nth-child(5) { animation-delay: 0.4s; height: 12px; }
.agent-waveform .bar:nth-child(6) { animation-delay: 0.15s; height: 8px; }
.agent-waveform .bar:nth-child(7) { animation-delay: 0.25s; height: 16px; }
.agent-waveform .bar:nth-child(8) { animation-delay: 0.35s; height: 6px; }

.agent-card.thinking::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--status-thinking) 50%, transparent 100%);
  opacity: 0.05;
  animation: shimmer 2s infinite;
}

/* ── Single Chat ──────────────────────────────── */
.chat-view { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; height: calc(100dvh - 56px - 40px); }

.chat-agent-header { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border-subtle); margin-bottom: 12px; }
.chat-agent-header .avatar-lg { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--crimson); }
.chat-agent-header h2 { font-family: var(--font-heading); font-size: 26px; letter-spacing: 2px; font-weight: 400; }
.chat-agent-header .role { font-size: 13px; color: var(--text-secondary); }

.chat-transcript { flex: 1; overflow-y: auto; padding: 12px 0; display: flex; flex-direction: column; gap: 12px; }

.chat-message { display: flex; gap: 10px; max-width: 85%; animation: msg-in 0.3s ease-out; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message .msg-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.chat-message .msg-bubble { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; line-height: 1.5; word-break: break-word; }
.chat-message.agent .msg-bubble { background: var(--bg-glass); border: 1px solid var(--border-subtle); }
.chat-message.user .msg-bubble { background: var(--bg-glass); border: 1px solid var(--border-accent); }
.chat-message .msg-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 3px; }

.chat-thinking { display: none; padding: 10px; color: var(--text-secondary); font-size: 13px; }
.chat-thinking.visible { display: flex; align-items: center; gap: 8px; }
.thinking-dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--status-thinking); animation: thinking-bounce 1.4s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  padding-bottom: calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border-subtle);
}

.chat-input-bar input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.chat-input-bar input[type="text"]:focus { border-color: var(--border-accent); }
.chat-input-bar input::placeholder { color: var(--text-muted); }

/* ── Mic Button ───────────────────────────────── */
.mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: var(--bg-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.mic-btn:hover { border-color: var(--crimson); color: var(--crimson); }

.mic-btn.recording {
  border-color: var(--crimson-bright);
  background: var(--crimson-glow);
  color: var(--crimson-bright);
  animation: recording-pulse 1.5s infinite;
}

.mic-btn.recording::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--crimson);
  animation: recording-ring 1.5s infinite;
}

.mic-level-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid var(--crimson-bright);
  opacity: 0;
  transition: opacity 0.05s;
  pointer-events: none;
}

.mic-btn.recording .mic-level-ring { opacity: var(--mic-level, 0); }

.voice-toggle { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-secondary); cursor: pointer; flex-shrink: 0; }
.voice-toggle input[type="checkbox"] {
  appearance: none;
  width: 28px;
  height: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
}
.voice-toggle input::after { content: ''; position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); top: 2px; left: 2px; transition: all var(--transition); }
.voice-toggle input:checked { background: var(--crimson-glow); border-color: var(--crimson); }
.voice-toggle input:checked::after { background: var(--crimson); left: 14px; }

/* ═══════════════════════════════════════════════
   VOICE CALL ROOM
   ═══════════════════════════════════════════════ */

#section-call.active { display: block; }
#call-active {
  display: none;
  flex-direction: column;
  height: calc(100dvh - 56px - 40px);
  min-height: 0; /* allow flex children to shrink */
}
#call-active.visible { display: flex !important; }

.call-setup-inner { max-width: 600px; margin: 0 auto; }

/* Participants grid — like a video call */
.call-participants-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  padding: 16px;
  align-content: center;
  justify-items: center;
  overflow-y: auto;
}

.call-agent-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  position: relative;
  transition: all var(--transition);
  cursor: pointer;
}

.call-agent-tile:hover { border-color: var(--agent-color, var(--border-accent)); }

.call-tile-ring {
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius-lg) + 3px);
  border: 3px solid transparent;
  transition: all 0.2s;
  pointer-events: none;
}

.call-agent-tile.speaking .call-tile-ring {
  border-color: var(--agent-color, var(--status-speaking));
  box-shadow: 0 0 30px color-mix(in srgb, var(--agent-color, var(--status-speaking)) 30%, transparent);
  animation: call-ring-pulse 1.5s infinite;
}

.call-agent-tile.thinking .call-tile-ring {
  border-color: var(--status-thinking);
  animation: pulse-dot 1s infinite;
}

.call-user-tile.speaking .call-tile-ring,
.call-user-tile.mic-active .call-tile-ring {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(201,168,76,0.2);
}

.call-tile-avatar { width: 64px; height: 64px; }
.call-tile-avatar img { width: 100%; height: 100%; border-radius: 50%; }

.call-tile-name { font-family: var(--font-heading); font-size: 16px; letter-spacing: 1px; }
.call-agent-status { font-size: 11px; color: var(--text-muted); min-height: 16px; }

/* Transcript panel — bottom overlay */
.call-transcript-panel {
  position: relative;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  max-height: 200px;
  display: flex;
  flex-direction: column;
}

.call-transcript-header {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.call-timer { color: var(--gold); }

.call-transcript-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.call-transcript-msg { animation: msg-in 0.2s ease-out; }
.call-msg-name { font-family: var(--font-heading); font-size: 12px; letter-spacing: 0.5px; margin-right: 8px; }
.call-msg-time { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); }
.call-msg-text { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-top: 2px; }

.call-text-row { display: flex; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border-subtle); }
.call-text-row input { flex: 1; min-width: 0; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text-primary); font-size: 13px; outline: none; }

/* Call controls bar */
.call-controls {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0; /* never shrink — always visible */
  z-index: 10;
  position: relative;
}

.call-control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.call-btn-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.call-control-btn:hover .call-btn-icon { border-color: var(--text-secondary); }
.call-btn-label { font-size: 10px; font-family: var(--font-mono); }

/* Mic toggle active state */
.call-control-btn.active .call-btn-icon {
  background: var(--crimson-glow);
  border-color: var(--crimson);
  color: var(--crimson-bright);
  animation: recording-pulse 2s infinite;
}
.call-control-btn.active .call-btn-label { color: var(--crimson-bright); }

/* End call button */
.call-end .call-btn-icon { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.call-end:hover .call-btn-icon { background: var(--crimson-bright); }
.call-end .call-btn-label { color: var(--crimson); }

/* ── Meeting Room (text-based) ────────────────── */
.meeting-compose { max-width: 600px; margin: 0 auto; }
.meeting-title-input { width: 100%; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 12px 16px; color: var(--text-primary); font-family: var(--font-body); font-size: 14px; outline: none; margin-bottom: 20px; }
.meeting-title-input:focus { border-color: var(--border-accent); }
.meeting-title-input::placeholder { color: var(--text-muted); }

.meeting-agent-selector { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 24px; }

.agent-select-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.agent-select-card:hover { border-color: var(--agent-color, var(--border-accent)); }
.agent-select-card.selected { border-color: var(--agent-color, var(--crimson)); background: color-mix(in srgb, var(--agent-color, var(--crimson)) 8%, transparent); }
.agent-select-card img { width: 36px; height: 36px; border-radius: 50%; }
.agent-select-card .name { font-family: var(--font-heading); font-size: 14px; letter-spacing: 1px; flex: 1; }
.agent-select-card .check { width: 18px; height: 18px; border: 2px solid var(--border-subtle); border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: all var(--transition); flex-shrink: 0; }
.agent-select-card.selected .check { background: var(--agent-color, var(--crimson)); border-color: var(--agent-color, var(--crimson)); }
.agent-select-card.selected .check::after { content: '\2713'; color: #fff; font-size: 11px; }

.meeting-active { display: grid; grid-template-columns: 1fr 240px; gap: 16px; height: calc(100dvh - 56px - 100px); }
.meeting-top-bar { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.meeting-top-bar h2 { font-family: var(--font-heading); font-size: 20px; letter-spacing: 1.5px; flex: 1; }
.meeting-avatars-row { display: flex; }
.meeting-avatars-row img { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--bg-primary); margin-left: -6px; }
.meeting-avatars-row img:first-child { margin-left: 0; }
.meeting-timer { font-family: var(--font-mono); font-size: 13px; color: var(--gold); }
.meeting-transcript-panel { flex: 1; overflow-y: auto; padding: 12px; background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius); display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.meeting-center { display: flex; flex-direction: column; }
.meeting-sidebar { padding: 12px; background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius); overflow-y: auto; }
.meeting-sidebar h3 { font-family: var(--font-heading); font-size: 14px; letter-spacing: 1px; color: var(--text-secondary); margin-bottom: 12px; }
.agent-status-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.agent-status-item:last-child { border-bottom: none; }
.agent-status-item img { width: 28px; height: 28px; border-radius: 50%; }
.agent-status-item .status-text { font-size: 10px; font-family: var(--font-mono); color: var(--text-muted); }

.meeting-msg { display: flex; gap: 8px; animation: msg-in 0.3s ease-out; }
.meeting-msg .msg-avatar { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.meeting-msg .msg-content { flex: 1; }
.meeting-msg .msg-name { font-family: var(--font-heading); font-size: 12px; letter-spacing: 1px; margin-bottom: 1px; }
.meeting-msg .msg-text { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.meeting-msg .msg-time { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); margin-top: 2px; }

/* ── Modal ────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 500; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.visible { display: flex; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 500px; max-height: 80vh; overflow-y: auto; animation: modal-in 0.3s ease-out; }
.modal h2 { font-family: var(--font-heading); font-size: 22px; letter-spacing: 2px; margin-bottom: 16px; }
.modal .field { margin-bottom: 14px; }
.modal label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; font-family: var(--font-mono); }
.modal input[type="text"] { width: 100%; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text-primary); font-family: var(--font-mono); font-size: 12px; outline: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.voice-search { width: 100%; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text-primary); font-size: 12px; outline: none; margin-bottom: 10px; }
.voice-list { max-height: 250px; overflow-y: auto; }
.voice-list-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition); }
.voice-list-item:hover { background: var(--bg-glass); border-color: var(--border-subtle); }
.voice-list-item .voice-name { flex: 1; font-size: 12px; }
.voice-list-item .voice-id { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); }
.voice-list-item .play-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-subtle); background: var(--bg-glass); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 10px; }

/* ── Reconnect banner ─────────────────────────── */
.reconnect-banner { display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--status-thinking); color: var(--bg-primary); padding: 8px 20px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; z-index: 200; }
.reconnect-banner.visible { display: block; }

/* ── Animations ───────────────────────────────── */
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes waveform-bar { 0% { height: 4px; } 100% { height: 100%; } }
@keyframes thinking-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
@keyframes recording-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--crimson-glow); } 50% { box-shadow: 0 0 16px 4px var(--crimson-glow); } }
@keyframes recording-ring { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes call-ring-pulse {
  0%, 100% { box-shadow: 0 0 15px color-mix(in srgb, var(--agent-color, var(--status-speaking)) 20%, transparent); }
  50% { box-shadow: 0 0 35px color-mix(in srgb, var(--agent-color, var(--status-speaking)) 40%, transparent); }
}

/* ══════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .meeting-active { grid-template-columns: 1fr; }
  .meeting-sidebar { display: none; }
}

@media (max-width: 768px) {
  .header {
    padding: 8px 12px;
    gap: 8px;
  }

  .header-brand h1 { font-size: 16px; letter-spacing: 1px; }
  .header-clock { display: none; }
  .header-status span { display: none; }
  .header-nav { gap: 4px; }
  .header-nav .btn { padding: 6px 10px; font-size: 11px; }

  .section { padding: 12px; }

  .agent-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .agent-card { padding: 16px; }
  .agent-avatar { width: 48px; height: 48px; }
  .agent-info h3 { font-size: 16px; }
  .agent-info .agent-role { font-size: 10px; }
  .settings-btn { top: 8px; right: 8px; width: 28px; height: 28px; font-size: 12px; }
  .agent-actions .btn { font-size: 10px; padding: 6px 4px; }

  .chat-view { height: calc(100dvh - 56px - 24px); }
  .chat-agent-header { padding: 10px 0; gap: 12px; }
  .chat-agent-header .avatar-lg { width: 44px; height: 44px; }
  .chat-agent-header h2 { font-size: 22px; }
  .chat-agent-header .role { font-size: 11px; }

  .chat-input-bar { gap: 6px; padding: 8px 0; padding-bottom: calc(8px + var(--safe-bottom)); }
  .chat-input-bar input[type="text"] { padding: 10px; font-size: 16px; } /* 16px prevents iOS zoom */

  .chat-message { max-width: 90%; }
  .chat-message .msg-bubble { padding: 8px 12px; font-size: 13px; }

  .mic-btn { width: 44px; height: 44px; }

  /* Call room mobile */
  .call-participants-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .call-agent-tile { border-radius: var(--radius); }
  .call-tile-ring { border-radius: calc(var(--radius) + 3px); }
  .call-tile-avatar { width: 48px; height: 48px; }
  .call-tile-name { font-size: 13px; }

  .call-transcript-panel { max-height: 160px; }
  .call-controls { gap: 20px; padding: 12px; padding-bottom: calc(12px + var(--safe-bottom)); }
  .call-btn-icon { width: 56px; height: 56px; min-width: 56px; min-height: 56px; }
  .call-btn-icon svg { width: 22px; height: 22px; }
  .call-control-btn { min-width: 70px; }

  .meeting-compose { padding: 0; }
  .meeting-agent-selector { grid-template-columns: 1fr 1fr; gap: 8px; }
  .agent-select-card { padding: 10px; }
  .agent-select-card img { width: 30px; height: 30px; }
  .agent-select-card .name { font-size: 12px; }

  .meeting-active { grid-template-columns: 1fr; height: auto; }
  .meeting-sidebar { display: none; }

  .section-title { font-size: 22px; }
}

@media (max-width: 400px) {
  .header-brand h1 { font-size: 14px; }
  .header-nav .btn svg { display: none; }

  .call-participants-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 8px; }
  .call-tile-avatar { width: 40px; height: 40px; }
  .call-tile-name { font-size: 11px; }
  .call-agent-status { font-size: 9px; }

  .agent-actions { flex-wrap: wrap; }
  .agent-actions .btn { flex: 0 0 calc(50% - 4px); }
}
