/* Astrio — Mobile-first responsive styles */

:root {
  --bg: #0a0a0f;
  --bg-surface: #141420;
  --bg-elevated: #1c1c2e;
  --border: #2a2a3e;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --accent: #6366f1;
  --accent-dim: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --user-bubble: #2a2a4e;
  --persona-bubble: #1a2a1e;
  --radius: 12px;
  --max-width: 800px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

/* ==================== LOGIN SCREEN ==================== */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
}
#login-screen.hidden { display: none; }
.login-content {
  text-align: center;
  max-width: 360px;
  padding: 20px;
}
.login-logo {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-subtitle {
  color: var(--text-dim);
  margin-bottom: 24px;
  font-size: 0.95rem;
}
.invite-login-banner {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--text);
  text-align: center;
  margin-bottom: 20px;
}
.login-input {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  margin-bottom: 12px;
  font-family: monospace;
}
.login-input:focus { border-color: var(--accent); }
.login-btn {
  width: 100%;
  padding: 14px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}
.login-btn:hover { background: var(--accent-dim); }
.login-error {
  color: var(--danger);
  margin-top: 12px;
  font-size: 0.9rem;
  min-height: 1.4em;
}
.google-signin-container {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}
.admin-toggle {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: none;
  margin-top: 8px;
}
.admin-toggle:hover { color: var(--text); }
.admin-section { margin-top: 12px; }
.admin-section.hidden { display: none; }

/* ==================== HOME SCREEN ==================== */
#home-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.home-header h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-header-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-header-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

/* ==================== HERO CARD ==================== */
.hero-card {
  margin: 16px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.hero-card:hover {
  border-color: var(--accent);
}

.hero-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}

.progress-ring {
  width: 80px;
  height: 80px;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  stroke: var(--border);
}

.progress-ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 276.46;
  stroke-dashoffset: 276.46;
  transition: stroke-dashoffset 0.8s ease;
}

.hero-initial {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.hero-text {
  text-align: center;
}

.hero-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.hero-pct {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.hero-motivating {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
  line-height: 1.4;
}

/* ==================== SETUP CARD (admin first-time) ==================== */
.setup-card {
  margin: 16px;
  padding: 32px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.setup-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.setup-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
}

.setup-input {
  width: 100%;
  max-width: 280px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  outline: none;
  text-align: center;
}
.setup-input:focus { border-color: var(--accent); }
.setup-input::placeholder { color: var(--text-dim); }

/* ==================== CONVERSATION LIST ==================== */
#conversation-list {
  padding: 0 16px 80px;
}

.conv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 8px;
  margin-bottom: 2px;
}
.conv-row:hover {
  background: var(--bg-surface);
}
.conv-row:last-child {
  border-bottom: none;
}

.conv-row-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.conv-row-icon.astrio {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
  font-size: 18px;
}

.conv-row-icon.digital-me {
  background: var(--bg-elevated);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.conv-row-body {
  flex: 1;
  min-width: 0;
}

.conv-row-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.conv-row-preview {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== Quick-access tiles (home screen top row) ==================== */
.home-quick-tiles {
  display: flex;
  gap: 8px;
  padding: 4px 0 12px 0;
}

.quick-tile {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px 12px;
  border-radius: 12px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: background 0.15s;
}

.quick-tile:hover {
  background: var(--bg-elevated);
}

.quick-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.quick-tile-icon.astrio {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
}

.quick-tile-icon.journal {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
}

.quick-tile-icon.digital-me {
  background: var(--bg-elevated);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.quick-tile-label {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  font-weight: 500;
}

.quick-tile-desc {
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.7;
  text-align: center;
  line-height: 1.3;
  margin-top: 2px;
}

/* ==================== FAB (floating action button) ==================== */
.fab-record {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transition: all 0.2s;
  z-index: 10;
}
.fab-record:hover {
  background: var(--accent-dim);
  transform: scale(1.05);
}
.fab-record:active {
  transform: scale(0.95);
}

/* ==================== CONVERSATION VIEW ==================== */
#conversation-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.conv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.conv-header-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.conv-header-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.conv-title-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.conv-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  line-height: 1.3;
}

.conv-actions {
  display: flex;
  gap: 4px;
}

.conv-action-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.conv-action-btn:hover {
  color: var(--success);
  background: var(--bg-elevated);
}

/* Conversation content sections */
.conv-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

/* ==================== PANELS (profile, settings, record overlay) ==================== */
#profile-panel,
#record-overlay,
#settings-panel {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.panel-header h2 {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.panel-header-spacer {
  width: 34px;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
}

/* ==================== CHAT MODE ==================== */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
}

