/* ====================================
   IPPBX — Agentic PBX 2026
   Design System: Aurora Glass
   ==================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Vazirmatn:wght@100;300;400;500;700;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Brand Core */
  --bg: #070815;
  --bg-elevated: #0b0d1d;
  --surface: rgba(15, 23, 42, 0.6);
  --surface-solid: #0f172a;
  --surface-hover: rgba(30, 41, 59, 0.8);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-focus: #6366f1;

  /* Text */
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Brand Gradient */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-accent: #8b5cf6;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --primary-glow: rgba(99, 102, 241, 0.25);
  --primary-soft: rgba(99, 102, 241, 0.1);
  --primary-soft-hover: rgba(99, 102, 241, 0.18);

  /* Semantic */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-glow: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --info: #06b6d4;
  --info-soft: rgba(6, 182, 212, 0.12);

  /* Geometry */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --glass-blur: blur(20px);
  --glass-blur-strong: blur(32px);

  /* Space */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 40px;
  --space-3xl: 48px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --shadow-success: 0 0 20px var(--success-glow);

  /* Layout */
  --topbar-height: 64px;
  --sidebar-width: 260px;
}

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

[dir="rtl"] { font-family: 'Vazirmatn', 'Inter', sans-serif; }
[dir="ltr"] { font-family: 'Inter', sans-serif; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 0% 20%, rgba(99, 102, 241, 0.06), transparent),
    radial-gradient(ellipse 60% 50% at 100% 80%, rgba(139, 92, 246, 0.05), transparent),
    radial-gradient(ellipse 40% 40% at 50% 100%, rgba(6, 182, 212, 0.03), transparent);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--primary-soft);
  color: var(--primary-light);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

a { color: inherit; text-decoration: none; }

/* ====================================
   GLASS
   ==================================== */
.glass {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
}

.glass-strong {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--border);
}

.glass-card {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.glass-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ====================================
   LOGIN PAGE
   ==================================== */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #05060f;
  background-image:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(99, 102, 241, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(139, 92, 246, 0.06), transparent);
  padding: var(--space-lg);
}
.login-box {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--border);
  padding: var(--space-3xl);
  border-radius: var(--radius-xl);
  width: 420px;
  max-width: 100%;
  box-shadow: var(--shadow-glow), var(--shadow-lg);
  text-align: center;
  animation: loginEnter 0.5s var(--transition-bounce);
}
@keyframes loginEnter {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-box .logo h1 {
  font-size: 32px;
  font-weight: 900;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-sm);
  letter-spacing: -1px;
}
.login-box .sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  font-weight: 500;
}
.login-box input {
  width: 100%;
  padding: 14px 18px;
  margin-bottom: var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #fff;
  outline: none;
  transition: var(--transition);
  font-size: 14px;
}
.login-box input:focus {
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.login-box button {
  width: 100%;
  padding: 14px;
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.login-box button:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-glow);
}
.login-box button:active { transform: scale(0.98); }
.login-box .err {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-md);
  border: 1px solid var(--danger-soft);
}
.login-hint {
  margin-top: var(--space-lg);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}
.login-hint strong { color: var(--text-secondary); }
.login-hint code {
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary-light);
}
.login-lang {
  margin-top: var(--space-lg);
  font-size: 12px;
}
.login-lang a {
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition-fast);
}
.login-lang a.active { color: var(--primary-light); background: var(--primary-soft); }
.login-lang a:hover { color: var(--text); }

/* ====================================
   TOPBAR
   ==================================== */
.topbar {
  height: var(--topbar-height);
  background: rgba(7, 8, 21, 0.85);
  backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.topbar-left .app-logo {
  font-size: 20px;
  font-weight: 900;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
  margin-right: var(--space-md);
}
.topbar-left a {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: var(--transition);
}
.topbar-left a:hover, .topbar-left a.active {
  background: var(--primary-soft);
  color: #fff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.lang-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.lang-switch a {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.lang-switch a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.lang-switch a:not(.active):hover { color: var(--text); }
.lang-switch .sep { color: rgba(255, 255, 255, 0.08); margin: 0 2px; font-weight: 300; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: var(--space-md);
  border-left: 1px solid var(--border);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.user-info { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.btn-logout {
  font-size: 12px;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid transparent;
  transition: var(--transition);
}
.btn-logout:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ====================================
   DASHBOARD LAYOUT
   ==================================== */
.dash {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: calc(100vh - var(--topbar-height));
}

.dash-sidebar {
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
}
.sidebar-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name { font-weight: 700; font-size: 14px; }
.sidebar-user-ext { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--primary-soft); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary-gradient);
  border-radius: 0 3px 3px 0;
}
[dir="rtl"] .nav-item.active::before {
  left: auto;
  right: -16px;
  border-radius: 3px 0 0 3px;
}
.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-left: auto;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 0 8px var(--danger-glow);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--text-muted);
}
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.dash-main {
  padding: var(--space-xl);
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-height));
}

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-2xl);
}

