/* Alfred — Premium UI v2 */
:root {
  --bg: #08080c;
  --bg-secondary: #12121a;
  --bg-tertiary: #1c1c26;
  --bg-hover: #24243a;
  --border: rgba(255,255,255,0.06);
  --border-active: rgba(108,99,255,0.3);
  --text: #eeeef2;
  --text-secondary: #9898a8;
  --text-muted: #58586a;
  --primary: #7c6cff;
  --primary-hover: #6a5ae0;
  --primary-light: rgba(124,108,255,0.1);
  --primary-glow: rgba(124,108,255,0.2);
  --success: #34d399;
  --success-light: rgba(52,211,153,0.1);
  --warning: #fbbf24;
  --danger: #f87171;
  --accent: #38bdf8;
  --gold: #e8b84b;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-width: 250px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 64px rgba(0,0,0,0.5);
  --glass: rgba(18,18,26,0.8);
  --glass-border: rgba(255,255,255,0.04);
}

* { margin:0; padding:0; box-sizing:border-box; }
html, body { height:100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
}

/* Screens */
.screen { display:none; height:100vh; }
.screen.active { display:flex; }

/* Auth Screen */
.auth-container {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  width:100%; gap:2rem;
}
.auth-logo { text-align:center; }
.logo-icon {
  width:80px; height:80px; border-radius:24px; background:linear-gradient(135deg,var(--primary),#8b5cf6);
  display:inline-flex; align-items:center; justify-content:center;
  font-size:36px; font-weight:700; color:#fff; margin-bottom:1rem;
}
.auth-logo h1 { font-size:2.5rem; font-weight:700; }
.auth-subtitle { color:var(--text-secondary); font-size:1.1rem; margin-top:0.25rem; }

.auth-card {
  background:var(--bg-secondary); border:1px solid var(--border); border-radius:var(--radius);
  padding:2rem; width:100%; max-width:400px; display:flex; flex-direction:column; gap:1rem;
}
.auth-divider {
  display:flex; align-items:center; gap:1rem; color:var(--text-muted); font-size:0.85rem;
}
.auth-divider::before, .auth-divider::after { content:''; flex:1; height:1px; background:var(--border); }
.auth-note { color:var(--text-muted); font-size:0.8rem; text-align:center; }

/* Buttons */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:0.5rem;
  padding:0.7rem 1.2rem; border:none; border-radius:var(--radius-sm);
  font-family:inherit; font-size:0.9rem; font-weight:500; cursor:pointer;
  transition:all 0.15s;
}
.btn-google { background:#fff; color:#333; }
.btn-google:hover { background:#f0f0f0; }
.btn-demo { background:var(--bg-tertiary); color:var(--text); border:1px solid var(--border); }
.btn-demo:hover { background:var(--bg-hover); }

/* Demo user selection grid */
.demo-user-grid { display:grid; grid-template-columns:1fr; gap:8px; margin:8px 0; max-height:320px; overflow-y:auto; }
.btn-demo-user {
  display:flex; align-items:center; gap:12px; padding:12px 16px;
  background:var(--bg-tertiary); border:1px solid var(--border); border-radius:10px;
  color:var(--text); cursor:pointer; text-align:left; transition:all .15s;
}
.btn-demo-user:hover { background:var(--bg-hover); border-color:var(--primary); transform:translateY(-1px); }
.demo-emoji { font-size:1.6rem; flex-shrink:0; }
.demo-name { font-weight:600; font-size:.95rem; white-space:nowrap; }
.demo-tagline { font-size:.8rem; color:var(--text-muted); flex:1; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-hover); }
.btn-outline { background:transparent; color:var(--text); border:1px solid var(--border); }
.btn-outline:hover { background:var(--bg-hover); }
.btn-sm { padding:0.4rem 0.8rem; font-size:0.8rem; }
.btn-icon {
  background:none; border:none; color:var(--text-secondary); cursor:pointer;
  font-size:1.1rem; padding:0.3rem; border-radius:6px; transition:all 0.15s;
}
.btn-icon:hover { background:var(--bg-hover); color:var(--text); }

/* Main App Layout */
#main-app { display:flex; }

/* Sidebar */
#sidebar {
  width:var(--sidebar-width); height:100vh; background:var(--bg-secondary);
  border-right:1px solid var(--border); display:flex; flex-direction:column;
  flex-shrink:0; padding:1rem 0.75rem;
}
.sidebar-header {
  display:flex; align-items:center; gap:0.7rem; padding:0.5rem 0.5rem 1.5rem;
}
.logo-small {
  width:36px; height:36px; border-radius:10px; background:linear-gradient(135deg,var(--primary),#8b5cf6);
  display:flex; align-items:center; justify-content:center;
  font-size:16px; font-weight:700; color:#fff;
}
.logo-text { font-size:1.2rem; font-weight:600; }

.sidebar-nav { flex:1; display:flex; flex-direction:column; gap:2px; }
.nav-item {
  display:flex; align-items:center; gap:0.7rem; padding:0.6rem 0.75rem;
  background:none; border:none; color:var(--text-secondary); border-radius:var(--radius-sm);
  font-family:inherit; font-size:0.9rem; cursor:pointer; transition:all 0.15s; width:100%;
  text-align:left;
}
.nav-item:hover { background:var(--bg-hover); color:var(--text); }
.nav-item.active { background:var(--primary-light); color:var(--primary); font-weight:500; }
.nav-icon { font-size:1.1rem; width:1.5rem; text-align:center; }

.sidebar-footer {
  display:flex; align-items:center; gap:0.5rem; padding-top:1rem;
  border-top:1px solid var(--border); margin-top:0.5rem;
}
.user-profile { display:flex; align-items:center; gap:0.5rem; flex:1; min-width:0; }
.avatar-sm {
  width:32px; height:32px; border-radius:8px; object-fit:cover;
  background:var(--bg-tertiary);
}
.user-info-sm { min-width:0; }
.user-name-sm { font-size:0.8rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-email-sm { font-size:0.7rem; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Content */
#content { flex:1; height:100vh; overflow:hidden; }
.view { display:none; height:100%; overflow-y:auto; padding:1.5rem 2rem; }
.view.active { display:block; }

.view-header {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:1.5rem; flex-wrap:wrap; gap:1rem;
}
.view-header h2 { font-size:1.5rem; font-weight:600; }

/* Chat */
#view-chat { padding:0; display:none; }
#view-chat.active { display:flex; }
.chat-container { display:flex; flex-direction:column; height:100%; width:100%; }
.chat-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:1rem 1.5rem; border-bottom:1px solid var(--border);
}
.chat-header h2 { font-size:1.2rem; font-weight:600; }

.chat-messages {
  flex:1; overflow-y:auto; padding:1.5rem; display:flex; flex-direction:column; gap:1rem;
}
.message {
  display:flex; gap:0.75rem; max-width:85%; animation:fadeIn 0.2s;
}
.message.user { align-self:flex-end; flex-direction:row-reverse; }
.message-avatar {
  width:32px; height:32px; border-radius:8px; background:linear-gradient(135deg,var(--primary),#8b5cf6);
  display:flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:600; color:#fff; flex-shrink:0;
}
.message.user .message-avatar { background:var(--bg-tertiary); }
.message-content {
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius); padding:0.8rem 1rem; font-size:0.9rem; line-height:1.7;
}
.message.user .message-content { background:var(--primary); border-color:var(--primary); color:#fff; }
.message-content p { margin-bottom:0.5rem; }
.message-content p:last-child { margin-bottom:0; }
.message-content ul { padding-left:1.2rem; margin:0.5rem 0; }
.message-content li { margin:0.25rem 0; }
.message-content strong { font-weight:600; }
.message-content code { background:rgba(255,255,255,0.1); padding:0.1rem 0.4rem; border-radius:4px; font-size:0.85rem; }

.chat-input-area { padding:1rem 1.5rem; border-top:1px solid var(--border); }
.chat-input-wrapper {
  display:flex; align-items:flex-end; gap:0.5rem;
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius); padding:0.5rem 0.75rem;
  transition:border-color 0.15s;
}
.chat-input-wrapper:focus-within { border-color:var(--primary); }
#chat-input {
  flex:1; background:none; border:none; color:var(--text); font-family:inherit;
  font-size:0.9rem; resize:none; outline:none; min-height:24px; max-height:120px;
  line-height:1.5; padding:0.25rem 0;
}
.btn-send {
  background:var(--primary); color:#fff; border:none; border-radius:8px;
  width:36px; height:36px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all 0.15s; flex-shrink:0;
}
.btn-send:hover { background:var(--primary-hover); }
.btn-send:disabled { opacity:0.5; cursor:default; }

/* Dashboard Grid */
.dashboard-grid {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:1.25rem;
}
.dash-card {
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius); padding:1.25rem; overflow:hidden;
}
.dash-card.wide { grid-column:1 / -1; }
.dash-card h3 { font-size:1rem; font-weight:600; margin-bottom:1rem; }
.dash-content { max-height:300px; overflow-y:auto; }