.chat-msg.persona {
  align-self: flex-start;
  background: var(--persona-bubble);
  border-bottom-left-radius: 4px;
}

.chat-msg.thinking {
  align-self: flex-start;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-style: italic;
}

#chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}
#chat-input:focus { border-color: var(--accent); }
#chat-input::placeholder { color: var(--text-dim); }

#voice-btn, #send-btn {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
#voice-btn:hover, #send-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
#voice-btn.recording {
  color: var(--danger);
  border-color: var(--danger);
  animation: pulse 1.5s infinite;
}

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

/* ==================== INTERVIEW MODE ==================== */
#interview-progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.interview-progress-bg {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.interview-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease;
  width: 0%;
}

#interview-progress-text {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

#interview-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.interview-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.interview-msg.interviewer {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.interview-msg.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
}

.interview-msg.thinking {
  align-self: flex-start;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-style: italic;
}

.interview-sufficient-hint {
  align-self: center;
  text-align: center;
  padding: 16px;
  margin-top: 8px;
}

.interview-sufficient-hint p {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

#interview-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

#interview-input {
  flex: 1;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}
#interview-input:focus { border-color: var(--accent); }
#interview-input::placeholder { color: var(--text-dim); }

#interview-voice-btn, #interview-send-btn {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
#interview-voice-btn:hover, #interview-send-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
#interview-voice-btn.recording {
  color: var(--danger);
  border-color: var(--danger);
  animation: pulse 1.5s infinite;
}

#interview-call-btn {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
#interview-call-btn:hover {
  color: var(--success);
  border-color: var(--success);
}

/* Interview voice call bar */
#interview-call-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
#interview-call-bar.hidden { display: none !important; }

.interview-call-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.call-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.call-indicator.speaking { background: var(--accent); animation: pulse 1s infinite; }
.call-indicator.listening { background: var(--success); animation: pulse 1s infinite; }
.call-indicator.processing { background: var(--warning); animation: pulse 1.5s infinite; }

#interview-call-status-text {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

.interview-call-transcript {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 20px;
}

#interview-call-bar .call-round-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* ==================== JOURNAL MODE ==================== */
#journal-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.journal-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.journal-msg.friend {
  align-self: flex-start;
  background: #1a2420;
  border: 1px solid #2a3a30;
  border-bottom-left-radius: 4px;
}

.journal-msg.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border-bottom-right-radius: 4px;
}

.journal-msg.thinking {
  align-self: flex-start;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-style: italic;
}

.journal-date-sep {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px 0;
  position: relative;
}
.journal-date-sep::before,
.journal-date-sep::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--border);
}
.journal-date-sep::before { left: 5%; }
.journal-date-sep::after { right: 5%; }

.journal-examples {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.journal-examples.hidden { display: none; }
.journal-examples-title {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 8px;
  text-align: center;
}
.journal-example-chip {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: left;
  max-width: 90%;
  line-height: 1.4;
}
.journal-example-chip:hover {
  border-color: var(--accent);
  background: #1a2420;
}

.conv-row-icon.journal {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 18px;
}

#journal-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

#journal-input {
  flex: 1;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}
#journal-input:focus { border-color: var(--accent); }
#journal-input::placeholder { color: var(--text-dim); }

#journal-voice-btn, #journal-send-btn, #journal-call-btn {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
#journal-voice-btn:hover, #journal-send-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
#journal-call-btn:hover {
  color: var(--success);
  border-color: var(--success);
}
#journal-voice-btn.recording {
  color: var(--danger);
  border-color: var(--danger);
  animation: pulse 1.5s infinite;
}

/* Journal call bar — reuse interview-call-bar layout */
#journal-call-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}
#journal-call-bar.hidden { display: none !important; }
#journal-call-bar .call-round-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.voice-unavailable-notice {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

/* ==================== RECORD MODE ==================== */
#record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px 20px;
  flex: 1;
}