.section-content { display: none; }
.section-content.active {
  display: block;
  animation: sectionEnter 0.3s var(--transition);
}
@keyframes sectionEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}
.section-header h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.section-count {
  font-size: 12px;
  background: var(--primary-soft);
  color: var(--primary-light);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

/* ====================================
   SEARCH INPUT
   ==================================== */
.search-input {
  width: 100%;
  padding: 11px 16px;
  font-size: 13px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: var(--transition-fast);
}
.search-input:focus {
  border-color: var(--border-focus);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* ====================================
   TABLES
   ==================================== */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.tbl th {
  text-align: left;
  padding: 12px 16px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.tbl td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.tbl tr:hover td { background: rgba(255, 255, 255, 0.02); color: var(--text); }

/* ====================================
   FORMS & BUTTONS
   ==================================== */
form { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: flex-end; }

input, select, textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 11px 16px;
  border-radius: var(--radius);
  color: #fff;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
  font-size: 13px;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

button {
  padding: 11px 22px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 4px 20px var(--primary-glow); transform: translateY(-1px); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-soft);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-soft);
}
.btn-success:hover { background: var(--success); color: #fff; }

.btn-sm { padding: 7px 14px; font-size: 11px; border-radius: var(--radius); }

/* ====================================
   TOAST SYSTEM
   ==================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  z-index: 99999;
  animation: toastIn 0.35s var(--transition-bounce);
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--border);
}
.toast.info { background: rgba(15, 23, 42, 0.95); color: var(--text); border-color: var(--border); }
.toast.success { background: rgba(6, 31, 20, 0.95); color: var(--success); border-color: var(--success-soft); }
.toast.error { background: rgba(31, 6, 6, 0.95); color: var(--danger); border-color: var(--danger-soft); }
[dir="rtl"] .toast { right: auto; left: 24px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ====================================
   CONTACTS LIST
   ==================================== */
.contacts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
}

.contact-item {
  display: flex;
  align-items: center;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: var(--transition);
  gap: var(--space-md);
  cursor: pointer;
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
}
.contact-item:hover {
  border-color: var(--border-hover);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}
.contact-item .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; font-size: 14px; }
.contact-ext { font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.contact-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.contact-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success-glow); }
.contact-dot.in-call { background: var(--danger); box-shadow: 0 0 8px var(--danger-glow); animation: pulse-dot 1.5s ease-in-out infinite; }
.contact-dot.offline { background: var(--text-muted); }

.call-contact {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  transition: var(--transition);
  flex-shrink: 0;
}
.call-contact:hover { background: var(--primary); color: #fff; }

.call-links-section {
  grid-column: 1 / -1;
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
}
.call-links-section h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}
.call-link-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  border: 1px solid var(--border);
}
.link-url {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.3) !important;
  color: var(--text-muted) !important;
  border: none !important;
}

/* ====================================
   FULL WEBPHONE
   ==================================== */
.phone-full {
  max-width: 380px;
  margin: 0 auto;
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  box-shadow: var(--shadow-glow);
}
.call-status {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: var(--space-md);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: inline-block;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.call-status.ringing { background: var(--warning-soft); color: var(--warning); }
.call-status.connected { background: var(--success-soft); color: var(--success); }
.call-status.failed { background: var(--danger-soft); color: var(--danger); }

.phone-full-display {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
  letter-spacing: 3px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-light);
  font-family: 'JetBrains Mono', monospace;
  transition: var(--transition);
}
.phone-full-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: var(--space-lg);
}
.phone-full-pad button {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  flex-direction: column;
  padding: 0;
}
.phone-full-pad button:hover { background: var(--primary-soft); border-color: var(--primary); transform: scale(1.05); }
.phone-full-pad button:active { transform: scale(0.95); }
.phone-full-pad button .sub { font-size: 9px; color: var(--text-muted); font-weight: 500; opacity: 0.6; }

