/* ===== Reset & Variables ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #161625;
  --bg-card: #1c1c30;
  --bg-elevated: #222240;
  --bg-input: #1a1a2e;
  --text-primary: #eaeaf0;
  --text-secondary: #9494b8;
  --text-muted: #5a5a7a;
  --accent: #7c6cf0;
  --accent-hover: #8e80f5;
  --accent-glow: rgba(124, 108, 240, 0.25);
  --accent-subtle: rgba(124, 108, 240, 0.1);
  --green: #34d399;
  --green-subtle: rgba(52, 211, 153, 0.15);
  --red: #f87171;
  --red-subtle: rgba(248, 113, 113, 0.15);
  --orange: #fbbf24;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.4);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== Screens ===== */
.screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
}
.screen.active {
  display: flex;
}

/* ===== Splash Screen ===== */
#splash-screen {
  background: var(--bg-primary);
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.splash-content {
  text-align: center;
}
.splash-logo {
  position: relative;
  width: 80px; height: 80px;
  margin: 0 auto 24px;
}
.splash-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0.3;
  animation: splashRing 2s ease-out infinite;
}
@keyframes splashRing {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}
.splash-icon {
  position: absolute;
  inset: 15px;
  color: var(--accent);
}
.splash-content h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.splash-content > p {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
}
.splash-loader {
  width: 120px;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 3px;
  margin: 28px auto 0;
  overflow: hidden;
}
.splash-loader-bar {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 3px;
  animation: splashLoad 1.2s ease-in-out infinite;
}
@keyframes splashLoad {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ===== Register Screen ===== */
#register-screen {
  background: var(--bg-primary);
  justify-content: center;
  align-items: center;
  padding: 24px;
}
.register-content {
  width: 100%;
  max-width: 380px;
}
.register-logo {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  color: var(--accent);
}
.register-logo svg {
  width: 100%; height: 100%;
}
.register-content h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-align: center;
  margin-bottom: 4px;
}
.register-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 32px;
}
.register-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 2px;
}
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  width: 18px; height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.input-wrapper input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-wrapper input::placeholder {
  color: var(--text-muted);
}
.input-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 2px;
}
.input-hint.error {
  color: var(--red);
}
.input-hint.success {
  color: var(--green);
}

/* ===== Buttons ===== */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-primary.btn-sm {
  padding: 10px 20px;
  width: auto;
  font-size: 14px;
}
.btn-loader {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  padding: 10px 20px;
  background: none;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}
.icon-btn:active {
  background: var(--bg-elevated);
}

.register-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
  font-size: 11px;
  color: var(--text-muted);
}
.register-footer svg {
  color: var(--green);
  flex-shrink: 0;
}

/* ===== App Header ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  padding-top: calc(14px + var(--safe-top));
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  color: var(--accent);
}
.app-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--red-subtle);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--red);
}
.status-pill.online {
  background: var(--green-subtle);
  color: var(--green);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== Views Container ===== */
.views-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}
.view.active {
  display: flex;
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  display: flex;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 4px 0;
  padding-bottom: calc(4px + var(--safe-bottom));
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  font-family: var(--font);
}
.nav-item svg {
  transition: color 0.2s;
}
.nav-item.active {
  color: var(--accent);
}
.nav-item.active svg {
  color: var(--accent);
}
.nav-label {
  font-size: 10px;
  font-weight: 500;
}

/* ===== Search Bar ===== */
.search-bar {
  position: relative;
  padding: 12px 18px;
  background: var(--bg-secondary);
}
.search-icon {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.search-bar input:focus {
  border-color: var(--accent);
}
.search-bar input::placeholder {
  color: var(--text-muted);
}

/* ===== Contacts List ===== */
.contacts-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.contact-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.contact-item:hover {
  background: var(--bg-secondary);
}
.contact-item:active {
  background: var(--bg-card);
}
.contact-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-subtle), var(--bg-elevated));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-right: 14px;
  flex-shrink: 0;
  border: 1.5px solid var(--border-light);
}
.contact-info {
  flex: 1;
  min-width: 0;
}
.contact-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.contact-last-msg {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-meta {
  text-align: right;
  flex-shrink: 0;
  margin-left: 10px;
}
.contact-time {
  font-size: 11px;
  color: var(--text-muted);
}
.contact-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  padding: 0 6px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  padding: 80px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-state svg {
  color: var(--text-muted);
  margin-bottom: 4px;
}
.empty-state h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-secondary);
}
.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 240px;
  line-height: 1.5;
}