#record-status {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
}

.record-button {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 3px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.record-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.record-button.recording {
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 1.5s infinite;
}

#record-timer {
  font-size: 24px;
  font-weight: 300;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

#record-result {
  padding: 16px;
  overflow-y: auto;
}

#record-result h3 {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#transcript-text {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
}

#ingest-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1;
  min-width: 120px;
}
.stat-card .label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stat-card .value {
  font-size: 20px;
  font-weight: 600;
  margin-top: 4px;
}

/* ==================== PROFILE MODE ==================== */
#profile-content {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

#score-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.score-card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.score-card .label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.score-card .value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
}
.score-card .value.high { color: var(--success); }
.score-card .value.medium { color: var(--warning); }
.score-card .value.low { color: var(--danger); }

#coverage-bars { margin-bottom: 24px; }

#coverage-bars h3, #traits-table h3, #gaps-list h3 {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.coverage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.coverage-row .cat-name {
  width: 120px;
  font-size: 13px;
  color: var(--text);
  text-transform: capitalize;
}
.coverage-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.coverage-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.coverage-row .pct {
  width: 40px;
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Traits */
.trait-category { margin-bottom: 20px; }
.trait-category h4 {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: capitalize;
}
.trait-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.trait-row .dim {
  width: 120px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.trait-row .val {
  flex: 1;
  color: var(--text);
}
.trait-row .conf {
  width: 50px;
  text-align: right;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Gaps */
#gaps-list ul {
  list-style: none;
  columns: 2;
  column-gap: 16px;
}
#gaps-list li {
  font-size: 12px;
  color: var(--text-dim);
  padding: 2px 0;
  break-inside: avoid;
}
#gaps-list li::before {
  content: "\2022 ";
  color: var(--border);
}

/* ==================== CALL MODE ==================== */
.call-phase {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}
.call-phase.hidden { display: none !important; }

.call-phase-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
}
.call-phase-content h2 {
  font-size: 20px;
  font-weight: 600;
}

.call-hint {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
}
.call-persona-info {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.call-action-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.call-action-btn:hover { background: var(--accent-dim); }

.call-secondary-btn {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.call-secondary-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

#call-peer-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.peer-btn {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.peer-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.peer-btn::after {
  content: "Call \2192";
  float: right;
  color: var(--text-dim);
  font-size: 12px;
}
.peer-btn:hover::after { color: var(--accent); }

/* Ringing avatar with animated concentric pulse rings */
.ringing-avatar-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.ringing-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: ringing-expand 2s ease-out infinite;
}
.ringing-ring:nth-child(1) { width: 90px; height: 90px; animation-delay: 0s; }
.ringing-ring:nth-child(2) { width: 90px; height: 90px; animation-delay: 0.7s; }
.ringing-ring:nth-child(3) { width: 90px; height: 90px; animation-delay: 1.4s; }
@keyframes ringing-expand {
  0%   { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0; }
}
.ringing-pulse {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  animation: ringing-avatar-pulse 2s ease-in-out infinite;
}
@keyframes ringing-avatar-pulse {
  0%, 100% { transform: scale(0.95); }
  50% { transform: scale(1.05); }
}
/* Keep old ring-pulse for other uses */
@keyframes ring-pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 0.6; }
}

/* Active call live indicator dot */
.call-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: call-dot-pulse 1.2s ease-in-out infinite;
  display: inline-block;
}
.call-timer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

/* Speaker button */
.call-round-btn.speaker {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.call-round-btn.speaker:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.call-round-btn.speaker.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.call-round-btn.speaker.unsupported {
  opacity: 0.4;
  cursor: not-allowed;
}
.call-aux-controls {
  display: flex;
  gap: 20px;
  margin-top: 8px;
}

#call-ringing-actions {
  display: flex;
  gap: 32px;
  margin-top: 16px;
}