.phone-full-actions {
  display: flex;
  gap: 12px;
}
.phone-full-btn {
  flex: 1;
  height: 52px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: var(--radius) !important;
}
.call-btn { background: var(--success); color: #fff; }
.call-btn:hover { box-shadow: 0 4px 16px var(--success-glow); }
.hangup-btn { background: var(--danger); color: #fff; }
.hangup-btn:hover { box-shadow: 0 4px 16px var(--danger-glow); }

.phone-full-back {
  margin-top: var(--space-md);
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  padding: 8px;
}

/* ====================================
   FLOATING PHONE
   ==================================== */
.phone-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}
[dir="rtl"] .phone-float { right: auto; left: 24px; }

.phone-float-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-glow), var(--shadow-md);
  font-size: 24px;
  color: #fff;
  transition: var(--transition-bounce);
  border: none;
  padding: 0;
}
.phone-float-toggle:hover { transform: scale(1.1) rotate(5deg); box-shadow: var(--shadow-glow), var(--shadow-lg); }
.phone-float-toggle:active { transform: scale(0.95); }

.phone-float-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 300px;
  background: rgba(11, 13, 29, 0.96);
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glow), var(--shadow-lg);
  padding: var(--space-lg);
  display: none;
  animation: panelIn 0.3s var(--transition-bounce);
}
[dir="rtl"] .phone-float-panel { right: auto; left: 0; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.phone-float.open .phone-float-panel { display: block; }

.phone-float-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}
.phone-float-title { font-weight: 700; font-size: 14px; flex: 1; }
.phone-float-ext { font-size: 11px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.phone-float-close {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.number-display {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 3px;
  margin-bottom: var(--space-md);
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary-light);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.number-wrap {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.number-wrap .number-display { flex: 1; margin-bottom: 0; }
.backspace-btn {
  width: 52px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.backspace-btn:hover { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }

.dialpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: var(--space-md);
}
.dialpad button {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialpad button:hover { background: var(--primary-soft); border-color: var(--primary); transform: scale(1.05); }
.dialpad button:active { transform: scale(0.95); }

.digit-wrap { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.digit-wrap .sub { font-size: 8px; opacity: 0.4; font-weight: 500; margin-top: 1px; }

.phone-buttons { display: flex; gap: var(--space-sm); }
.phone-buttons button { flex: 1; height: 44px; font-size: 13px; }
#call-btn { background: var(--success); color: #fff; border-radius: var(--radius) !important; }
#call-btn:hover { box-shadow: 0 4px 16px var(--success-glow); }
#hangup-btn { background: var(--danger); color: #fff; border-radius: var(--radius) !important; }
#hangup-btn:hover { box-shadow: 0 4px 16px var(--danger-glow); }

/* ====================================
   CALL POPUP
   ==================================== */
.call-popup {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 6, 15, 0.85);
  backdrop-filter: blur(16px);
  z-index: 9998;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}
.call-popup[style*="display: flex"],
.call-popup[style*="display:flex"] { display: flex !important; }

.popup-inner {
  background: var(--surface-solid);
  border: 1px solid var(--primary);
  padding: var(--space-2xl);
  border-radius: var(--radius-xl);
  text-align: center;
  width: 360px;
  max-width: 90%;
  box-shadow: 0 0 60px var(--primary-glow);
  animation: popupIn 0.35s var(--transition-bounce);
}
@keyframes popupIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.popup-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-gradient);
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 0 24px var(--primary-glow);
}
.popup-caller { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.popup-sub { font-size: 12px; color: var(--text-muted); }
.popup-ext { font-size: 14px; color: var(--primary-light); font-family: 'JetBrains Mono', monospace; margin: var(--space-sm) 0 var(--space-lg); }
.popup-btns { display: flex; gap: var(--space-md); justify-content: center; }
.popup-btns button { min-width: 120px; padding: 12px 24px; border-radius: var(--radius) !important; font-size: 14px; }

/* ====================================
   DIRECT CALL OVERLAY
   ==================================== */
.direct-call-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(5, 6, 15, 0.92);
  backdrop-filter: blur(20px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}
.direct-call-overlay.active { display: flex; }

.call-control-card {
  background: var(--bg-elevated);
  border: 1px solid var(--primary);
  padding: var(--space-3xl);
  border-radius: var(--radius-xl);
  text-align: center;
  width: 380px;
  max-width: 90%;
  box-shadow: 0 0 60px var(--primary-glow);
  animation: popupIn 0.35s var(--transition-bounce);
}
.call-avatar-large {
  width: 96px;
  height: 96px;
  background: var(--primary-gradient);
  border-radius: 50%;
  margin: 0 auto var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 0 30px var(--primary-glow);
  animation: pulse-ring 2s ease-in-out infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 var(--primary-glow); }
  70% { box-shadow: 0 0 0 20px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.call-visitor-name { font-size: 22px; font-weight: 800; margin-bottom: var(--space-xs); }
.call-timer { font-family: 'JetBrains Mono', monospace; font-size: 16px; color: var(--primary-light); margin-bottom: var(--space-xl); display: block; letter-spacing: 2px; }

.btn-hangup-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  transition: var(--transition-bounce);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-hangup-circle:hover { transform: scale(1.15); box-shadow: 0 8px 30px rgba(239, 68, 68, 0.5); }
.btn-hangup-circle:active { transform: scale(0.95); }

/* ====================================
   SETTINGS
   ==================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}
.setting-card {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.setting-card:hover { border-color: var(--border-hover); }
.setting-card h4 { margin-bottom: var(--space-sm); font-weight: 700; font-size: 14px; }
.setting-card p { font-size: 12px; color: var(--text-muted); margin-bottom: var(--space-md); line-height: 1.5; }

.dnd-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}
.dnd-toggle input { display: none; }
.dnd-slider {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}
.dnd-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: var(--transition);
}
.dnd-toggle input:checked + .dnd-slider { background: var(--primary); }
.dnd-toggle input:checked + .dnd-slider::after { left: 21px; }
.dnd-label { font-size: 13px; font-weight: 600; }

.presence-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.presence-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ====================================
   CALL GROUPS
   ==================================== */
.group-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.group-members-select {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-sm);
  max-height: 180px;
  overflow-y: auto;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.group-members-select label.chip-select {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
}
.group-members-select label.chip-select:hover { border-color: var(--border-hover); color: var(--text); }
.group-members-select label.chip-select:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}
.group-members-select input { display: none; }
.group-members-select label.chip-select::before {
  content: '○';
  font-size: 14px;
  color: var(--text-muted);
}
.group-members-select label.chip-select:has(input:checked)::before {
  content: '●';
  color: var(--primary-light);
}

.groups-list { display: flex; flex-direction: column; gap: var(--space-md); }

.group-card {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: var(--transition);
}
.group-card:hover { border-color: var(--border-hover); }
.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}
.group-header strong { font-size: 15px; }
.group-ext { font-family: 'JetBrains Mono', monospace; color: var(--primary-light); font-weight: 700; font-size: 13px; }
.group-members {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.group-member-tag {
  background: var(--primary-soft);
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}

/* ====================================
   CALLBACKS
   ==================================== */
.callback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.callback-card-new {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: var(--transition);
}
.callback-card-new:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-glow); }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; }
.visitor-info { display: flex; gap: var(--space-md); align-items: center; }
.v-avatar {
  width: 44px;
  height: 44px;
  background: var(--primary-gradient);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}