/* Event Items */
.event-item {
  display:flex; align-items:flex-start; gap:0.75rem; padding:0.75rem 0;
  border-bottom:1px solid var(--border);
}
.event-item:last-child { border-bottom:none; }
.event-time {
  font-size:0.8rem; font-weight:500; color:var(--primary); min-width:60px;
  padding-top:0.1rem;
}
.event-dot { width:8px; height:8px; border-radius:50%; background:var(--primary); margin-top:0.4rem; flex-shrink:0; }
.event-info { flex:1; }
.event-title { font-size:0.9rem; font-weight:500; }
.event-detail { font-size:0.8rem; color:var(--text-muted); margin-top:0.1rem; }

/* Email Items */
.email-item {
  display:flex; align-items:flex-start; gap:0.75rem; padding:0.8rem 1rem;
  border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.15s;
}
.email-item:hover { background:var(--bg-hover); }
.email-item.unread .email-subject { font-weight:600; }
.email-item.unread::before {
  content:''; width:8px; height:8px; border-radius:50%;
  background:var(--primary); flex-shrink:0; margin-top:0.5rem;
}
.email-sender { font-size:0.85rem; font-weight:500; min-width:150px; }
.email-content { flex:1; min-width:0; }
.email-subject { font-size:0.85rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.email-snippet { font-size:0.8rem; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:0.15rem; }

/* Task Items */
.task-item {
  display:flex; align-items:center; gap:0.75rem; padding:0.75rem 1rem;
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius-sm); margin-bottom:0.5rem; transition:all 0.15s;
}
.task-item:hover { background:var(--bg-hover); }
.task-priority {
  width:4px; height:100%; min-height:24px; border-radius:2px;
}
.task-priority.urgent { background:var(--danger); }
.task-priority.high { background:var(--warning); }
.task-priority.medium { background:var(--primary); }
.task-priority.low { background:var(--text-muted); }
.task-info { flex:1; }
.task-title { font-size:0.9rem; font-weight:500; }
.task-meta { font-size:0.75rem; color:var(--text-muted); margin-top:0.15rem; }
.task-status {
  font-size:0.75rem; padding:0.2rem 0.6rem; border-radius:20px;
  background:var(--bg-tertiary); color:var(--text-secondary);
}
.task-status.completed { background:rgba(52,211,153,0.15); color:var(--success); }
.task-status.in_progress { background:var(--primary-light); color:var(--primary); }