.call-round-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.call-round-btn.accept { background: var(--success); color: #fff; }
.call-round-btn.accept:hover { background: #16a34a; }
.call-round-btn.hangup { background: var(--danger); color: #fff; }
.call-round-btn.hangup:hover { background: #dc2626; }
.call-round-btn.mute {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.call-round-btn.mute:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.call-round-btn.mute.active {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.call-controls {
  display: flex;
  gap: 32px;
  margin-top: 24px;
}
.call-timer {
  font-size: 48px;
  font-weight: 200;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

#call-ingest-results {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 8px;
}

/* ==================== SETTINGS ==================== */
.settings-body {
  padding: 16px;
}

.settings-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child {
  border-bottom: none;
}
.settings-section h3 {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.settings-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.settings-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.settings-avatar.hidden { display: none; }

#settings-username {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.settings-row {
  display: flex;
  gap: 8px;
}
.settings-row .setup-input {
  flex: 1;
  text-align: left;
}

.settings-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.settings-btn:hover { background: var(--accent-dim); }

.settings-btn-danger {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.settings-btn-danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Delete account */
.delete-account-section h3 {
  font-size: 13px;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.delete-account-section p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.delete-account-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.delete-account-btn:hover {
  background: var(--danger);
  color: #fff;
}
.delete-confirm { margin-top: 12px; }
.delete-confirm.hidden { display: none; }
.delete-confirm-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
}
.delete-confirm-btn:hover { background: #dc2626; }

/* ==================== SHARE POPUP ==================== */
.share-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  min-width: 280px;
}
.share-popup.hidden { display: none; }

.share-pin {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  color: #fff;
  font-family: monospace;
  margin-bottom: 8px;
}
.share-url {
  font-size: 0.8rem;
  color: var(--text-dim);
  word-break: break-all;
  text-align: center;
  margin-bottom: 12px;
}
.share-copy-btn {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}
.share-copy-btn:hover { background: var(--accent-dim); }
.share-close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
}

/* ==================== GUIDANCE / ACTION BUTTONS ==================== */
.guidance-action-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}
.guidance-action-btn:hover { background: var(--accent-dim); }

/* ==================== TOAST ==================== */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  animation: toast-in 0.2s ease, toast-out 0.3s ease 2.7s forwards;
  white-space: nowrap;
}
.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ==================== HOME HEADER ACTIONS ==================== */
.home-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==================== SHARED PERSONA / CONTACTS ==================== */

/* Divider in conversation list */
.conv-divider {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 12px 8px;
  position: relative;
  text-align: center;
}
.conv-divider::before,
.conv-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 25%;
  height: 1px;
  background: var(--border);
  margin-top: 4px;
}
.conv-divider::before { left: 5%; }
.conv-divider::after { right: 5%; }

.conv-row-icon.shared-persona {
  background: var(--bg-elevated);
  border: 2px solid var(--success);
  color: var(--success);
  font-size: 16px;
  font-weight: 700;
}

/* ==================== SHARE PANEL ==================== */
#share-panel {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.share-panel-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.share-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.share-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.share-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 4px;
}

.share-actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-empty-state {
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0;
}

.share-connected-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.share-connected-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-action-btn {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.share-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.share-direct-row {
  display: flex;
  gap: 8px;
}

.share-pin-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.share-pin-input-small {
  font-size: 13px;
}

.invite-pending-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.invite-popup-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  text-align: center;
}
.invite-popup-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
  text-align: center;
}
.invite-share-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.invite-share-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.invite-share-btn:hover { opacity: 0.85; }
.invite-share-whatsapp { background: #25D366; color: #fff; }
.invite-share-email { background: var(--accent); color: #fff; }
.invite-share-copy { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); }

.share-username-input {
  flex: 1;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
.share-username-input:focus { border-color: var(--accent); }
.share-username-input::placeholder { color: var(--text-dim); }


.share-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.share-list-row:last-child { border-bottom: none; }

.share-list-label {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

.share-list-date {
  font-size: 12px;
  color: var(--text-dim);
}

.share-revoke-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}
.share-revoke-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ==================== UTILITIES ==================== */
.hidden { display: none !important; }

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

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
  .hero-card { margin: 12px; padding: 16px; }
  .hero-avatar-wrap { width: 64px; height: 64px; }
  .progress-ring { width: 64px; height: 64px; }
  .hero-initial { font-size: 22px; }
  .hero-name { font-size: 16px; }

  #gaps-list ul { columns: 1; }
  .trait-row .dim { width: 90px; }
  .coverage-row .cat-name { width: 90px; font-size: 12px; }
}

/* ==================== FLOATING CALL OVERLAY ==================== */
.call-floating-overlay {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  min-width: 280px;
  max-width: 360px;
  width: 90vw;
}
.call-floating-overlay.hidden { display: none !important; }

.call-floating-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}
.call-floating-content h2 {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

/* "Send to persona" button — indigo outline */
.call-round-btn.persona {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}
.call-round-btn.persona:hover {
  background: var(--accent);
  color: #fff;
}

/* Call button on contact rows */
.conv-call-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.conv-call-btn:hover {
  color: var(--accent);
  background: var(--bg-elevated);
}
.share-connected-row .conv-call-btn {
  color: var(--text-dim);
}

/* ==================== CONSENT MODAL ==================== */
.consent-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom, 0);
}
.consent-modal.hidden { display: none !important; }