/* ===== FAB ===== */
.fab {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px var(--accent-glow), var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.2s;
  z-index: 5;
}
.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 32px rgba(124, 108, 240, 0.4), var(--shadow-lg);
}
.fab:active {
  transform: scale(0.95);
}

/* ===== Chat Header ===== */
.chat-header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.chat-contact-info {
  flex: 1;
  min-width: 0;
}
.chat-contact-name {
  font-size: 15px;
  font-weight: 600;
  display: block;
}
.chat-contact-status {
  font-size: 11px;
  color: var(--text-muted);
}
.chat-actions {
  display: flex;
  gap: 2px;
}

/* ===== Messages ===== */
.messages-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-primary);
}
.message {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  position: relative;
  animation: msgIn 0.25s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.message.sent {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 6px;
}
.message.received {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border);
}
.message-time {
  font-size: 10px;
  opacity: 0.55;
  margin-top: 3px;
  text-align: right;
}
.message-status {
  font-size: 10px;
  margin-left: 4px;
}
.message.file-message {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-icon { font-size: 22px; }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size { font-size: 11px; opacity: 0.6; }
.system-message {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px;
}

/* ===== Chat Input ===== */
.chat-input-bar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  gap: 10px;
}
.chat-input-bar input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.chat-input-bar input:focus {
  border-color: var(--accent);
}
.chat-input-bar input::placeholder {
  color: var(--text-muted);
}
.send-btn {
  width: 40px; height: 40px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:active { transform: scale(0.92); }

/* ===== Call Screen ===== */
.call-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, var(--bg-card) 0%, var(--bg-primary) 70%);
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.call-waves {
  position: absolute;
  width: 200px; height: 200px;
  top: 50%; left: 50%;
  transform: translate(-50%, -65%);
}
.call-wave {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: callWave 3s ease-out infinite;
}
.call-wave:nth-child(2) { animation-delay: 1s; }
.call-wave:nth-child(3) { animation-delay: 2s; }
@keyframes callWave {
  0% { transform: scale(0.5); opacity: 0.5; }
  100% { transform: scale(2); opacity: 0; }
}
.call-avatar-ring {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  position: relative;
  z-index: 1;
}
.call-name {
  font-size: 22px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.call-status {
  font-size: 13px;
  color: var(--text-muted);
}
.call-timer {
  font-size: 40px;
  font-weight: 200;
  font-family: 'Inter', monospace;
  color: var(--text-secondary);
  letter-spacing: 2px;
}
.call-controls {
  display: flex;
  gap: 20px;
  margin-top: 36px;
  position: relative;
  z-index: 1;
}
.call-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-light);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.1s, background 0.2s;
  font-family: var(--font);
}
.call-btn span {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
}
.call-btn:active { transform: scale(0.92); }
.call-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}
.call-btn-end {
  background: var(--red) !important;
  border-color: var(--red) !important;
  color: white !important;
  width: 72px; height: 72px;
}
.call-btn-end span { color: rgba(255,255,255,0.7); }
.call-btn-accept {
  background: var(--green) !important;
  border-color: var(--green) !important;
  color: white !important;
}

/* ===== Settings ===== */
.settings-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 10px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.settings-header h3 {
  font-size: 17px;
  font-weight: 600;
}
.settings-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px;
}
.settings-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.profile-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}
.profile-number {
  font-size: 13px;
  color: var(--text-muted);
  font-family: 'Inter', monospace;
  letter-spacing: 0.5px;
}
.settings-section {
  margin-bottom: 20px;
}
.settings-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
  padding-left: 4px;
}
.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 3px;
  font-size: 14px;
  border: 1px solid var(--border);
}
.setting-item > span:nth-child(2) {
  flex: 1;
}
.setting-item.clickable {
  cursor: pointer;
  transition: background 0.15s;
}
.setting-item.clickable:hover {
  background: var(--bg-elevated);
}
.setting-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.setting-icon.secure {
  background: var(--green-subtle);
  color: var(--green);
}
.setting-value {
  color: var(--text-muted);
  font-size: 12px;
}
.setting-value.mono {
  font-family: 'Inter', monospace;
  font-size: 11px;
}
.setting-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--green-subtle);
  color: var(--green);
}
.chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== Modals ===== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  display: none;
  justify-content: center;
  align-items: center;
}
.modal.active {
  display: flex;
}
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: calc(100% - 48px);
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--text-primary);
}
.modal-header svg {
  color: var(--accent);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}
