:root {
  --bg: #0b1020;
  --bg-card: #131a30;
  --bg-card-hover: #1a2342;
  --border: #233056;
  --text: #e8edf7;
  --text-muted: #8b96b8;
  --primary: #4f8cff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --live: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif; min-height: 100vh; }

.app { display: flex; flex-direction: column; min-height: 100vh; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 2rem; border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.2); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 100; }
.app-header h1 { font-size: 1.25rem; display: flex; align-items: center; gap: 0.6rem; }
.live-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); } 50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } }

.user-info { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; color: var(--text-muted); }
.btn { padding: 0.5rem 0.9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 0.875rem; font-weight: 500; transition: all 0.15s; }
.btn:hover { background: var(--bg-card-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #3b78ff; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

.dashboard { padding: 1.5rem 2rem; max-width: 1400px; margin: 0 auto; width: 100%; flex: 1; }
.section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 0.75rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 2rem; font-weight: 600; margin-top: 0.25rem; }
.stat-value.live-color { color: var(--live); }

.calls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.call-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; transition: all 0.2s; position: relative; overflow: hidden; }
.call-card.monitoring { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,140,255,0.2); }
.call-card.live::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--live), transparent); animation: shimmer 2s infinite; }
@keyframes shimmer { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

.call-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.call-from { font-size: 1.1rem; font-weight: 600; font-family: ui-monospace, SFMono-Regular, monospace; }
.call-line { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.call-status { font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 4px; text-transform: uppercase; font-weight: 600; }
.call-status.in-progress { background: rgba(34,197,94,0.2); color: var(--success); }
.call-status.ringing { background: rgba(245,158,11,0.2); color: var(--warning); }
.call-status.hold { background: rgba(139,150,184,0.2); color: var(--text-muted); }

.call-meta { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.call-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.transcript-box { background: rgba(0,0,0,0.3); border-radius: 8px; padding: 0.75rem; margin-top: 0.75rem; max-height: 150px; overflow-y: auto; font-size: 0.8rem; line-height: 1.5; color: var(--text-muted); }
.transcript-box .me { color: var(--primary); }
.transcript-box .them { color: var(--success); }

.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state h2 { font-weight: 400; margin-bottom: 0.5rem; }

.login-card { max-width: 380px; margin: 8rem auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; }
.login-card h1 { margin-bottom: 0.25rem; }
.login-card p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }
.login-card input { width: 100%; padding: 0.7rem 0.9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.95rem; margin-bottom: 0.75rem; }
.login-card .btn { width: 100%; }

.toast { position: fixed; bottom: 1rem; right: 1rem; background: var(--bg-card); border: 1px solid var(--border); padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.875rem; z-index: 1000; }
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--text-muted); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