/* Task Filters */
.task-filters { display:flex; gap:0.5rem; }
.filter-btn {
  padding:0.35rem 0.8rem; border:1px solid var(--border); border-radius:20px;
  background:none; color:var(--text-secondary); font-family:inherit;
  font-size:0.8rem; cursor:pointer; transition:all 0.15s;
}
.filter-btn:hover { background:var(--bg-hover); }
.filter-btn.active { background:var(--primary-light); color:var(--primary); border-color:var(--primary); }

/* Agent Cards */
.agents-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(250px, 1fr)); gap:1rem; }
.agent-card {
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius); padding:1.25rem; text-align:center;
}
.agent-icon { font-size:2rem; margin-bottom:0.75rem; }
.agent-card h3 { font-size:1rem; font-weight:600; margin-bottom:0.4rem; }
.agent-card p { font-size:0.8rem; color:var(--text-secondary); margin-bottom:0.75rem; }
.agent-status {
  display:inline-block; font-size:0.75rem; padding:0.2rem 0.7rem;
  border-radius:20px; background:rgba(52,211,153,0.15); color:var(--success);
}

/* Activity Log */
.activity-log { display:flex; flex-direction:column; gap:0.5rem; }
.activity-item {
  display:flex; align-items:center; gap:0.75rem; padding:0.6rem 0.75rem;
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius-sm); font-size:0.85rem;
}
.activity-agent {
  font-size:0.7rem; padding:0.15rem 0.5rem; border-radius:12px;
  background:var(--primary-light); color:var(--primary); font-weight:500;
  white-space:nowrap;
}
.activity-text { flex:1; color:var(--text-secondary); }
.activity-time { font-size:0.75rem; color:var(--text-muted); }

/* Loading & Empty */
.loading-placeholder {
  color:var(--text-muted); font-size:0.85rem; padding:1rem;
  text-align:center; font-style:italic;
}
.text-muted { color:var(--text-muted); }
.empty-state {
  text-align:center; padding:2rem; color:var(--text-muted);
}
.empty-state-icon { font-size:2.5rem; margin-bottom:0.75rem; }

/* Typing indicator */
.typing-indicator {
  display:flex; gap:4px; padding:0.5rem 0;
}
.typing-indicator span {
  width:8px; height:8px; border-radius:50%; background:var(--text-muted);
  animation:typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay:0.2s; }
.typing-indicator span:nth-child(3) { animation-delay:0.4s; }

/* Scrollbar */
::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--text-muted); }

/* Animations */
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes typing {
  0%, 60%, 100% { transform:translateY(0); opacity:0.4; }
  30% { transform:translateY(-4px); opacity:1; }
}

/* Mobile */
@media (max-width: 768px) {
  #sidebar { width:60px; padding:0.5rem; }
  .logo-text, .nav-label, .user-info-sm { display:none; }
  .sidebar-header { justify-content:center; padding-bottom:1rem; }
  .nav-item { justify-content:center; padding:0.6rem; }
  .sidebar-footer { flex-direction:column; }
  .user-profile { justify-content:center; }
  #content .view { padding:1rem; }
  .dashboard-grid { grid-template-columns:1fr; }
  .message { max-width:95%; }
}