.consent-modal-content {
  background: var(--bg-surface);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 32px;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.consent-modal-content h2 {
  font-size: 20px;
  font-weight: 600;
}
.consent-modal-content p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}

/* ==================== SETTINGS PERSONA STATS ==================== */
.settings-persona-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 12px;
  gap: 8px;
}
.settings-persona-ring-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}
.settings-persona-ring {
  width: 80px;
  height: 80px;
}
.settings-ring-initial {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}
.settings-persona-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.settings-persona-pct {
  font-size: 13px;
  color: var(--text-dim);
}

/* ==================== VOICEMAIL MESSAGES ==================== */
.voicemail-msg {
  border-left: 3px solid #6c63ff;
  font-style: italic;
  opacity: 0.9;
}
.voicemail-icon {
  font-style: normal;
  margin-right: 2px;
}

/* ==================== MISSED CALL SCREEN ==================== */
.call-missed-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  width: 100%;
}
#call-missed-screen h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ==================== INVITE BUTTON ==================== */
.share-invite-section {
  padding: 8px 0 4px;
}
.share-invite-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.share-invite-btn:hover { opacity: 0.88; }

/* Pending invite row */
.share-pending-row { opacity: 0.75; }
.share-pending-avatar { background: var(--bg-elevated) !important; color: var(--text-dim) !important; }

/* ==================== VOICEMAIL OVERLAY CONTROLS ==================== */
.voicemail-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==================== ACTIVE CALL BAR ==================== */
.call-active-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 998;
  background: #16a34a;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  font-size: 14px;
  font-weight: 500;
}
.call-active-bar.hidden { display: none !important; }
.call-active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #86efac;
  flex-shrink: 0;
  animation: call-dot-pulse 1.2s ease-in-out infinite;
}
@keyframes call-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.call-bar-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-bar-timer {
  font-size: 13px;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}
.call-bar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.call-bar-icon-btn:hover { background: rgba(255, 255, 255, 0.35); }
.call-bar-end-btn { background: #dc2626; }
.call-bar-end-btn:hover { background: #b91c1c; }
.call-bar-icon-btn.muted { background: rgba(255, 255, 255, 0.5); }
.call-active-dot.off-record { background: #6b7280; animation: none; cursor: default; }

/* ==================== PERSONA UPDATE ANIMATION ==================== */
.persona-update-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.persona-update-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: rgba(10, 10, 20, 0.82);
  padding: 14px 28px;
  border-radius: 40px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: persona-text-pop 3s ease forwards;
}
@keyframes persona-text-pop {
  0%   { opacity: 0; transform: scale(0.75); }
  12%  { opacity: 1; transform: scale(1.04); }
  20%  { transform: scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}
.persona-particle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: hsl(var(--hue), 75%, 65%);
  animation: persona-particle-fly calc(0.7s + var(--delay)) var(--delay) ease-out forwards;
}
@keyframes persona-particle-fly {
  0%   { transform: translate(-50%, -50%); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))); opacity: 0; }
}