.v-name { font-weight: 700; font-size: 15px; }
.v-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.live-indicator {
  font-size: 9px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.live-indicator.online {
  background: var(--success-soft);
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 5px;
}
.live-indicator.online span {
  width: 5px;
  height: 5px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--success-glow);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.live-indicator.offline { background: rgba(255, 255, 255, 0.03); color: var(--text-muted); }

.card-body { flex: 1; }
.v-phone {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-light);
  cursor: pointer;
  margin-bottom: var(--space-sm);
  font-family: 'JetBrains Mono', monospace;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: var(--transition);
  display: inline-block;
}
.v-phone:hover { background: var(--primary-soft); }
.v-msg {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  border-left: 2px solid var(--primary);
}
[dir="rtl"] .v-msg { border-left: none; border-right: 2px solid var(--primary); }

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}
.v-time { font-size: 11px; color: var(--text-muted); }
.v-actions { display: flex; gap: var(--space-sm); }

/* ====================================
   ADD USER FORM
   ==================================== */
.add-user-form {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}
.add-user-form input { flex: 1; min-width: 140px; }
.add-user-form button { flex-shrink: 0; }

/* ====================================
   VISITOR CALLBACK PAGE
   ==================================== */
.callback-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg);
}
.callback-card {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--border);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  width: 440px;
  max-width: 100%;
  box-shadow: var(--shadow-glow), var(--shadow-lg);
}
.callback-card .logo h1 {
  font-size: 28px;
  font-weight: 900;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: var(--space-sm);
}
.callback-card .sub {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}
.callback-target {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: var(--space-lg);
}
.callback-target .ext-name { font-weight: 800; font-size: 18px; }
.callback-target .ext-number { font-size: 14px; color: var(--primary-light); font-family: 'JetBrains Mono', monospace; margin-top: 4px; font-weight: 700; }
.callback-target .ext-status {
  display: inline-block;
  margin-top: var(--space-sm);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.callback-target .ext-status.online { background: var(--success-soft); color: var(--success); }
.callback-target .ext-status.offline { background: var(--danger-soft); color: var(--danger); }

.callback-offline-note {
  font-size: 12px;
  color: var(--warning);
  background: var(--warning-soft);
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: var(--space-md);
  text-align: center;
}

.callback-card input, .callback-card textarea {
  width: 100%;
}

/* ====================================
   ADMIN PANEL
   ==================================== */
.admin-panel .section {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
}
.admin-panel .section h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
  letter-spacing: -0.3px;
}

