/* ===== CallBreezy Design System ===== */
:root {
  --bg-primary: #0a0e14;
  --bg-secondary: #0f1520;
  --bg-card: #141c28;
  --bg-hover: #1a2436;
  --bg-active: #1e2d45;
  --border: #1e2d45;
  --border-light: #253548;

  --accent: #00c2ff;
  --accent-dim: rgba(0, 194, 255, 0.15);
  --accent-glow: rgba(0, 194, 255, 0.3);
  --green: #00e676;
  --green-dim: rgba(0, 230, 118, 0.15);
  --red: #ff3d57;
  --red-dim: rgba(255, 61, 87, 0.15);
  --orange: #ff9100;
  --yellow: #ffd600;

  --text-primary: #e8edf5;
  --text-secondary: #8899aa;
  --text-dim: #4a5568;

  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --sidebar-width: 220px;
  --titlebar-height: 38px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  user-select: none;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TITLEBAR ===== */
.titlebar {
  height: var(--titlebar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  -webkit-app-region: drag;
  flex-shrink: 0;
}

.titlebar-drag {
  display: flex;
  align-items: center;
  gap: 10px;
}

.titlebar-logo {
  height: 22px;
  object-fit: contain;
  filter: brightness(1.1);
}

.titlebar-controls {
  display: flex;
  gap: 6px;
  -webkit-app-region: no-drag;
}

.tb-btn {
  width: 28px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.tb-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tb-close:hover { background: var(--red) !important; color: white !important; }

/* ===== SCREENS ===== */
.screen { display: none; flex: 1; overflow: hidden; }
.screen.active { display: flex; }

/* ===== LOGIN ===== */
#login-screen {
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
}

#login-screen::before {
  content: '';
  position: absolute;
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,194,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-container {
  display: flex;
  gap: 60px;
  align-items: center;
  max-width: 800px;
  width: 90%;
}

.login-brand {
  flex: 1;
  text-align: center;
}

.login-logo {
  width: 200px;
  object-fit: contain;
  filter: brightness(1.2) drop-shadow(0 0 20px rgba(0,194,255,0.3));
  margin-bottom: 16px;
}

.login-tagline {
  color: var(--text-secondary);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-form {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.login-form h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input { accent-color: var(--accent); }

.login-status {
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
  min-height: 20px;
}

.login-status.error { color: var(--red); }
.login-status.success { color: var(--green); }
.login-status.info { color: var(--accent); }

/* ===== BUTTONS ===== */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #33cfff;
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 8px 16px;
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover { background: var(--bg-active); border-color: var(--accent); }

.btn-ghost {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-light); }

.icon-btn {
  width: 34px;
  height: 34px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--bg-active); color: var(--accent); border-color: var(--accent); }

/* ===== APP LAYOUT ===== */
#app-screen {
  flex-direction: column;
}

.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 16px 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.user-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#user-initials {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  border: 2px solid var(--bg-secondary);
}

.status-dot.registered { background: var(--green); }
.status-dot.connecting { background: var(--orange); }
.status-dot.failed { background: var(--red); }

.user-info { overflow: hidden; }

.user-ext {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-domain {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav { flex: 1; padding: 4px 8px; }
.sidebar-footer { padding: 4px 8px; border-top: 1px solid var(--border); }

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
  text-align: left;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0,194,255,0.2);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.disconnect-btn:hover { background: var(--red-dim) !important; color: var(--red) !important; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ===== ACTIVE CALL BAR ===== */
.active-call-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--green);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.call-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.call-pulse {
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(0,230,118,0); }
}

.call-number {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.call-timer {
  font-size: 13px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.call-controls {
  display: flex;
  gap: 8px;
}

.call-btn {
  width: 38px;
  height: 38px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.call-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.call-btn:hover { background: var(--bg-active); color: var(--text-primary); }
.call-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.call-btn.hangup { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.call-btn.hangup:hover { background: var(--red); color: white; }

/* ===== INCOMING CALL ===== */
.incoming-call-modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

.incoming-call-card {
  background: var(--bg-card);
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  min-width: 280px;
  box-shadow: 0 0 60px rgba(0,230,118,0.2);
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.incoming-ring-anim {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 2px solid var(--green);
  animation: ring 1s infinite;
}

@keyframes ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.4), 0 0 0 10px rgba(0,230,118,0.2); }
  50% { box-shadow: 0 0 0 15px rgba(0,230,118,0.1), 0 0 0 30px rgba(0,230,118,0); }
}

.caller-avatar {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.incoming-call-card .caller-avatar {
  position: relative;
  transform: none;
  top: auto;
  left: auto;
  width: 80px;
  height: 80px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.incoming-call-card .caller-avatar svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--green);
  stroke-width: 1.5;
}

.incoming-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 8px;
}

.incoming-number {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 30px;
}

.incoming-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.answer-btn, .reject-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 50px;
  border: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.answer-btn svg, .reject-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.answer-btn { background: var(--green); color: #000; }
.answer-btn:hover { background: #33ff8a; box-shadow: 0 4px 20px rgba(0,230,118,0.4); transform: translateY(-2px); }
.reject-btn { background: var(--red); color: white; }
.reject-btn:hover { background: #ff6678; box-shadow: 0 4px 20px rgba(255,61,87,0.4); transform: translateY(-2px); }

/* ===== TRANSFER MODAL ===== */
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  min-width: 320px;
  box-shadow: var(--shadow);
}

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  margin-bottom: 16px;
}

.modal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== TAB CONTENT ===== */
.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

/* ===== DIALPAD ===== */
.dialpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}

.dial-display {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
}

.dial-input {
  width: 100%;
  padding: 16px 50px 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 50px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  outline: none;
  letter-spacing: 0.05em;
  cursor: default;
}

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

.dial-backspace {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.dial-backspace:hover { color: var(--accent); }

.dialpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  margin-bottom: 20px;
}

.dial-key {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  max-height: 70px;
}

.dial-key:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
  transform: scale(1.02);
}