/* ==================== VOICE PICKER ==================== */
.settings-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 0 0 10px 0;
}
.voice-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.voice-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.voice-option-btn.selected {
  background: #6c63ff;
  border-color: #6c63ff;
  color: #fff;
}
.voice-option-btn:not(.selected):hover {
  border-color: #6c63ff;
  background: #1e1a3a;
}
.voice-btn-name {
  font-weight: 600;
  font-size: 14px;
}
.voice-btn-hint {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

/* ==================== VOICE CLONE ==================== */
.voice-clone-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6c63ff, #4a90d9);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}
.voice-clone-btn.secondary {
  background: transparent;
  border: 1px solid #6c63ff;
  color: #6c63ff;
}
.voice-clone-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.voice-clone-status {
  font-size: 13px;
  color: #7bed9f;
  margin: 4px 0 8px;
}
.voice-sample-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
}
.voice-sample-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 1.5px solid var(--text-dim);
  flex-shrink: 0;
}
.voice-sample-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}
.voice-sample-status {
  font-size: 12px;
}
.voice-sample-status.none { color: var(--text-dim); }
.voice-sample-status.partial { color: var(--warning); }
.voice-sample-status.ready { color: var(--success); }
.voice-sample-status.cloned { color: var(--success); font-weight: 600; }
.settings-hint {
  font-size: 12px;
  color: #888;
  margin: 2px 0 8px;
}