.add-tenant-form input,
.add-tenant-form select {
  flex: 1;
  min-width: 160px;
}
.add-tenant-form button { flex-shrink: 0; }

.tenant-detail {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  animation: sectionEnter 0.3s ease;
}
.tenant-detail h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
}

/* ====================================
   HELP
   ==================================== */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.help-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.help-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.help-card h4 { font-size: 14px; font-weight: 700; margin-bottom: var(--space-sm); }
.help-card p { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* ====================================
   CDR PAGINATION
   ==================================== */
.cdr-pagination {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-lg);
}
.cdr-pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius) !important;
}
.cdr-pagination button.active {
  background: var(--primary);
  color: #fff;
}

.cdr-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
}

/* ====================================
   PAGINATION & BADGES
   ==================================== */
.muted {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: var(--space-2xl);
}

.err {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-md);
  border: 1px solid var(--danger-soft);
}

.success {
  background: var(--success-soft);
  color: var(--success);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-md);
  border: 1px solid var(--success-soft);
  text-align: center;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: var(--space-md);
  font-size: 13px;
  color: var(--text-muted);
  transition: var(--transition);
}
.back-link:hover { color: var(--text); }

/* ====================================
   CDR EXPORT
   ==================================== */
.pagination-btn { margin: 0 2px; }

/* ====================================
   RESPONSIVE
   ==================================== */
@media (max-width: 960px) {
  .dash {
    grid-template-columns: 1fr;
  }
  .dash-sidebar {
    display: none;
  }
  .dash-main {
    padding: var(--space-md);
    max-height: none;
  }
  .topbar {
    padding: 0 var(--space-md);
  }
  .main {
    padding: var(--space-md);
  }
  .user-info { display: none; }
  .topbar-left .app-logo { margin-right: var(--space-sm); font-size: 17px; }
  .topbar-left a { font-size: 12px; padding: 6px 12px; }
  .contacts-list { grid-template-columns: 1fr; }
  .callback-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  :root {
    --topbar-height: 56px;
    --sidebar-width: 100%;
  }
  .topbar { padding: 0 var(--space-sm); }
  .topbar-left a { display: none; }
  .topbar-left .app-logo { display: block; }
  .lang-switch a { padding: 4px 7px; font-size: 10px; }
  .btn-logout { padding: 6px 12px; font-size: 11px; }
  .phone-float { bottom: 16px; right: 16px; }
  .phone-float-toggle { width: 48px; height: 48px; font-size: 20px; }
  .phone-float-panel { width: calc(100vw - 32px); right: 0; bottom: 60px; }
  .dash-main { padding: var(--space-sm); }
  .contact-item { padding: 12px; }
  .phone-full { padding: var(--space-lg); }
  .phone-full-display { font-size: 22px; padding: 14px; }
  .phone-full-pad { gap: 8px; }
  .phone-full-pad button { font-size: 18px; }
  .call-control-card { padding: var(--space-lg); }
  .call-avatar-large { width: 72px; height: 72px; font-size: 28px; }
  .call-visitor-name { font-size: 18px; }
  .popup-inner { padding: var(--space-lg); }
  .popup-avatar { width: 56px; height: 56px; font-size: 22px; }
  .callback-card { padding: var(--space-lg); }
  .section { padding: var(--space-md); }
}