.modal-input {
  margin-bottom: 4px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  justify-content: flex-end;
}

/* ===== QR Code ===== */
.qr-container {
  background: white;
  padding: 16px;
  border-radius: var(--radius);
  display: inline-block;
  margin: 12px auto;
  text-align: center;
}
.hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0 12px;
}

/* ===== Incoming Call ===== */
.call-incoming {
  text-align: center;
}
.incoming-call-icon {
  position: relative;
  width: 70px; height: 70px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
}
.incoming-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--green);
  border-radius: 50%;
  animation: incomingPulse 1.5s ease-out infinite;
}
@keyframes incomingPulse {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}
.incoming-call-actions {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin-top: 24px;
}

/* ===== Mode Badge ===== */
.mode-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mode-badge.local {
  background: var(--green-subtle);
  color: var(--green);
}
.mode-badge.webrtc {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ===== File Transfer Progress ===== */
.file-progress {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}
.file-progress-bar {
  height: 100%;
  background: var(--accent-hover);
  border-radius: 3px;
  transition: width 0.3s;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.typing-indicator span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ===== DIALER / NUMPAD ===== */
.dialer-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  padding-bottom: 8px;
  background: var(--bg-primary);
}
.dialer-display {
  text-align: center;
  padding: 16px 20px 8px;
  flex-shrink: 0;
}
.dialer-number {
  width: 100%;
  font-size: 32px;
  font-weight: 300;
  font-family: var(--font);
  letter-spacing: 2px;
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
  text-align: center;
  caret-color: var(--accent);
}
.dialer-number::placeholder {
  color: var(--text-muted);
  font-size: 18px;
  letter-spacing: 0;
}
.dialer-status {
  display: block;
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
  font-weight: 500;
}
.dialer-status.online { color: var(--green); }
.dialer-status.offline { color: var(--orange); }
.dialer-status.not-found { color: var(--red); }
.dialer-status.checking { color: var(--text-muted); }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px 8px;
  max-width: 320px;
  margin: 0 auto;
  width: 100%;
}
.numpad-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  user-select: none;
  -webkit-user-select: none;
}
.numpad-key:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
}
.numpad-key:active {
  transform: scale(0.92);
  background: var(--accent-subtle);
  border-color: var(--accent);
}
.numpad-key .digit {
  font-size: 26px;
  font-weight: 400;
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1;
}
.numpad-key .letters {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 2px;
  font-weight: 500;
  margin-top: 1px;
}

.dialer-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 12px 0 4px;
}
.dialer-spacer { width: 52px; }
.dialer-call-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(52, 211, 153, 0.3);
  transition: transform 0.1s, box-shadow 0.2s;
}
.dialer-call-btn:hover {
  box-shadow: 0 8px 32px rgba(52, 211, 153, 0.4);
}
.dialer-call-btn:active { transform: scale(0.92); }
.dialer-call-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.dialer-delete-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.dialer-delete-btn:hover { color: var(--red); }
.dialer-delete-btn:active { color: var(--red); }

/* ===== HISTORIQUE D'APPELS ===== */
.history-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.history-header-bar h3 {
  font-size: 17px;
  font-weight: 600;
}
.history-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.history-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
}
.history-item:hover { background: var(--bg-secondary); }
.history-item:active { background: var(--bg-card); }

.history-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-icon.outgoing {
  background: var(--green-subtle);
  color: var(--green);
}
.history-icon.incoming {
  background: var(--accent-subtle);
  color: var(--accent);
}
.history-icon.missed {
  background: var(--red-subtle);
  color: var(--red);
}
.history-info {
  flex: 1;
  min-width: 0;
}
.history-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 1px;
}
.history-detail {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.history-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.history-call-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green-subtle);
  border: none;
  color: var(--green);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.history-call-btn:hover {
  background: rgba(52, 211, 153, 0.25);
}