.dial-key:active { transform: scale(0.96); background: var(--accent-dim); }

.dial-key .digit {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.dial-key .sub {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  margin-top: 2px;
}

.call-dial-btn {
  width: 100%;
  padding: 16px;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 50px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.call-dial-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.call-dial-btn:hover { background: #33ff8a; box-shadow: 0 6px 24px rgba(0,230,118,0.4); transform: translateY(-2px); }
.call-dial-btn:active { transform: translateY(0); }

.sip-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot-inline {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s;
}

.status-dot-inline.registered { background: var(--green); box-shadow: 0 0 8px rgba(0,230,118,0.5); }
.status-dot-inline.connecting { background: var(--orange); animation: blink 1s infinite; }
.status-dot-inline.failed { background: var(--red); }

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

/* ===== MESSAGES ===== */
.messages-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.conversations-panel {
  width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.search-box svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
}

.search-box input::placeholder { color: var(--text-dim); }

.conversations-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.conversation-item:hover { background: var(--bg-hover); }
.conversation-item.active { background: var(--accent-dim); border-left: 2px solid var(--accent); }

.conv-avatar {
  width: 40px;
  height: 40px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.conv-info { flex: 1; overflow: hidden; }

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

.conv-preview {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.conv-time { font-size: 11px; color: var(--text-dim); }

.conv-unread {
  background: var(--accent);
  color: #000;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
}

/* ===== CHAT PANEL ===== */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-empty-state, .empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
}

.empty-state svg, .chat-empty-state svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.4;
}

.empty-state p, .chat-empty-state p {
  font-size: 14px;
  color: var(--text-dim);
}

.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.chat-contact-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-contact-number {
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-bubble {
  max-width: 60%;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-bubble.outbound { align-self: flex-end; }
.message-bubble.inbound { align-self: flex-start; }

.bubble-content {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.outbound .bubble-content {
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
}

.inbound .bubble-content {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.bubble-content img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
}

.bubble-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 4px;
}

.outbound .bubble-time { text-align: right; }

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  flex-shrink: 0;
}

.media-preview {
  position: relative;
  margin-bottom: 8px;
  display: inline-block;
}

.media-preview img {
  height: 60px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.remove-media {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.attach-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.attach-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attach-btn:hover { color: var(--accent); border-color: var(--accent); }

.chat-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.5;
}

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

.send-btn {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.send-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.send-btn:hover { background: #33cfff; box-shadow: 0 4px 16px var(--accent-glow); }

/* ===== CALL LOG ===== */
.filter-tabs {
  display: flex;
  gap: 4px;
}

.filter-tab {
  padding: 6px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
}

.filter-tab.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.filter-tab:hover { color: var(--text-primary); }

.call-log-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.call-log-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}

.call-log-item:hover { background: var(--bg-hover); }

.call-direction-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.call-direction-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-direction-icon.inbound { background: var(--green-dim); color: var(--green); }
.call-direction-icon.outbound { background: var(--accent-dim); color: var(--accent); }
.call-direction-icon.missed { background: var(--red-dim); color: var(--red); }

.call-log-info { flex: 1; }

.call-log-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.call-log-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.call-log-duration {
  font-size: 12px;
  color: var(--text-dim);
}

/* ===== VOICEMAIL ===== */
.voicemail-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.voicemail-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  margin: 8px;
}

.vm-play-btn {
  width: 38px;
  height: 38px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.vm-play-btn svg { width: 14px; height: 14px; fill: currentColor; }

.vm-info { flex: 1; }
.vm-caller { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.vm-time { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ===== CONTACTS ===== */
.contacts-list {
  flex: 1;
  overflow-y: auto;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.contact-item:hover { background: var(--bg-hover); }

.contact-avatar {
  width: 40px;
  height: 40px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.contact-info { flex: 1; }
.contact-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.contact-number { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.contact-actions { display: flex; gap: 6px; }

/* ===== SETTINGS ===== */
.settings-sections {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.settings-section h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.setting-row:last-of-type { border-bottom: none; }
.setting-row label { color: var(--text-secondary); }
.setting-row span { color: var(--text-primary); font-weight: 500; }

.setting-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
  max-width: 180px;
}

.setting-range {
  accent-color: var(--accent);
  width: 120px;
}

/* ===== TOGGLE ===== */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: 22px;
  transition: 0.3s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider { background: var(--accent-dim); border-color: var(--accent); }
.toggle input:checked + .toggle-slider:before { background: var(--accent); transform: translateX(18px); }

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== NEW MESSAGE MODAL ===== */
.new-message-modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  backdrop-filter: blur(4px);
}

/* ===== RESPONSIVE FIXES ===== */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

#app-screen {
  height: calc(100vh - var(--titlebar-height));
  flex-direction: row !important;
  overflow: hidden;
}

.sidebar {
  height: 100%;
  overflow-y: auto;
}

.main-content {
  height: 100%;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

/* Fix tab content sizing */
.tab-content {
  height: 100%;
  min-height: 0;
}

/* Fix dialpad centering at all sizes */
.dialpad-container {
  overflow-y: auto;
  padding: 12px 20px;
}

.dial-key {
  max-height: 64px;
  min-height: 48px;
}

.dialpad-grid {
  gap: 8px;
}

/* Messages layout fix */
.messages-layout {
  height: 100%;
  min-height: 0;
}

.conversations-panel {
  min-width: 200px;
  max-width: 300px;
}

.chat-panel {
  min-width: 0;
}

.chat-active {
  height: 100%;
  min-height: 0;
}

.chat-messages {
  min-height: 0;
}

/* Call log fix */
.call-log-list, .voicemail-list, .contacts-list {
  overflow-y: auto;
  flex: 1;
}

/* Settings fix */
.settings-sections {
  flex: 1;
  min-height: 0;
}

/* Small window adjustments */
@media (max-width: 900px) {
  :root { --sidebar-width: 180px; }
  .nav-item span { font-size: 12px; }
  .login-container { flex-direction: column; gap: 24px; }
  .login-brand { display: none; }
}

@media (max-width: 700px) {
  :root { --sidebar-width: 56px; }
  .nav-item span, .user-info, .sidebar-user .user-info { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .user-avatar { margin: 0 auto; }
  .sidebar-user { justify-content: center; }
}

/* ===== VOICEMAIL ENHANCEMENTS ===== */
.voicemail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 8px;
  transition: background 0.15s;
}

.voicemail-item:hover { background: var(--bg-hover); }

.voicemail-item.vm-unread {
  border-left: 3px solid var(--accent);
}

.vm-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.vm-info {
  flex: 1;
  min-width: 0;
}

.vm-number { margin-top: 2px; }
.vm-time { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.vm-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 12px;
}

.vm-progress {
  display: flex;
  align-items: center;
  gap: 4px;
}

.vm-scrubber {
  cursor: pointer;
}

/* ===== SPLASH SCREEN ===== */
#splash-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#splash-screen.fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.splash-logo {
  width: 220px;
  object-fit: contain;
  filter: brightness(1.2) drop-shadow(0 0 30px rgba(0,194,255,0.4));
  animation: splashLogoIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}

@keyframes splashLogoIn {
  to { opacity: 1; transform: translateY(0); }
}

.splash-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 32px;
}

.splash-bar {
  width: 5px;
  background: var(--accent);
  border-radius: 3px;
  animation: splashBar 1.2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent-glow);
}

.splash-bar:nth-child(1) { animation-delay: 0s;    height: 40%; }
.splash-bar:nth-child(2) { animation-delay: 0.15s; height: 70%; }
.splash-bar:nth-child(3) { animation-delay: 0.3s;  height: 100%; }
.splash-bar:nth-child(4) { animation-delay: 0.45s; height: 70%; }
.splash-bar:nth-child(5) { animation-delay: 0.6s;  height: 40%; }

@keyframes splashBar {
  0%, 100% { transform: scaleY(0.3); opacity: 0.4; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.splash-text {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
  animation: splashTextPulse 2s ease-in-out infinite;
}

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

/* ===== WEB APP OVERRIDES ===== */

/* No titlebar in web — body fills full viewport */
body {
  height: 100vh;
  overflow: hidden;
}

.screen.active {
  height: 100vh;
}

#app-screen {
  height: 100vh !important;
}

/* Login centered nicely in browser */
#login-screen {
  height: 100vh;
  overflow-y: auto;
}

.login-container {
  padding: 40px 20px;
  min-height: 100vh;
  align-items: flex-start;
  justify-content: center;
}

@media (min-height: 700px) {
  .login-container {
    align-items: center;
    min-height: unset;
  }
}

/* Future feature buttons — dimmed, cursor not-allowed */
.call-btn.future-feature {
  opacity: 0.35;
  cursor: not-allowed;
  position: relative;
}

.call-btn.future-feature:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--border-light);
  box-shadow: none;
}

/* Toast animation */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Ensure app layout is side-by-side */
#app-screen.active {
  display: flex !important;
  flex-direction: row !important;
}

/* ===== CDR PAGINATION ===== */
.cdr-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