/* ====================================
   ANIMATIONS
   ==================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* ====================================
   RTL ADJUSTMENTS
   ==================================== */
[dir="rtl"] .tbl th { text-align: right; }
[dir="rtl"] .contact-item:hover { transform: translateX(-4px); }
[dir="rtl"] .number-display { direction: ltr; }
[dir="rtl"] .v-phone { direction: ltr; }
[dir="rtl"] .group-ext { direction: ltr; }

/* ====================================
   CALL BACK VISITOR SECTION
   ==================================== */
#visitor-call-ui {
  background: var(--bg-elevated);
  border: 1px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  margin-top: var(--space-lg);
  box-shadow: 0 0 40px var(--primary-glow);
  animation: popupIn 0.35s var(--transition-bounce);
}
.vc-avatar {
  width: 64px;
  height: 64px;
  background: var(--primary-gradient);
  border-radius: 50%;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 0 24px var(--primary-glow);
}
.vc-agent { font-size: 18px; font-weight: 800; margin-bottom: var(--space-sm); }
.vc-status { font-size: 13px; color: var(--text-secondary); margin-bottom: var(--space-lg); }
.vc-btns { display: flex; gap: var(--space-md); justify-content: center; }
.vc-btn { flex: 1; max-width: 140px; padding: 12px; border-radius: var(--radius) !important; font-weight: 700; font-size: 13px; }
.vc-btn-accept { background: var(--success); color: #fff; }
.vc-btn-accept:hover { box-shadow: 0 4px 16px var(--success-glow); }
.vc-btn-reject { background: var(--danger); color: #fff; }
.vc-btn-reject:hover { box-shadow: 0 4px 16px var(--danger-glow); }

/* ====================================
   WIDGET PREVIEW
   ==================================== */
.call-link-item .link-ext {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary-light);
  font-size: 13px;
  min-width: 60px;
}
.call-link-item .link-name { font-size: 13px; color: var(--text-secondary); flex: 1; }

/* ====================================
   MOBILE APP UI (below 900px)
   ==================================== */
@media (max-width: 899px) {
  :root {
    --bottom-nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  .dash {
    grid-template-columns: 1fr;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  }

  .dash-sidebar { display: none; }

  .dash-main {
    padding: 0;
    max-height: none;
    height: calc(100dvh - var(--bottom-nav-height) - var(--safe-bottom));
    overflow-y: auto;
    padding-bottom: 0;
  }

  .topbar { display: none; }

  /* Mobile top bar */
  .mobile-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(7, 8, 21, 0.9);
    backdrop-filter: var(--glass-blur-strong);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .mobile-topbar .mob-title {
    font-size: 17px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .mobile-topbar .mob-ext {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
  }
  .sidebar-toggle-mob {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
  }
  .mobile-topbar .mob-back {
    background: none;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
  }

  /* Bottom Navigation */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(7, 8, 21, 0.95);
    backdrop-filter: var(--glass-blur-strong);
    border-top: 1px solid var(--border);
    z-index: 2000;
    justify-content: space-around;
    align-items: stretch;
  }
  .bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 4px;
    position: relative;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
  }
  .bnav-item.active {
    color: var(--primary-light);
  }
  .bnav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 0 0 3px 3px;
  }
  .bnav-icon {
    font-size: 20px;
    line-height: 1;
    display: block;
  }
  .bnav-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
  }
  .bnav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(14px);
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    min-width: 16px;
    text-align: center;
    box-shadow: 0 0 6px var(--danger-glow);
  }

  /* More Bottom Sheet */
  .more-sheet {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
  }
  .more-sheet.open { display: block; }
  .more-sheet-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
  }
  .more-sheet-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-solid);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-lg);
    animation: slideUp 0.3s var(--transition);
    max-height: 60vh;
    overflow-y: auto;
  }
  .more-sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    font-size: 16px;
    font-weight: 700;
  }
  .more-sheet-head button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
  }
  .more-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition-fast);
    cursor: pointer;
  }
  .more-item:hover { background: var(--primary-soft); }
  .more-icon { font-size: 18px; width: 24px; text-align: center; }
  .more-label { flex: 1; }

  /* Full screen section content */
  .section-content {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: var(--space-md);
    padding-bottom: 0;
  }
  .section-content.active {
    display: block;
    animation: sectionEnter 0.25s var(--transition);
  }

  .section-header { margin-bottom: var(--space-md); }
  .section-header h2 { font-size: 18px; }
  .section-count { font-size: 12px; }

  /* Phone section - full screen dialpad */
  #section-phone.active {
    display: flex;
    flex-direction: column;
  }
  .phone-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
  }
  .phone-full-display {
    font-size: 36px;
    padding: 14px 20px;
    margin-bottom: var(--space-lg);
    text-align: center;
    min-height: 60px;
    letter-spacing: 2px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
  }
  .phone-full-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 320px;
    width: 100%;
    margin-bottom: var(--space-lg);
  }
  .phone-full-pad button {
    width: 100%;
    aspect-ratio: 1;
    max-width: 100px;
    justify-self: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 26px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    min-height: 64px;
    min-width: 64px;
  }
  .phone-full-pad button:active {
    background: var(--primary-soft);
    transform: scale(0.92);
  }
  .phone-full-pad button .sub {
    font-size: 9px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 1px;
    letter-spacing: 0.5px;
  }
  .phone-full-actions {
    display: flex;
    gap: 16px;
    margin-bottom: var(--space-md);
  }
  .phone-full-btn {
    min-width: 100px;
    padding: 14px 28px;
    border-radius: var(--radius-full);
    border: none;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
  }
  .phone-full-btn.call-btn {
    background: var(--success);
    color: #fff;
    box-shadow: 0 4px 16px var(--success-glow);
  }
  .phone-full-btn.hangup-btn {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 16px var(--danger-glow);
  }
  .phone-full-btn:disabled { opacity: 0.4; cursor: default; }
  .phone-full-btn:active:not(:disabled) { transform: scale(0.95); }
  .phone-full-back {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 8px 16px;
    -webkit-tap-highlight-color: transparent;
    min-width: 48px;
    min-height: 48px;
  }
  .phone-full-back:active { color: var(--text); }

  /* Call status in phone section */
  .call-status {
    font-size: 14px;
    padding: 8px 16px;
    text-align: center;
    margin-bottom: var(--space-sm);
    font-weight: 600;
  }
  .call-status.ringing { color: var(--warning); }
  .call-status.connected { color: var(--success); }
  .call-status.failed { color: var(--danger); }

  /* Call banner - persistent bar during active call */
  .call-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    background: var(--success);
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    align-items: center;
    gap: 8px;
    cursor: pointer;
    animation: slideDown 0.3s var(--transition);
  }
  .call-banner.active { display: flex; }
  .call-banner-icon { font-size: 14px; }
  .call-banner-status { flex: 1; font-size: 13px; font-weight: 700; color: #fff; }
  .call-banner-timer { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.9); font-family: 'JetBrains Mono', monospace; }

  /* Active call overlay - full screen mobile */
  .direct-call-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: var(--bg-elevated);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-xl);
  }
  .direct-call-overlay.active,
  .direct-call-overlay[style*="display: flex"],
  .direct-call-overlay[style*="display:flex"] {
    display: flex !important;
  }
  .call-control-card {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }
  .call-avatar-large {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 0 40px var(--primary-glow);
  }
  .call-visitor-name {
    font-size: 24px;
    font-weight: 800;
  }
  .vc-status { font-size: 15px; color: var(--text-secondary); }
  .call-timer {
    font-size: 48px;
    font-weight: 300;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    letter-spacing: 4px;
  }
  .btn-hangup-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 24px var(--danger-glow);
    transition: var(--transition);
    margin-top: var(--space-lg);
  }
  .btn-hangup-circle:active { transform: scale(0.9); }

  /* Incoming call popup - full screen mobile */
  .call-popup {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: var(--bg-elevated);
    display: none !important;
    align-items: center;
    justify-content: center;
  }
  .call-popup[style*="display: flex"],
  .call-popup[style*="display:flex"] {
    display: flex !important;
  }
  .popup-inner {
    background: none;
    border: none;
    box-shadow: none;
    padding: var(--space-xl);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    max-width: 360px;
    width: 100%;
  }
  .popup-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 0 40px var(--primary-glow);
  }
  .popup-caller { font-size: 22px; font-weight: 800; }
  .popup-sub { font-size: 14px; color: var(--text-muted); }
  .popup-ext { font-size: 18px; font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--primary-light); }
  .popup-btns {
    display: flex;
    gap: 20px;
    margin-top: var(--space-lg);
  }
  .popup-btns button {
    min-width: 120px;
    padding: 16px 32px;
    border-radius: var(--radius-full);
    border: none;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
  }
  .popup-btns button:active { transform: scale(0.95); }
  .btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 4px 16px var(--success-glow);
  }
  .btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 16px var(--danger-glow);
  }

  /* Floating phone hidden on mobile (use full phone section instead) */
  .phone-float { display: none; }

  /* Contact list mobile */
  .contact-item {
    padding: 14px 16px;
    border-radius: var(--radius);
    gap: 12px;
  }
  .contact-item:active {
    background: var(--primary-soft);
    transform: scale(0.98);
  }
  .contact-item .avatar {
    width: 44px;
    height: 44px;
    font-size: 18px;
    flex-shrink: 0;
  }
  .contact-name { font-size: 14px; }
  .contact-ext { font-size: 12px; }
  .contact-dot { width: 10px; height: 10px; }
  .call-contact {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* Settings mobile */
  .settings-grid { grid-template-columns: 1fr; }
  .setting-card { padding: var(--space-md); }

  /* CDR mobile */
  .cdr-table-wrap { overflow-x: auto; }
  .cdr-table-wrap table { font-size: 12px; }
  .cdr-table-wrap table th,
  .cdr-table-wrap table td { padding: 8px 10px; }

  /* Callbacks mobile */
  .callback-grid { grid-template-columns: 1fr; }

  /* Groups mobile */
  .groups-list { grid-template-columns: 1fr; }

  /* Toast mobile */
  .toast {
    left: 16px;
    right: 16px;
    width: auto;
    font-size: 13px;
    padding: 12px 16px;
    bottom: 80px;
  }

  /* Help cards */
  .help-grid { grid-template-columns: 1fr; }
  .help-card { padding: var(--space-md); }

  /* General touch targets */
  .btn-sm, button:not(.bnav-item):not(.phone-full-pad button):not(.popup-btns button):not(.btn-hangup-circle):not(.phone-full-btn) {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 14px;
  }
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Hide desktop-only elements */
  .sidebar-footer { display: none; }
}