/* Events List */
.events-list {
  display:flex; flex-direction:column; gap:0.5rem;
}
.event-card {
  display:flex; gap:1rem; padding:1rem 1.25rem;
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius-sm); align-items:flex-start;
}
.event-card-time {
  min-width:80px; font-size:0.85rem; font-weight:500; color:var(--primary);
}
.event-card-details { flex:1; }
.event-card-title { font-weight:500; }
.event-card-location { font-size:0.8rem; color:var(--text-muted); margin-top:0.2rem; }

/* Email List */
.email-list {
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius); overflow:hidden;
}
.tasks-list { display:flex; flex-direction:column; gap:0.5rem; }

/* ── Phone / Calls ── */
.twilio-badge { padding:0.25rem 0.75rem; border-radius:999px; font-size:0.8rem; font-weight:500; }
.twilio-badge.demo { background:rgba(255,180,0,0.15); color:#ffb400; }
.twilio-badge.live { background:rgba(0,200,83,0.15); color:#00c853; }

.phone-layout { display:grid; grid-template-columns:360px 1fr; gap:1.5rem; align-items:start; }
@media (max-width:800px) { .phone-layout { grid-template-columns:1fr; } }

.phone-panel {
  background:var(--bg-secondary); border:1px solid var(--border);
  border-radius:var(--radius); padding:1.25rem; overflow:hidden;
}
.history-panel { min-height:500px; }

.hidden { display:none !important; }

/* Dial pad */
.dial-display { display:flex; gap:0.5rem; margin-bottom:1rem; }
.dial-number-input {
  flex:1; background:var(--bg-tertiary); border:1px solid var(--border);
  border-radius:var(--radius); padding:0.75rem 1rem; font-size:1.3rem;
  color:var(--text); text-align:center; font-family:inherit; letter-spacing:2px;
}
.dial-number-input:focus { outline:none; border-color:var(--primary); }
.btn-clear-dial {
  background:var(--bg-tertiary); border:1px solid var(--border); border-radius:var(--radius);
  color:var(--text-secondary); font-size:1.2rem; padding:0 0.75rem; cursor:pointer;
}
.btn-clear-dial:hover { background:var(--bg-hover); }

.dialpad-grid {
  display:grid; grid-template-columns:repeat(3, 1fr); gap:0.5rem; margin-bottom:1rem;
}
.dial-btn {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  background:var(--bg-tertiary); border:1px solid var(--border); border-radius:var(--radius);
  padding:0.75rem 0; cursor:pointer; transition:all 0.15s;
}
.dial-btn:hover { background:var(--bg-hover); border-color:var(--primary); }
.dial-btn:active { transform:scale(0.95); }
.dial-num { font-size:1.3rem; font-weight:600; color:var(--text); }
.dial-sub { font-size:0.6rem; color:var(--text-muted); letter-spacing:2px; }

.dial-call-row { margin-bottom:1.5rem; }
.btn-dial-call {
  width:100%; padding:0.75rem; background:var(--success, #00c853); color:#fff;
  border:none; border-radius:var(--radius); font-size:1rem; font-weight:600;
  cursor:pointer; transition:all 0.15s;
}
.btn-dial-call:hover { filter:brightness(1.15); }

/* Quick contacts */
.quick-contacts h3 { font-size:0.85rem; color:var(--text-secondary); margin-bottom:0.75rem; }
.contacts-grid { display:flex; flex-wrap:wrap; gap:0.5rem; }
.contact-chip {
  display:flex; align-items:center; gap:0.4rem; padding:0.4rem 0.75rem;
  background:var(--bg-tertiary); border:1px solid var(--border); border-radius:999px;
  cursor:pointer; transition:all 0.15s; color:var(--text); font-size:0.85rem;
}
.contact-chip:hover { background:var(--bg-hover); border-color:var(--primary); }
.contact-avatar {
  width:24px; height:24px; border-radius:50%; background:var(--primary);
  display:flex; align-items:center; justify-content:center;
  font-size:0.7rem; font-weight:600; color:#fff;
}

/* Active call */
.active-call-panel { text-align:center; padding:2rem 1rem; }
.active-call-info { margin-bottom:2rem; }
.call-avatar-lg { font-size:3rem; margin-bottom:0.75rem; }
.call-contact-name { font-size:1.3rem; font-weight:600; color:var(--text); }
.call-number { color:var(--text-secondary); font-size:0.9rem; margin-top:0.25rem; }
.call-timer { font-size:1.8rem; font-weight:300; color:var(--primary); margin-top:1rem; font-variant-numeric:tabular-nums; }
.call-actions { display:flex; gap:1rem; justify-content:center; flex-wrap:wrap; }
.btn-call-action {
  width:50px; height:50px; border-radius:50%; background:var(--bg-tertiary);
  border:1px solid var(--border); cursor:pointer; font-size:1.2rem;
  display:flex; align-items:center; justify-content:center; transition:all 0.15s;
}
.btn-call-action:hover { background:var(--bg-hover); }
.btn-call-end {
  display:flex; align-items:center; gap:0.5rem; padding:0.75rem 1.5rem;
  background:#e53935; color:#fff; border:none; border-radius:999px;
  font-size:0.95rem; font-weight:600; cursor:pointer;
}
.btn-call-end:hover { background:#c62828; }

/* Call history */
.history-tabs { display:flex; gap:0.5rem; margin-bottom:1rem; }
.htab {
  padding:0.4rem 0.85rem; border-radius:999px; border:1px solid var(--border);
  background:transparent; color:var(--text-secondary); cursor:pointer; font-size:0.8rem;
  transition:all 0.15s;
}
.htab:hover { background:var(--bg-hover); }
.htab.active { background:var(--primary); color:#fff; border-color:var(--primary); }

.call-history-list { display:flex; flex-direction:column; gap:0.25rem; }
.call-history-item {
  display:flex; align-items:center; gap:0.75rem; padding:0.7rem 0.5rem;
  border-radius:var(--radius); transition:background 0.15s;
}
.call-history-item:hover { background:var(--bg-hover); }
.call-history-item.missed .call-h-name { color:#e53935; }
.call-icon { font-size:1.2rem; flex-shrink:0; }
.call-details { flex:1; min-width:0; }
.call-h-name { font-weight:500; color:var(--text); font-size:0.9rem; }
.call-h-meta { color:var(--text-muted); font-size:0.78rem; margin-top:0.1rem; }
.call-h-time { color:var(--text-muted); font-size:0.78rem; white-space:nowrap; }
.btn-call-back {
  background:transparent; border:none; cursor:pointer; font-size:1rem;
  opacity:0; transition:opacity 0.15s;
}
.call-history-item:hover .btn-call-back { opacity:1; }

/* =================== Onboarding Wizard =================== */
.onboarding-container {
  display:flex; height:100vh; width:100%;
}
.onboarding-sidebar {
  width:280px; background:var(--bg-secondary); border-right:1px solid var(--border);
  padding:2rem 1.5rem; display:flex; flex-direction:column; gap:2rem;
}
.onboarding-logo { display:flex; align-items:center; gap:0.75rem; }
.onboarding-logo h2 { font-size:1.3rem; font-weight:600; }
.onboarding-steps { display:flex; flex-direction:column; gap:0.25rem; }
.onboarding-step-item {
  display:flex; align-items:center; gap:0.75rem; padding:0.6rem 0.75rem;
  border-radius:var(--radius-sm); font-size:0.9rem; color:var(--text-secondary);
  transition:all 0.15s; cursor:default;
}
.onboarding-step-item.active { background:var(--primary-light); color:var(--primary); font-weight:500; }
.onboarding-step-item.completed { color:var(--success); }
.onboarding-step-item.skipped { color:var(--text-muted); text-decoration:line-through; }
.step-indicator {
  width:24px; height:24px; border-radius:50%; border:2px solid var(--border);
  display:flex; align-items:center; justify-content:center; font-size:0.7rem; flex-shrink:0;
}
.onboarding-step-item.active .step-indicator { border-color:var(--primary); background:var(--primary); color:#fff; }
.onboarding-step-item.completed .step-indicator { border-color:var(--success); background:var(--success); color:#fff; }
.onboarding-step-item.skipped .step-indicator { border-color:var(--text-muted); }

.onboarding-content {
  flex:1; padding:3rem 4rem; overflow-y:auto; display:flex; flex-direction:column;
  align-items:center; justify-content:center;
}
.onboarding-card {
  max-width:560px; width:100%;
}
.onboarding-card h1 { font-size:1.8rem; font-weight:700; margin-bottom:0.5rem; }
.onboarding-card .subtitle { color:var(--text-secondary); margin-bottom:2rem; font-size:1rem; }
.onboarding-card p { margin-bottom:1rem; line-height:1.7; }
.onboarding-card .feature-list { list-style:none; padding:0; margin:1.5rem 0; }
.onboarding-card .feature-list li {
  padding:0.5rem 0; font-size:0.95rem; display:flex; align-items:center; gap:0.5rem;
}
.onboarding-card .feature-list li span.feat-icon { font-size:1.2rem; }
.onboarding-field { margin-bottom:1.25rem; }
.onboarding-field label { display:block; font-size:0.85rem; font-weight:500; margin-bottom:0.4rem; color:var(--text-secondary); }
.onboarding-field input, .onboarding-field select {
  width:100%; padding:0.65rem 0.9rem; border-radius:var(--radius-sm);
  border:1px solid var(--border); background:var(--bg-tertiary); color:var(--text);
  font-size:0.9rem; outline:none; transition:border 0.15s;
}
.onboarding-field input:focus, .onboarding-field select:focus { border-color:var(--primary); }
.onboarding-actions { display:flex; gap:0.75rem; margin-top:2rem; }
.onboarding-actions .btn { flex:1; padding:0.7rem 1.2rem; }
.btn-skip { background:transparent; border:1px solid var(--border); color:var(--text-secondary); cursor:pointer; border-radius:var(--radius-sm); }
.btn-skip:hover { background:var(--bg-hover); }

.health-checks { margin:1.5rem 0; }
.health-check-item {
  display:flex; align-items:center; gap:0.75rem; padding:0.6rem 0;
  border-bottom:1px solid var(--border);
}
.health-check-item:last-child { border-bottom:none; }
.health-dot {
  width:10px; height:10px; border-radius:50%; flex-shrink:0;
}
.health-dot.ok { background:var(--success); }
.health-dot.error { background:var(--danger); }
.health-dot.not_configured { background:var(--warning); }
.health-service { font-weight:500; flex:1; }
.health-message { color:var(--text-muted); font-size:0.82rem; }

.help-box {
  background:var(--bg-tertiary); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:1rem; margin:1rem 0; font-size:0.88rem; line-height:1.6;
}
.help-box code { background:var(--bg-hover); padding:0.15rem 0.4rem; border-radius:4px; font-size:0.82rem; }

/* =================== Premium Design System =================== */

/* Subtle gradient background for body */
body::before {
  content:''; position:fixed; inset:0; z-index:-1;
  background: radial-gradient(ellipse at 20% 0%, rgba(124,108,255,0.04) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 100%, rgba(56,189,248,0.03) 0%, transparent 50%);
  pointer-events:none;
}

/* Glass morphism card effect */
.dash-card, .agent-card, .phone-panel, .auth-card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.dash-card:hover, .agent-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow), 0 0 20px var(--primary-glow);
  transform: translateY(-1px);
}

/* Sidebar glow accent */
#sidebar {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(12,12,18,1) 100%);
  border-right: 1px solid var(--glass-border);
}
.nav-item.active {
  background: linear-gradient(135deg, var(--primary-light), rgba(56,189,248,0.05));
  color: var(--primary);
  font-weight: 600;
  border-left: 2px solid var(--primary);
}
.nav-item:hover:not(.active) {
  background: rgba(255,255,255,0.03);
}

/* Auth screen premium look */
.auth-container { background: radial-gradient(ellipse at center, rgba(124,108,255,0.06) 0%, transparent 60%); }
.logo-icon {
  background: linear-gradient(135deg, var(--primary), #a78bfa, var(--accent));
  box-shadow: 0 8px 24px rgba(124,108,255,0.3);
}

/* Chat — premium message bubbles */
.message { animation: slideIn 0.25s ease-out; }
.message.assistant .message-content {
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
}
.message.user .message-content {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border: none;
  box-shadow: 0 4px 12px rgba(124,108,255,0.25);
}

/* Premium send button */
.btn-send {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 2px 8px rgba(124,108,255,0.3);
  transition: all 0.2s;
}
.btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(124,108,255,0.4);
}

/* Task priority glow */
.task-priority.urgent { background: var(--danger); box-shadow: 0 0 6px rgba(248,113,113,0.5); }
.task-priority.high { background: var(--warning); box-shadow: 0 0 6px rgba(251,191,36,0.4); }

/* Agent status pulse */
.agent-status {
  animation: pulse-glow 2s infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
  50% { box-shadow: 0 0 8px 2px rgba(52,211,153,0.2); }
}

/* Premium button styles */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 2px 8px rgba(124,108,255,0.25);
  transition: all 0.2s;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,108,255,0.35);
}

/* View header gradient line */
.view-header h2 {
  background: linear-gradient(135deg, var(--text) 50%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Active call — premium look */
.call-timer {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Onboarding step completed glow */
.onboarding-step-item.completed .step-indicator {
  box-shadow: 0 0 8px rgba(52,211,153,0.3);
}
.onboarding-step-item.active .step-indicator {
  box-shadow: 0 0 8px rgba(124,108,255,0.3);
}

/* Smooth transitions everywhere */
* { transition-property: background-color, border-color, color, opacity, box-shadow, transform;
    transition-duration: 0.15s; transition-timing-function: ease-out; }
input, textarea, button { transition-duration: 0.15s; }

/* Slide-in animation for new content */
@keyframes slideIn {
  from { opacity:0; transform:translateY(8px); }
  to { opacity:1; transform:translateY(0); }
}

/* Scrollbar premium style */
::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(124,108,255,0.2); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:rgba(124,108,255,0.4); }

/* Dashboard card headers */
.dash-card h3 { font-size:0.95rem; font-weight:600; letter-spacing:-0.01em; }

/* Empty state improvement */
.empty-state { opacity:0.6; }
.empty-state-icon { opacity:0.5; }

/* Focus states */
input:focus, textarea:focus, select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(124,108,255,0.1);
}

/* Chat input premium */
.chat-input-wrapper {
  background: var(--glass);
  backdrop-filter: blur(8px);
}
.chat-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,108,255,0.08);
}

/* =================== Command Palette =================== */
.cmd-trigger {
  display:flex; align-items:center; gap:0.5rem;
  width:100%; padding:0.5rem 0.75rem; margin-bottom:1rem;
  background:var(--bg-tertiary); border:1px solid var(--border);
  border-radius:var(--radius-sm); color:var(--text-muted);
  font-size:0.82rem; cursor:pointer; transition:all 0.15s;
}
.cmd-trigger:hover { border-color:var(--border-active); color:var(--text-secondary); background:var(--bg-hover); }
.cmd-trigger kbd {
  margin-left:auto; font-size:0.7rem; padding:0.15rem 0.4rem;
  background:var(--bg); border:1px solid var(--border); border-radius:4px;
  font-family:inherit; color:var(--text-muted);
}
.cmd-trigger span { flex:1; text-align:left; }

.cmd-overlay {
  display:none; position:fixed; inset:0; z-index:9999;
  background:rgba(0,0,0,0.6); backdrop-filter:blur(4px);
  align-items:flex-start; justify-content:center; padding-top:15vh;
}
.cmd-overlay.active { display:flex; animation:fadeIn 0.15s; }

.cmd-palette {
  width:560px; max-width:90vw; background:var(--bg-secondary);
  border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-lg); overflow:hidden;
}
.cmd-input-wrapper {
  display:flex; align-items:center; gap:0.5rem;
  padding:0.75rem 1rem; border-bottom:1px solid var(--border);
}
.cmd-search-icon { color:var(--text-muted); flex-shrink:0; }
.cmd-input-wrapper input {
  flex:1; background:none; border:none; color:var(--text);
  font-size:1rem; outline:none; font-family:inherit;
}
.cmd-shortcut {
  font-size:0.7rem; padding:0.15rem 0.4rem;
  background:var(--bg-tertiary); border:1px solid var(--border);
  border-radius:4px; color:var(--text-muted); font-family:inherit;
}

.cmd-results { max-height:360px; overflow-y:auto; padding:0.5rem; }
.cmd-group-label {
  font-size:0.7rem; text-transform:uppercase; letter-spacing:0.05em;
  color:var(--text-muted); padding:0.5rem 0.75rem 0.25rem; font-weight:600;
}
.cmd-item {
  display:flex; align-items:center; gap:0.75rem;
  padding:0.6rem 0.75rem; border-radius:var(--radius-sm);
  cursor:pointer; transition:background 0.1s; font-size:0.9rem;
}
.cmd-item:hover, .cmd-item.active { background:var(--primary-light); color:var(--primary); }
.cmd-item-icon { font-size:1.1rem; width:1.5rem; text-align:center; flex-shrink:0; }
.cmd-item-label { flex:1; }
.cmd-item-hint { font-size:0.75rem; color:var(--text-muted); }

.cmd-footer {
  display:flex; gap:1rem; padding:0.5rem 1rem;
  border-top:1px solid var(--border); font-size:0.72rem; color:var(--text-muted);
}
.cmd-footer kbd {
  font-size:0.65rem; padding:0.1rem 0.3rem; background:var(--bg-tertiary);
  border:1px solid var(--border); border-radius:3px; font-family:inherit;
}

/* =================== Agent Status Chip =================== */
.chat-header-actions { display:flex; align-items:center; gap:0.75rem; }
.agent-status-chip {
  display:flex; align-items:center; gap:0.4rem;
  padding:0.3rem 0.7rem; border-radius:20px;
  font-size:0.75rem; font-weight:500;
  background:var(--bg-tertiary); border:1px solid var(--border);
}
.agent-status-chip .status-dot {
  width:6px; height:6px; border-radius:50%;
}
.agent-status-chip.idle .status-dot { background:var(--success); }
.agent-status-chip.idle .status-text { color:var(--success); }
.agent-status-chip.thinking .status-dot { background:var(--warning); animation:pulse-glow 1s infinite; }
.agent-status-chip.thinking .status-text { color:var(--warning); }
.agent-status-chip.working .status-dot { background:var(--primary); animation:pulse-glow 0.8s infinite; }
.agent-status-chip.working .status-text { color:var(--primary); }

/* =================== Tool Activity Cards in Chat =================== */
.tool-activity-card {
  display:flex; align-items:center; gap:0.6rem;
  padding:0.5rem 0.75rem; margin:0.25rem 0;
  background:var(--bg-tertiary); border:1px solid var(--border);
  border-radius:var(--radius-sm); font-size:0.8rem;
  animation:slideIn 0.2s ease-out;
  max-width:85%;
}
.tool-activity-card .tool-icon {
  width:28px; height:28px; border-radius:6px; display:flex;
  align-items:center; justify-content:center; font-size:0.9rem;
  flex-shrink:0;
}
.tool-activity-card .tool-icon.search { background:rgba(56,189,248,0.15); }
.tool-activity-card .tool-icon.memory { background:rgba(124,108,255,0.15); }
.tool-activity-card .tool-icon.task { background:rgba(52,211,153,0.15); }
.tool-activity-card .tool-icon.call { background:rgba(248,113,113,0.15); }
.tool-activity-card .tool-icon.agent { background:rgba(251,191,36,0.15); }
.tool-activity-card .tool-icon.web { background:rgba(56,189,248,0.15); }
.tool-activity-card .tool-info { flex:1; }
.tool-activity-card .tool-name { font-weight:500; color:var(--text); font-size:0.78rem; }
.tool-activity-card .tool-detail { color:var(--text-muted); font-size:0.72rem; margin-top:0.1rem; }
.tool-activity-card .tool-status {
  font-size:0.7rem; padding:0.1rem 0.4rem; border-radius:10px;
  background:var(--success-light); color:var(--success); font-weight:500;
}
.tool-activity-card .tool-status.pending {
  background:rgba(251,191,36,0.15); color:var(--warning);
}

/* =================== Tool Toast =================== */
.tool-toast {
  position:fixed; bottom:1.5rem; right:1.5rem; z-index:9990;
  display:flex; align-items:center; gap:0.6rem;
  padding:0.6rem 1rem; background:var(--glass);
  backdrop-filter:blur(12px); border:1px solid var(--glass-border);
  border-radius:var(--radius-sm); box-shadow:var(--shadow);
  font-size:0.82rem; animation:slideIn 0.25s ease-out;
}
.tool-toast.hidden { display:none; }
.tool-toast-icon { font-size:1rem; }
.tool-toast-text { color:var(--text-secondary); }

/* =================== Memory View =================== */
.memory-stats-grid {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:1rem;
  margin-bottom:1rem;
}
.memory-stat-card {
  background:var(--glass); backdrop-filter:blur(12px);
  border:1px solid var(--glass-border); border-radius:var(--radius);
  padding:1rem; text-align:center; box-shadow:var(--shadow);
}
.memory-stat-number {
  font-size:2rem; font-weight:700;
  background:linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text;
}
.memory-stat-label { font-size:0.8rem; color:var(--text-muted); margin-top:0.25rem; }

.memory-filters { display:flex; gap:0.5rem; margin-bottom:1rem; flex-wrap:wrap; }

.memory-entries-list { display:flex; flex-direction:column; gap:0.5rem; }
.memory-entry {
  display:flex; align-items:center; gap:0.75rem;
  padding:0.75rem 1rem; background:var(--bg-secondary);
  border:1px solid var(--border); border-radius:var(--radius-sm);
  transition:all 0.15s;
}
.memory-entry:hover { border-color:var(--border-active); }
.memory-entry-category {
  font-size:0.7rem; padding:0.15rem 0.5rem; border-radius:12px;
  background:var(--primary-light); color:var(--primary);
  font-weight:500; white-space:nowrap;
}
.memory-entry-key { font-weight:500; font-size:0.85rem; min-width:120px; }
.memory-entry-value { flex:1; color:var(--text-secondary); font-size:0.85rem; }
.memory-entry-confidence {
  font-size:0.7rem; color:var(--text-muted); white-space:nowrap;
}
.memory-entry-delete {
  background:none; border:none; color:var(--text-muted); cursor:pointer;
  font-size:0.8rem; opacity:0; transition:opacity 0.15s;
}
.memory-entry:hover .memory-entry-delete { opacity:1; }
.memory-entry-delete:hover { color:var(--danger); }

/* =================== Enhanced Typing Indicator =================== */
.typing-context {
  font-size:0.72rem; color:var(--text-muted); margin-bottom:0.25rem;
  animation:fadeIn 0.2s;
}

/* =================== Keyboard shortcuts hint =================== */
.kbd-hint {
  position:fixed; bottom:0.75rem; left:50%; transform:translateX(-50%);
  z-index:100; font-size:0.7rem; color:var(--text-muted);
  background:var(--glass); backdrop-filter:blur(8px);
  padding:0.3rem 0.75rem; border-radius:20px;
  border:1px solid var(--glass-border);
  pointer-events:none; opacity:0; transition:opacity 0.3s;
}
body:focus-within .kbd-hint { opacity:0; }

/* =================== Notification Badge =================== */
.nav-item .badge {
  display:none; min-width:16px; height:16px; border-radius:8px;
  background:var(--danger); color:#fff; font-size:0.6rem;
  font-weight:600; line-height:16px; text-align:center; padding:0 4px;
  margin-left:auto;
}
.nav-item .badge.visible { display:block; }