/* ==================== QUICK SETUP CARD ==================== */
.quick-setup-card {
  border-left: 4px solid #6c63ff;
  background: #17152a;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.quick-setup-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}
.quick-setup-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.quick-setup-btn {
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.quick-setup-btn:hover {
  background: #5a52d5;
}

/* ==================== QUICK SETUP COMPLETION ==================== */
.interview-complete-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px;
  text-align: center;
}
.interview-complete-icon {
  font-size: 48px;
  color: #6c63ff;
  margin-bottom: 12px;
}
.interview-complete-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.interview-complete-hint {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.interview-complete-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ==================== CALL LEARNING SUMMARY ==================== */
.call-learning-card {
  border-left: 3px solid #6c63ff;
  background: #17152a;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
  text-align: left;
}
.call-learning-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.call-learning-item {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
  line-height: 1.4;
}
.call-learning-label {
  font-weight: 600;
  color: var(--text);
}
.call-learning-value {
  color: var(--text-dim);
}

/* ==================== DEMO CONTACT ROW ==================== */
.contact-demo-row {
  background: #17152a;
}
.contact-demo-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: #6c63ff;
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ==================== SHARED THREAD MESSAGES ==================== */
.chat-msg.other-user {
  align-self: flex-start;
  background: #1c2a3a;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg.other-user .msg-thread-label {
  color: #7aa0c8;
}

.chat-msg.digital-self {
  align-self: flex-start;
  background: #252535;
  color: var(--text-dim);
  border-bottom-left-radius: 4px;
  opacity: 0.85;
}

.msg-thread-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  margin-bottom: 3px;
  letter-spacing: 0.02em;
}

.chat-msg.digital-self .msg-thread-label {
  color: #aaa;
  font-style: italic;
}

/* ==================== AI NUDGE + REAL REPLY ==================== */
.ai-nudge-card {
  align-self: flex-start;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: #1e1800;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  max-width: 90%;
  margin-top: 2px;
  margin-bottom: 4px;
}

.ai-nudge-text {
  color: #d97706;
  flex: 1;
}

.ai-nudge-link {
  color: #f59e0b;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.ai-nudge-reply-btn {
  background: none;
  border: 1px solid #d97706;
  color: #d97706;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ai-nudge-reply-btn:hover {
  background: #2a1e00;
}

.real-reply-input-wrap {
  display: flex;
  gap: 6px;
  align-self: stretch;
  padding: 4px 0;
}

.real-reply-input {
  flex: 1;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  outline: none;
}

.real-reply-input::placeholder {
  color: var(--text-dim);
}

.real-reply-input:focus {
  border-color: var(--accent);
}

.real-reply-send-btn {
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chat-msg-status {
  font-size: 11px;
  color: #aaa;
  text-align: center;
  padding: 3px 0 6px;
  align-self: center;
}

.msg-tick {
  font-size: 10px;
  float: right;
  margin-left: 8px;
  margin-top: 3px;
  color: rgba(255,255,255,0.75);
  line-height: 1;
}
.msg-tick.pending {
  color: rgba(255,255,255,0.3);
}
.msg-tick.seen {
  color: #60a5fa;
}

/* ==================== VOICE CLONE MODAL ==================== */
.vc-step { display: flex; flex-direction: column; gap: 14px; }
.vc-step.hidden { display: none; }
.vc-step h2 { font-size: 18px; font-weight: 600; margin: 0; }
.vc-step p { font-size: 14px; color: #aaa; margin: 0; }

.vc-script-card {
  background: #12121e;
  border: 1px solid #2a2a45;
  border-radius: 16px;
  padding: 20px 20px 0;
  max-height: 42vh;
  overflow: hidden;
  position: relative;
}
.vc-script-scroll {
  max-height: 42vh;
  overflow-y: auto;
  padding-bottom: 48px;
  scrollbar-width: thin;
  scrollbar-color: #3a3a5a transparent;
}
.vc-script-label {
  font-size: 10px;
  font-weight: 700;
  color: #6c63ff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 16px;
}
.vc-script-text {
  font-size: 18px;
  line-height: 2.0;
  color: #f0f0f0;
  font-weight: 400;
}
.vc-script-text p { margin: 0 0 1.2em; }
.vc-script-text p:last-child { margin-bottom: 0; }
/* Sing-along word highlighting */
.vc-w { transition: color 0.12s, font-weight 0.12s; }
.vc-w.vc-done { color: #555; }
.vc-w.vc-active {
  color: #f5c842;
  font-weight: 600;
  text-shadow: 0 0 12px rgba(245,200,66,0.35);
}
/* Settings version footer */
.settings-version {
  text-align: center;
  font-size: 11px;
  color: #444;
  padding: 8px 0 4px;
  letter-spacing: 0.04em;
}
.vc-script-card::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: linear-gradient(to bottom, transparent, #12121e);
  border-radius: 0 0 16px 16px;
  pointer-events: none;
}
.vc-quality-hint {
  font-size: 12px;
  color: #888;
  min-height: 18px;
  text-align: center;
  transition: color 0.4s ease;
}
.vc-quality-hint.good { color: #4ade80; }

.vc-record-area { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0; }
#vc-timer { font-size: 28px; font-weight: 300; color: #ddd; font-variant-numeric: tabular-nums; }

.vc-progress-bar {
  width: 100%; height: 6px;
  background: #2a2a3a; border-radius: 3px; overflow: hidden;
}
.vc-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #6c63ff, #4a90d9);
  border-radius: 3px;
  transition: width 0.3s ease;
}
#vc-progress-pct { font-size: 13px; color: #888; text-align: center; }
#vc-upload-status { text-align: center; }

.vc-cancel-link {
  background: none; border: none;
  color: #666; font-size: 13px; cursor: pointer;
  text-align: center; padding: 4px;
}
.vc-record-error {
  color: #ef4444; font-size: 13px; text-align: center; margin: 0;
}

/* ==================== EDGE PANEL (bottom sheet) ==================== */
.edge-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
}
.edge-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.edge-panel.open {
  transform: translateY(0);
}
.edge-panel-handle {
  width: 40px;
  height: 4px;
  background: var(--text-dim);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.edge-panel-section {
  margin-bottom: 20px;
}
.edge-panel-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.edge-shift-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}
.edge-shift-label {
  font-size: 13px;
  color: var(--text);
  min-width: 90px;
}
.edge-shift-bar {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  height: 20px;
}
.edge-shift-arrow-activated {
  color: #f0a040;
  font-size: 13px;
}
.edge-shift-arrow-suppressed {
  color: var(--text-dim);
  font-size: 13px;
}
.edge-pattern-summary {
  font-style: italic;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 4px;
}
.edge-status-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-dim);
}
.edge-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-elevated);
  border-radius: 8px;
  color: var(--text-dim);
  display: inline-block;
}
.edge-panel-header {
  margin-bottom: 16px;
}
.edge-panel-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.edge-panel-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

/* ==================== PERSONA VERSION PICKER (bottom sheet) ==================== */
.persona-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
}
.persona-picker-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  padding: 16px 16px 32px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.persona-picker-sheet.open {
  transform: translateY(0);
}
.persona-picker-handle {
  width: 40px;
  height: 4px;
  background: var(--text-dim);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.persona-picker-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.persona-picker-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.persona-picker-option:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
}
.persona-picker-option-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  color: var(--accent);
  border: 1px solid var(--border);
}
.persona-picker-option-icon.default-icon {
  color: var(--text-dim);
}
.persona-picker-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.persona-picker-option-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.persona-picker-option-desc {
  font-size: 12px;
  color: var(--text-dim);
}