/* Show mobile topbar only on mobile */
.mobile-topbar { display: none; }
.bottom-nav { display: none; }
.call-banner { display: none; }

/* ===== CONTACT DELETE BUTTON ===== */
.btn-del-contact {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 10px;
  margin-left: 4px;
  border-radius: 8px;
  transition: background 0.2s;
  opacity: 0.5;
  line-height: 1;
  flex-shrink: 0;
}
.btn-del-contact:hover {
  opacity: 1;
  background: rgba(239,68,68,0.1);
}
[dir="rtl"] .btn-del-contact {
  margin-left: 0;
  margin-right: 4px;
}

/* ===== TOOLTIPS ===== */
.tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  font-size: 11px;
  font-weight: 800;
  cursor: help;
  margin-left: 8px;
  vertical-align: middle;
  flex-shrink: 0;
  user-select: none;
  transition: background 0.2s;
}
.tip-wrap:hover {
  background: rgba(99,102,241,0.3);
}
.tip-wrap .tip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 400;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 280px;
  white-space: normal;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.06);
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
  text-align: center;
}
.tip-wrap .tip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1e293b transparent transparent transparent;
}
.tip-wrap:hover .tip-text,
.tip-wrap.tip-show .tip-text {
  visibility: visible;
  opacity: 1;
}
/* Tooltip on nav items */
.nav-item[data-tip]:hover::after,
.bnav-item[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  margin-top: 4px;
}
.bnav-item[data-tip]:hover::after {
  top: auto;
  bottom: calc(100% + 4px);
  margin-top: 0;
  margin-bottom: 4px;
}
/* Mobile: show on tap via JS class */
.nav-item.tip-show::after,
.bnav-item.tip-show::after {
  content: attr(data-tip);
  position: absolute;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
}
.nav-item.tip-show::after {
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
}
.bnav-item.tip-show::after {
  top: auto;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
}
/* Tooltip on buttons */
.btn-tip {
  position: relative;
}
.btn-tip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
}
/* Section header tooltip icon positioning */
.section-header {
  display: flex;
  align-items: center;
  gap: 4px;
}
.section-header h2 {
  margin: 0;
}
[dir="rtl"] .tip-wrap {
  margin-left: 0;
  margin-right: 8px;
}
