/* Auth boot splash — hide login until session restore completes */
html.auth-pending #login-screen,
html.auth-pending #app-screen {
  display: none !important;
}

html.auth-pending #auth-boot {
  display: flex !important;
}

/* ===== CSS VARIABLES ===== */
:root {
  --primary: #1a3c6e;
  --primary-light: #2a5499;
  --primary-dark: #0f2444;
  --accent: #f0a500;
  --accent-dark: #c88a00;
  --accent-light: #ffc940;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --purple: #8b5cf6;
  --bg: #f0f4fa;
  --bg2: #e4eaf4;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #d1dce8;
  --text: #0f1d2e;
  --text2: #4a6080;
  --text3: #8aa0bc;
  --shadow: 0 2px 12px rgba(26, 60, 110, 0.10);
  --shadow-lg: 0 8px 32px rgba(26, 60, 110, 0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --font: 'DM Sans', sans-serif;
  --brand: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --mono: 'Space Mono', monospace;
  --green-status: #22c55e;
  --red-status: #ef4444;
  --orange-status: #f59e0b;
  --grey-status: #94a3b8;
  --transition: 0.18s ease;
}

[data-theme="dark"] {
  --bg: #0a1628;
  --bg2: #0f1e38;
  --surface: #132040;
  --surface2: #1a2d50;
  --border: #1f3460;
  --text: #e8f0fc;
  --text2: #8aa8d8;
  --text3: #4a6899;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

html {
  font-size: 14px;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  height: 100%;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

html:has(#app-screen.active) body {
  overflow: hidden;
  height: 100%;
  height: 100dvh;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  outline: none;
}

input,
select,
textarea {
  font-family: var(--font);
  outline: none;
}

a {
  text-decoration: none;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg2);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text3);
}

/* ===== UTILITIES ===== */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 6px;
}

.gap-2 {
  gap: 10px;
}

.gap-3 {
  gap: 14px;
}

.gap-4 {
  gap: 18px;
}

.w-full {
  width: 100%;
}

.text-sm {
  font-size: 0.82rem;
}

.text-xs {
  font-size: 0.72rem;
}

.text-lg {
  font-size: 1.1rem;
}

.text-xl {
  font-size: 1.3rem;
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-mono {
  font-family: var(--mono);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mt-1 {
  margin-top: 6px;
}

.mt-2 {
  margin-top: 10px;
}

/* ===== DEMO BANNER ===== */
#demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, var(--accent) 0%, #ff8c00 100%);
  color: #fff;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#demo-banner.hidden {
  display: none !important;
}

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.82rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease, fadeOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
  max-width: 320px;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(4px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  min-width: 340px;
  max-width: 560px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
  border: 1px solid var(--border);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.92);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

[data-theme="dark"] .modal-title {
  color: var(--accent);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg2);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--border);
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 60, 110, 0.12);
}

[data-theme="dark"] .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(0.9);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(0.9);
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-warning:hover {
  filter: brightness(0.9);
}

.btn-info {
  background: var(--info);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text2);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text2);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--primary);
  color: #fff;
}

.btn-icon.active {
  background: var(--primary);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== STATUS BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

.badge-available {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-status);
}

.badge-connected {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-status);
}

.badge-oncall {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-status);
}

.badge-ringing {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.badge-paused {
  background: rgba(245, 158, 11, 0.15);
  color: var(--orange-status);
}

.badge-wrapup {
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple);
}

.badge-away {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.badge-locked {
  background: rgba(148, 163, 184, 0.15);
  color: var(--grey-status);
}

.badge-loggedout {
  background: rgba(148, 163, 184, 0.15);
  color: var(--grey-status);
}

.badge::before {
  animation: none;
}

.badge-available::before,
.badge-connected::before,
.badge-oncall::before {
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* ===== AMI STATUS ===== */
.ami-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
}

.ami-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-status);
}

.ami-dot.connected {
  background: var(--success);
  animation: pulse 2s infinite;
}

.ami-dot.error {
  background: var(--danger);
}

/* ===== ===================== ===== */
/* ===== LOGIN SCREEN          ===== */
/* ===== ===================== ===== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0a1628 0%, #1a3c6e 60%, #0f2444 100%);
}

.login-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(240, 165, 0, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(42, 84, 153, 0.3) 0%, transparent 50%);
  pointer-events: none;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
  animation: scaleIn 0.3s ease;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(240, 165, 0, 0.35);
}

.login-brand h1 {
  font-family: var(--brand);
  font-size: 1.55rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.login-brand p {
  font-size: 0.62rem;
  color: #f1f4fa;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  margin-top: 2px;
}

.login-tagline {
  font-family: var(--brand);
  font-style: italic;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  margin: -16px 0 22px;
  letter-spacing: 0.01em;
}

.login-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 20px 0;
}

.login-form .form-label {
  color: rgba(255, 255, 255, 0.6);
}

.login-form .form-control {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.login-form .form-control::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.login-form .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.2);
}

.login-form select.form-control option {
  background: #1a3c6e;
}

.login-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all var(--transition);
  margin-top: 6px;
  box-shadow: 0 4px 16px rgba(240, 165, 0, 0.35);
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(240, 165, 0, 0.45);
}

.login-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
}

.login-settings-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 0.9rem;
  z-index: 2;
}

.login-settings-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.login-theme-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 0.9rem;
  z-index: 2;
}

.login-theme-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

#auth-boot {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(135deg, #0a1628 0%, #1a3c6e 60%, #0f2444 100%);
}

.auth-boot-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: block;
  box-shadow: 0 4px 20px rgba(240, 165, 0, 0.35);
}

.auth-boot-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-boot-spin 0.8s linear infinite;
}

@keyframes auth-boot-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== ===================== ===== */
/* ===== MAIN APP LAYOUT       ===== */
/* ===== ===================== ===== */
body.wa-viewer-open {
  overflow: hidden;
}

#app-screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

#app-screen.active {
  display: flex;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* ===== HEADER ===== */
.app-header {
  background: var(--primary);
  color: #fff;
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: block;
  border-radius: 7px;
}

.header-logo-text {
  font-family: var(--brand);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.header-logo-text span {
  display: block;
  font-family: var(--font);
  font-size: 0.52rem;
  opacity: 0.72;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.header-sep {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.header-agent-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-agent-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.header-agent-ext {
  font-size: 0.68rem;
  opacity: 0.65;
  font-family: var(--mono);
}

.header-spacer {
  flex: 1;
}

.header-campaign {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-session-timer {
  font-family: var(--mono);
  font-size: 0.78rem;
  opacity: 0.8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: all var(--transition);
  position: relative;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.header-notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 14px;
  height: 14px;
  background: var(--danger);
  border-radius: 50%;
  font-size: 0.58rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.header-logout {
  background: rgba(239, 68, 68, 0.2);
  color: #ffb3b3;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition);
}

.header-logout:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #fff;
}

/* ===== NAV TABS (Supervisor) ===== */
.supervisor-nav {
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 2px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.supervisor-nav.hidden {
  display: none;
}

.s-nav-btn {
  padding: 9px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  white-space: nowrap;
}

.s-nav-btn.s-nav-admin {
  margin-right: 6px;
  padding-right: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.s-nav-btn:hover {
  color: rgba(255, 255, 255, 0.85);
}

.s-nav-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===== MAIN CONTENT AREA ===== */
.app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* Agent vs supervisor panels are siblings — never show both at once */
.app-body:not(.supervisor-mode) .supervisor-content {
  display: none !important;
}

.app-body.supervisor-mode #agent-workspace {
  display: none !important;
}

.app-body.supervisor-mode .supervisor-content.active {
  display: block;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

/* ===== DISCONNECTION BANNER ===== */
#reconnect-banner {
  background: var(--danger);
  color: #fff;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

#reconnect-banner.show {
  display: flex;
}

/* ===== ===================== ===== */
/* ===== AGENT LAYOUT          ===== */
/* ===== ===================== ===== */
#agent-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
  min-height: 0;
  width: 100%;
}

/* LEFT PANEL — Softphone */
.softphone-panel {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width var(--transition);
}

.panel-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.call-display {
  margin: 12px;
  background: var(--primary-dark);
  border-radius: var(--radius);
  padding: 14px;
  color: #fff;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.call-display::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(240, 165, 0, 0.08) 0%, transparent 60%);
}

.call-caller-id {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.call-queue-label {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.call-duration {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 6px;
}

.call-status-text {
  font-size: 0.72rem;
  opacity: 0.6;
  margin-top: 2px;
}

.incoming-pulse {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  animation: incomingPulse 0.8s ease-in-out infinite;
}

@keyframes incomingPulse {

  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(34, 197, 94, 0);
  }

  50% {
    box-shadow: inset 0 0 0 4px rgba(34, 197, 94, 0.4);
  }
}

/* Call Controls */
.call-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 0 12px 12px;
}

.cc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  transition: all var(--transition);
  background: var(--bg2);
  color: var(--text2);
  border: 1.5px solid transparent;
}

.cc-btn span {
  font-size: 0.58rem;
  font-weight: 600;
}

.cc-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cc-btn.answer {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.cc-btn.answer:hover {
  background: var(--success);
  color: #fff;
}

.cc-btn.answer:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.cc-btn.hangup {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.cc-btn.hangup:hover {
  background: var(--danger);
  color: #fff;
}

.cc-btn.hold {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.cc-btn.hold:hover {
  background: var(--warning);
  color: #fff;
}

.cc-btn.mute {
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
}

.cc-btn.mute:hover {
  background: var(--info);
  color: #fff;
}

.cc-btn.active-state {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.2);
}

/* Dialpad */
.dialpad {
  padding: 0 12px 12px;
}

.dialpad-input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  text-align: center;
  margin-bottom: 8px;
}

.dialpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.dp-key {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
}

.dp-key:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(0.97);
}

.dp-key sub {
  font-size: 0.5rem;
  font-weight: 400;
  opacity: 0.6;
}

.dial-btn {
  width: 100%;
  margin-top: 6px;
  padding: 9px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
}

.dial-btn:hover {
  background: var(--primary-light);
}

/* CENTER PANEL */
.customer-panel {
  flex: 1;
  min-width: 0;
  background: var(--surface2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.customer-inner {
  padding: 16px;
  flex: 1;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.info-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-card-title i {
  color: var(--primary);
}

[data-theme="dark"] .info-card-title i {
  color: var(--accent);
}

.caller-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  padding: 14px;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.caller-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.caller-number {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
}

.caller-queue {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Priority Selector */
.priority-selector {
  display: flex;
  gap: 6px;
}

.priority-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  border: 1.5px solid var(--border);
  color: var(--text2);
  transition: all var(--transition);
  background: var(--bg);
}

.priority-btn.low.active {
  border-color: var(--info);
  background: rgba(59, 130, 246, 0.12);
  color: var(--info);
}

.priority-btn.normal.active {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.priority-btn.high.active {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.priority-btn.urgent.active {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

/* RIGHT PANEL — Disposition */
.disposition-panel {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.wrapup-timer {
  margin: 12px;
  background: var(--primary-dark);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  color: #fff;
}

.wrapup-label {
  font-size: 0.68rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.wrapup-count {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin: 4px 0;
}

.wrapup-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.wrapup-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}

.disposition-btns {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.disp-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  background: var(--bg2);
  color: var(--text);
  border: 1.5px solid transparent;
}

.disp-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateX(2px);
}

.disp-btn.selected {
  border-color: var(--primary);
  background: rgba(26, 60, 110, 0.1);
  color: var(--primary);
}

[data-theme="dark"] .disp-btn.selected {
  background: rgba(240, 165, 0, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.disp-btn-icon {
  font-size: 1rem;
}

.datetime-picker-wrap {
  padding: 12px;
  display: none;
}

.datetime-picker-wrap.show {
  display: block;
}

/* BOTTOM STATUS BAR */
.agent-bottom {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.pause-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pause-select-wrap {
  position: relative;
}

.pause-dropdown {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}

.pause-timer {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--warning);
}

.agent-stats {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

[data-theme="dark"] .stat-value {
  color: var(--accent);
}

.stat-label {
  font-size: 0.58rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* RECENT CALLS SIDEBAR */
.calls-sidebar {
  width: 300px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.calls-sidebar.collapsed {
  width: 0;
  border: none;
}

.calls-sidebar-inner {
  width: 300px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

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

.call-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.call-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.call-item-number {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.call-item-time {
  font-size: 0.68rem;
  color: var(--text3);
}

.call-item-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.call-item-queue {
  font-size: 0.65rem;
  color: var(--text3);
}

.call-item-disp {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 100px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
}

.call-item-disp.callback {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.call-item-disp.escalated {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.call-item-notes {
  font-size: 0.7rem;
  color: var(--text2);
  margin-top: 4px;
  display: none;
}

.call-item.expanded .call-item-notes {
  display: block;
}

.rec-player {
  width: 100%;
  align-self: stretch;
  margin-top: 6px;
  box-sizing: border-box;
}

.rec-play-btn {
  width: 100%;
  display: flex;
  box-sizing: border-box;
}

.rec-player-ui {
  width: 100%;
  margin-top: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.rec-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-row2 {
  justify-content: space-between;
}

.rec-icon-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  text-decoration: none;
  flex: none;
}

.rec-icon-btn:hover {
  background: var(--bg3);
  color: var(--accent);
}

.rec-time {
  font-size: 0.65rem;
  color: var(--text3);
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rec-seek {
  flex: 1;
  height: 4px;
  cursor: pointer;
  accent-color: var(--accent);
}

.rec-speeds {
  display: flex;
  gap: 4px;
}

.rec-speed {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1.4;
}

.rec-speed:hover {
  color: var(--text2);
}

.rec-speed.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== ===================== ===== */
/* ===== SUPERVISOR PANELS     ===== */
/* ===== ===================== ===== */
.supervisor-content {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: none;
}

.supervisor-content.active {
  display: block;
}

.admin-subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-nav-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-size: 0.8rem;
}

.admin-nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.admin-content {
  display: none;
}

.admin-content.active {
  display: block;
}

#tab-admin .admin-content {
  padding: 0;
}

/* ===== ADMIN SHELL (Advanced Settings side nav) ===== */
.admin-shell-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  min-height: 480px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.admin-shell-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-shell-sidebar-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 8px 12px;
  border-bottom: 1px solid var(--border);
}

.admin-shell-sidebar-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

[data-theme="dark"] .admin-shell-sidebar-icon {
  background: var(--accent);
}

.admin-shell-sidebar-title {
  font-size: 0.88rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  line-height: 1.25;
}

.admin-shell-sidebar-sub {
  font-size: 0.68rem;
  color: var(--text3);
  margin: 2px 0 0;
}

.admin-shell-sidenav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-shell-nav-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.admin-shell-nav-btn>i.fas:first-child {
  width: 18px;
  margin-top: 2px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.75;
}

.admin-shell-nav-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.admin-shell-nav-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

[data-theme="dark"] .admin-shell-nav-btn.active {
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-shell-nav-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-shell-nav-label {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

.admin-shell-nav-desc {
  font-size: 0.65rem;
  color: var(--text3);
  line-height: 1.3;
}

.admin-shell-nav-btn.active .admin-shell-nav-desc {
  color: var(--text2);
}

.admin-shell-content {
  padding: 20px 22px;
  overflow: auto;
  min-width: 0;
}

.admin-shell-page-header {
  margin-bottom: 18px;
}

.admin-shell-page-header h3 {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--text);
}

.admin-shell-page-header p {
  font-size: 0.78rem;
  color: var(--text2);
  margin: 0;
  line-height: 1.45;
}

.admin-shell-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.admin-shell-hint {
  font-size: 0.72rem;
  color: var(--text3);
  margin: 0 0 18px;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.admin-shell-hint i {
  margin-right: 6px;
  color: var(--primary);
}

.admin-shell-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.admin-shell-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.admin-shell-stat-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.admin-shell-stat-denom {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text3);
}

.admin-shell-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
  margin-top: 6px;
}

.admin-shell-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-shell-link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.admin-shell-link-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.admin-shell-link-card>i.fas:first-child {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.admin-shell-link-card strong {
  display: block;
  font-size: 0.8rem;
  color: var(--text);
}

.admin-shell-link-card span {
  display: block;
  font-size: 0.68rem;
  color: var(--text3);
  margin-top: 2px;
}

.admin-shell-link-arrow {
  margin-left: auto;
  color: var(--text3);
  font-size: 0.7rem;
}

.admin-shell-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.admin-shell-kv {
  margin: 0;
  display: grid;
  gap: 12px;
}

.admin-shell-kv>div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.admin-shell-kv>div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.admin-shell-kv dt {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
  margin: 0;
}

.admin-shell-kv dd {
  font-size: 0.82rem;
  color: var(--text);
  margin: 0;
}

.admin-shell-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.admin-shell-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
}

.admin-shell-status-pill.ok {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--success);
}

.admin-shell-status-pill.warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--warning);
}

.admin-shell-dtmf-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
}

[data-theme="dark"] .admin-shell-dtmf-key {
  background: var(--accent);
}

.admin-shell-prompt-id {
  font-size: 0.75rem;
}

.admin-shell-prompt-label {
  font-weight: 600;
  font-size: 0.8rem;
}

.admin-shell-prompt-desc {
  font-size: 0.68rem;
  color: var(--text3);
  margin-top: 2px;
}

.admin-shell-hidden-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

#admin-tab-ivr {
  padding: 0;
}

#admin-tab-ivr #admin-ivr-body {
  min-height: 400px;
}

@media (max-width: 900px) {
  .admin-shell-layout {
    grid-template-columns: 1fr;
  }

  .admin-shell-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }

  .admin-shell-sidenav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
  }

  .admin-shell-nav-btn {
    flex: 0 0 auto;
    min-width: 140px;
    box-shadow: none !important;
  }

  .admin-shell-nav-desc {
    display: none;
  }

  .admin-shell-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-shell-link-grid {
    grid-template-columns: 1fr;
  }

  .admin-shell-kv>div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.badge-ok {
  color: var(--success);
  font-weight: 600;
}

.badge-warn {
  color: var(--warning);
  font-weight: 600;
}

.text-muted {
  color: var(--text2);
}

.text-danger {
  color: var(--danger);
}

/* ===== ADMIN TEAM GRID (3CX-inspired) ===== */
.team-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.team-toolbar-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0;
  margin-right: auto;
}

.team-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.team-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 0.8rem;
  pointer-events: none;
}

.team-search {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
}

.team-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 60, 110, 0.12);
}

.team-filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.team-filter-tab {
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.team-filter-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
}

.team-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.team-card.is-favorite {
  border-color: rgba(240, 165, 0, 0.45);
}

.team-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  min-height: 22px;
}

.team-card-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: 4px;
}

.team-card-menu {
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.team-card-menu:hover {
  background: var(--bg2);
  color: var(--text);
}

.team-avatar-wrap {
  position: relative;
  margin-bottom: 10px;
}

.team-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), #2d5a9e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .team-avatar {
  background: linear-gradient(145deg, #1e3a5f, var(--accent));
  color: #1a1a1a;
}

.team-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.team-status-dot--online {
  background: var(--success);
}

.team-status-dot--busy {
  background: var(--danger);
}

.team-status-dot--away {
  background: var(--warning);
}

.team-status-dot--offline {
  background: #94a3b8;
}

.team-status-dot--inactive {
  background: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.3);
}

.team-card.team-card--inactive {
  border-color: rgba(220, 38, 38, 0.35);
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.06) 0%, var(--surface) 40%);
}

.team-card-status--inactive {
  color: #dc2626;
  font-weight: 600;
}

.header-workspace-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.header-ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text2);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.header-ws-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.header-ws-btn.active {
  background: var(--primary);
  color: #fff;
}

.header-workspace-sep {
  margin: 0 4px;
}

.team-card-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 2px;
  word-break: break-word;
}

.team-card-ext {
  font-size: 0.72rem;
  color: var(--text2);
  font-family: var(--mono);
  margin-bottom: 2px;
}

.team-card-status {
  font-size: 0.68rem;
  color: var(--text3);
  margin-bottom: 10px;
}

.team-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  width: 100%;
  justify-content: center;
}

.team-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.team-action-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.team-action-btn.is-favorite {
  color: var(--accent);
  border-color: rgba(240, 165, 0, 0.35);
}

.team-action-btn.is-favorite:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
}

.team-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--text3);
  font-size: 0.85rem;
}

.team-count {
  font-size: 0.72rem;
  color: var(--text3);
  margin-bottom: 12px;
}

#admin-agent-modal .modal {
  max-width: 560px;
}

.agent-form-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.agent-form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.agent-form-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  margin-bottom: 10px;
}

/* Queue stat cards */
.queue-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.queue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}

.queue-card.q-6001 {
  border-top-color: var(--danger);
}

.queue-card.q-6002 {
  border-top-color: var(--accent);
}

.queue-card.q-6003 {
  border-top-color: var(--info);
}

.queue-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.queue-card-title span {
  font-size: 0.65rem;
  background: var(--bg2);
  padding: 2px 6px;
  border-radius: 4px;
}

.queue-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.qs-item {
  text-align: center;
}

.qs-value {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.qs-value.danger {
  color: var(--danger);
}

.qs-value.warning {
  color: var(--warning);
}

.qs-value.success {
  color: var(--success);
}

.qs-label {
  font-size: 0.6rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.service-level-bar {
  margin-top: 12px;
  height: 6px;
  background: var(--bg2);
  border-radius: 3px;
  overflow: hidden;
}

.sl-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.sl-fill.good {
  background: var(--success);
}

.sl-fill.warn {
  background: var(--warning);
}

.sl-fill.bad {
  background: var(--danger);
}

/* Agents Table */
.data-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

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

.data-table-title {
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-table-title .count {
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 100px;
}

[data-theme="dark"] .data-table-title .count {
  background: var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 9px 12px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg2);
}

.agent-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-available {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.dot-oncall {
  background: var(--danger);
  animation: pulse 1.5s infinite;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.dot-paused {
  background: var(--warning);
}

.dot-away {
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.dot-loggedout {
  background: var(--grey-status);
}

.action-btns {
  display: flex;
  gap: 4px;
}

.act-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  background: var(--bg2);
  color: var(--text2);
}

.act-btn:hover {
  background: var(--primary);
  color: #fff;
}

.act-btn.danger:hover {
  background: var(--danger);
}

/* Call duration coloring */
.dur-good {
  color: var(--success);
}

.dur-warn {
  color: var(--warning);
}

.dur-bad {
  color: var(--danger);
  font-weight: 700;
}

/* ===== WALLBOARD ===== */
#wallboard-panel {
  display: none;
  flex: 1;
  background: var(--primary-dark);
  color: #fff;
  padding: 20px;
  overflow: auto;
}

#wallboard-panel.active {
  display: block;
}

.wb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.wb-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wb-time {
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--accent);
}

.wb-queues {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.wb-queue-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.wb-queue-name {
  font-size: 0.72rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.wb-big-num {
  font-family: var(--mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.wb-big-label {
  font-size: 0.68rem;
  opacity: 0.5;
  margin-top: 4px;
}

.wb-agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.wb-agent-cell {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.wb-agent-name {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.wb-agent-status {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 100px;
  display: inline-block;
}

.wb-status-available {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.wb-status-oncall {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.wb-status-paused {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.wb-motivational {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.wb-mot-card {
  background: rgba(240, 165, 0, 0.1);
  border: 1px solid rgba(240, 165, 0, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.wb-mot-num {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.wb-mot-label {
  font-size: 0.68rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ===== REPORTS TAB ===== */
.reports-wrap {
  width: 100%;
  max-width: none;
}

.reports-filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
}

.report-chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text2);
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.report-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}

.report-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text2);
  margin: 0 0 8px;
}

.report-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .report-charts-row {
    grid-template-columns: 1fr;
  }
}

.report-pct-good {
  color: var(--success);
  font-weight: 700;
}

.report-pct-warn {
  color: var(--warning);
  font-weight: 700;
}

.report-pct-bad {
  color: var(--danger);
  font-weight: 700;
}

.rsc-value {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

[data-theme="dark"] .rsc-value {
  color: var(--accent);
}

.rsc-label {
  font-size: 0.65rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ===== INTERNAL MESSAGING ===== */
.messaging-overlay {
  position: fixed;
  bottom: 0;
  right: 20px;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  flex-direction: column;
  max-height: 480px;
  transition: all 0.2s ease;
}

.messaging-overlay.open {
  display: flex;
}

.msg-header {
  padding: 10px 12px;
  background: var(--primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.msg-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.msg-title {
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ic-back-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.ic-back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.ic-list-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.ic-search-icon {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ic-peer-search {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.78rem;
  background: var(--bg);
  color: var(--text);
}

.ic-peer-search:focus {
  outline: none;
  border-color: var(--primary);
}

.ic-room-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-input-row .msg-input-wrap {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  width: 100%;
}

.msg-input-row .msg-input-wrap .msg-input {
  width: 100%;
  flex: none;
  box-sizing: border-box;
}

.ic-mention-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  max-height: 160px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 30;
}

.ic-mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 0.76rem;
}

.ic-mention-item:hover,
.ic-mention-item.active {
  background: var(--bg2);
}

.ic-mention-item .ic-mention-code {
  font-weight: 700;
  color: var(--primary);
}

.ic-mention-item .ic-mention-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.ic-mention {
  color: var(--primary);
  font-weight: 700;
  background: rgba(240, 165, 0, 0.12);
  padding: 0 3px;
  border-radius: 3px;
}

.msg-bubble.mine .ic-mention {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.msg-bubble.mentioned-me {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.ic-mentioned-you {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

.msg-bubble.mine .ic-mentioned-you {
  color: var(--accent-light);
}

.ic-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}

.ic-room-item,
.ic-peer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.ic-room-item:hover,
.ic-peer-item:hover {
  background: var(--bg2);
}

.ic-peer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ic-peer-avatar.team {
  background: var(--accent);
  font-size: 0.7rem;
}

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

.ic-peer-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.ic-peer-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ic-unread {
  background: var(--danger);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: auto;
}

.ic-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.msg-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-time {
  font-size: 0.58rem;
  opacity: 0.55;
  margin-top: 4px;
  text-align: right;
}

.msg-bubble {
  max-width: 80%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: var(--wa-msg-font-size, 0.78rem);
  line-height: 1.4;
}

.messaging-overlay {
  --wa-msg-font-size: 0.78rem;
}
.messaging-overlay.wa-text-size-sm { --wa-msg-font-size: 0.68rem; }
.messaging-overlay.wa-text-size-lg { --wa-msg-font-size: 0.9rem; }
.messaging-overlay.wa-text-size-xl { --wa-msg-font-size: 1.05rem; }

.msg-bubble.mine {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.msg-bubble.theirs {
  align-self: flex-start;
  background: var(--bg2);
  color: var(--text);
  border-bottom-left-radius: 3px;
}

.msg-bubble.broadcast {
  align-self: stretch;
  background: rgba(240, 165, 0, 0.12);
  border: 1px solid rgba(240, 165, 0, 0.3);
  color: var(--text);
  border-radius: var(--radius-sm);
  text-align: center;
}

.msg-sender {
  font-size: 0.62rem;
  opacity: 0.6;
  margin-bottom: 2px;
}

.msg-input-row {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.msg-input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: var(--wa-msg-font-size, 0.8rem);
}

.msg-send-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.msg-send-btn:hover {
  background: var(--primary-light);
}

/* ===== SETTINGS MODAL CONTENT ===== */
.settings-section {
  margin-bottom: 18px;
}

.settings-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.toggle-label {
  font-size: 0.82rem;
  color: var(--text2);
}

.toggle {
  width: 40px;
  height: 22px;
  border-radius: 100px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle.on {
  background: var(--primary);
}

[data-theme="dark"] .toggle.on {
  background: var(--accent);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left var(--transition);
}

.toggle.on::after {
  left: 21px;
}

/* ===== CONFIRM DIALOG ===== */
.confirm-dialog {
  text-align: center;
}

.confirm-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.confirm-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.confirm-msg {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 18px;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ===== IDLE WARNING ===== */
#idle-warning {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

#idle-warning.show {
  display: flex;
}

.idle-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.idle-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
}

.idle-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.idle-msg {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 20px;
}

.idle-timer {
  font-family: var(--mono);
  font-size: 2rem;
  color: var(--danger);
}

/* ===== LOCK SCREEN ===== */
#lock-screen {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#lock-screen.hidden {
  display: none;
}

.lock-screen-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  text-align: center;
  max-width: 380px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.lock-screen-icon {
  font-size: 2.2rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.lock-screen-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.lock-screen-sub {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 12px;
}

.lock-screen-msg {
  font-size: 0.78rem;
  color: var(--text3);
  margin: 0 0 16px;
  line-height: 1.45;
}

.lock-screen-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--danger);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  margin-bottom: 12px;
  text-align: left;
}
  font-weight: 700;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--border) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ===== TRANSFER PANEL ===== */
.transfer-panel {
  position: absolute;
  bottom: 60px;
  left: 12px;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}

.transfer-panel.show {
  display: block;
  animation: scaleIn 0.15s ease;
}

.transfer-tab-row {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.transfer-tab {
  flex: 1;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  background: var(--bg2);
  color: var(--text2);
  transition: all var(--transition);
}

.transfer-tab.active {
  background: var(--primary);
  color: #fff;
}

/* ===== PRINT STYLES ===== */
@media print {

  .app-header,
  .softphone-panel,
  .disposition-panel,
  .agent-bottom,
  .calls-sidebar,
  .supervisor-nav,
  #demo-banner,
  #toast-container,
  .messaging-overlay,
  .header-actions,
  .reports-filters .btn {
    display: none !important;
  }

  .supervisor-content {
    display: block !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  table {
    font-size: 10px;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .softphone-panel {
    width: 220px;
  }

  .disposition-panel {
    width: 200px;
  }

  .calls-sidebar {
    display: none;
  }

  .agent-stats {
    display: none;
  }

  .queue-cards-row {
    grid-template-columns: 1fr;
  }

  .wb-queues {
    grid-template-columns: 1fr;
  }

  .wb-motivational {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .softphone-panel {
    display: none;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .header-campaign,
  .header-session-timer {
    display: none;
  }

  .disposition-panel {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .call-controls {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== VOICE & IVR BUILDER (PREMIUM AESTHETICS) ===== */
.ib-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.ib-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.02em;
}

.ib-subtitle {
  font-size: 0.85rem;
  color: var(--text3);
  margin: 4px 0 0;
}

.ib-control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
}

.ib-search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.ib-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 0.85rem;
  pointer-events: none;
}

.ib-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all var(--transition);
}

.ib-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.ib-filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ib-filter-tab {
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.ib-filter-tab:hover {
  color: var(--text);
  background: var(--bg2);
}

.ib-filter-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.ib-table {
  width: 100%;
  border-collapse: collapse;
}

.ib-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.ib-table td {
  padding: 14px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.ib-table tr:last-child td {
  border-bottom: none;
}

.ib-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ib-icon-container {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .ib-icon-container {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.ib-name-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.ib-name-desc {
  font-size: 0.72rem;
  color: var(--text3);
  margin-top: 2px;
}

.ib-badge-ext {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

[data-theme="dark"] .ib-badge-ext {
  color: var(--accent);
  background: rgba(240, 165, 0, 0.05);
  border-color: rgba(240, 165, 0, 0.25);
}

.ib-badge-entry {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

[data-theme="dark"] .ib-badge-entry {
  color: var(--accent);
  background: rgba(240, 165, 0, 0.1);
  border-color: rgba(240, 165, 0, 0.25);
}

.ib-inbound-panel {
  padding: 1.25rem;
}

.ib-platform-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ib-platform-cli-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.ib-platform-cli-row .form-control {
  flex: 1 1 220px;
  max-width: 360px;
}

.ib-kv-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
  margin: 12px 0 0;
}

.ib-kv-list > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ib-kv-list dt {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text3);
}

.ib-kv-list dd {
  margin: 0;
  font-size: 0.88rem;
}

.ssf-cell-sub {
  font-size: 0.72rem;
  margin-top: 2px;
}

.ssf-node-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface);
}

.ssf-node-card summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

.ssf-node-type-badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface2);
  margin-right: 6px;
}

.ssf-opt-row {
  display: grid;
  grid-template-columns: 48px 1fr 120px 1fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.ssf-add-node-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.ssf-graph-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  padding: 8px;
}

.ssf-graph-svg {
  display: block;
  min-width: 320px;
}

.ssf-graph-node-type {
  font-size: 9px;
  fill: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ssf-graph-node-title {
  font-size: 11px;
  fill: var(--text);
  font-weight: 600;
}

.ssf-graph-node-id {
  font-size: 9px;
  fill: var(--text3);
  font-family: ui-monospace, monospace;
}

.ssf-graph-edge-label {
  font-size: 9px;
  fill: var(--text3);
  text-anchor: middle;
}

.ssf-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 4px 4px;
  font-size: 0.72rem;
  color: var(--text3);
}

.ssf-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

.ssf-graph-empty {
  margin: 0;
  padding: 12px;
}

.ssf-node-card-highlight {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ib-title-mt {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .ssf-opt-row {
    grid-template-columns: 1fr 1fr;
  }
}

.ib-hours-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ib-hours-row {
  display: grid;
  grid-template-columns: 140px 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.ib-hours-day-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.ib-hours-sep {
  font-size: 0.8rem;
  color: var(--text3);
}

.ib-did-routes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.ib-did-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
}

.ib-did-remove {
  margin-bottom: 2px;
}

.ib-header-row-compact {
  margin-bottom: 0;
}

.ib-section-title-flush {
  margin-bottom: 4px;
}

.ib-did-empty {
  margin: 0;
  padding: 8px 0;
}

.ib-field-hint {
  font-size: 0.72rem;
  margin-top: 4px;
}

.ib-check-label-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 6px;
}

.ib-badge-strat {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  text-transform: capitalize;
}

.ib-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
}

.ib-status-pill.active {
  color: #15803d;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.ib-status-pill.active span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.ib-status-pill.draft {
  color: #475569;
  background: rgba(100, 116, 139, 0.08);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.ib-status-pill.draft span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}

.ib-kebab-btn {
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.ib-kebab-btn:hover {
  background: var(--bg2);
  color: var(--text);
}

.ib-kebab-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  min-width: 130px;
  text-align: left;
  overflow: hidden;
  animation: scaleIn 0.12s ease;
}

.ib-kebab-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.ib-kebab-menu button:hover {
  background: var(--bg2);
}

.ib-empty-state {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 64px 24px;
  text-align: center;
  margin-top: 16px;
  background: var(--surface);
}

.ib-empty-icon-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 20px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .ib-empty-icon-wrap {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

/* IVR Builder — editor & forms (CSP-safe: no inline styles in templates) */
.ib-editor-view {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ib-editor-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.ib-editor-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text1);
}

.ib-editor-body {
  padding: 20px;
}

.ib-editor-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.ib-section {
  margin-top: 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.ib-section-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text1);
}

.ib-section-mt-sm {
  margin-top: 12px;
}

.ib-form-row-mt {
  margin-top: 12px;
}

.ib-form-group-flush {
  margin: 0;
}

.ib-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.ib-check-input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.ib-member-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg2);
}

.ib-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
}

.ib-member-row:hover {
  background: var(--border);
}

.ib-member-ext {
  margin-left: 8px;
  font-size: 0.8rem;
}

.ib-member-empty {
  text-align: center;
  padding: 16px;
}

.ib-queue-flags {
  display: flex;
  gap: 24px;
  margin: 20px 0;
  background: var(--bg2);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ib-queue-flag-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.ib-dest-picker {
  display: flex;
  gap: 8px;
}

.ib-dest-action {
  width: 160px;
  flex-shrink: 0;
}

.ib-dest-target {
  flex: 1;
  min-width: 0;
}

.ib-dest-empty {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--text3);
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--bg2);
}

.ib-strategy-group {
  margin-bottom: 12px;
}

.ib-strategy-desc {
  font-size: 0.75rem;
  margin-top: 4px;
  color: var(--text3);
}

.ib-table-wrap-flush {
  margin-top: 16px;
  border: none;
  box-shadow: none;
  background: transparent;
  overflow: visible;
}

.ib-table-overflow {
  overflow: visible;
}

.ib-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ib-prompt-actions .btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.ib-th-actions,
.ib-td-actions {
  text-align: right;
}

.ib-actions-cell {
  position: relative;
  display: inline-block;
  text-align: left;
}

.ib-kebab-menu-item-icon {
  width: 16px;
  margin-right: 8px;
  color: var(--text3);
}

.ib-kebab-menu-item-danger {
  color: var(--danger);
}

.ib-kebab-menu-item-danger .ib-kebab-menu-item-icon {
  color: var(--danger);
}

.ib-kebab-menu.is-positioned {
  left: var(--ib-kebab-left);
  top: var(--ib-kebab-top);
}

.ib-kebab-menu.is-measuring {
  visibility: hidden;
  pointer-events: none;
}

.ib-icon-rg {
  background: rgba(20, 184, 166, 0.08);
  color: var(--success);
  border-color: rgba(20, 184, 166, 0.15);
}

.ib-icon-queue {
  background: rgba(249, 115, 22, 0.08);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.15);
}

.ib-badge-rg {
  color: #0d9488;
  background: rgba(13, 148, 136, 0.05);
  border-color: rgba(13, 148, 136, 0.25);
}

.ib-badge-queue {
  color: #ea580c;
  background: rgba(234, 88, 12, 0.05);
  border-color: rgba(234, 88, 12, 0.25);
}

.ib-badge-fw {
  font-weight: 600;
}

.ib-btn-create {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--primary);
  border: none;
  color: #fff;
}

.ib-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.ib-empty-desc {
  font-size: 0.82rem;
  color: var(--text2);
  margin: 0 auto 20px;
  max-width: 440px;
  line-height: 1.5;
}

.ib-empty-cta {
  border-color: #4f46e5;
  color: #4f46e5;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 8px;
}

.ib-confirm-modal {
  max-width: 400px;
  text-align: center;
  border-radius: 12px;
  overflow: hidden;
}

.ib-confirm-body {
  padding: 28px 24px;
}

.ib-confirm-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 16px;
}

.ib-confirm-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text1);
}

.ib-confirm-msg {
  color: var(--text2);
  font-size: 0.82rem;
  margin: 0 0 24px;
  line-height: 1.5;
}

.ib-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.ib-confirm-btn {
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
}

.ib-confirm-btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}

.ib-review-modal {
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
}

.ib-review-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.ib-review-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ib-review-title-icon {
  color: var(--primary);
}

.ib-review-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg1);
}

.ib-review-hint {
  background: rgba(59, 130, 246, 0.08);
  color: #1e40af;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
  line-height: 1.5;
}

.ib-review-hint-icon {
  margin-right: 6px;
}

.ib-review-pre-title {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text1);
}

.ib-review-pre {
  background: var(--surface);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  overflow-x: auto;
  color: var(--text1);
  margin: 0;
  font-family: var(--mono);
  line-height: 1.4;
}

.ib-review-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.ib-review-btn {
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
}

.ib-review-btn-icon {
  margin-right: 6px;
}

/* DTMF options — 2 cards per row, each with Key | Action | Destination */
.iv-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.iv-opt-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--surface);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.iv-opt-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 10px;
  align-items: end;
}

.iv-opt-field {
  margin: 0;
  min-width: 0;
}

.ib-opt-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 4px;
}

.iv-opt-key {
  text-align: center;
  font-family: var(--mono);
  font-weight: 700;
  padding-left: 0;
  padding-right: 0;
}

.iv-opt-remove {
  flex-shrink: 0;
  color: var(--danger);
  align-self: center;
  margin-top: 18px;
}

.ib-editor-error {
  padding: 24px;
}

.ib-sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.ib-sidebar-footer-btn {
  width: 100%;
}

.ib-loading-msg {
  padding: 24px;
}

@media (max-width: 900px) {
  .iv-options-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== AGENT CALL MODAL (incoming / active voice) ===== */
.call-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.call-modal-overlay.hidden {
  display: none;
}

.call-modal-card {
  background: #f8fafc;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  width: 100%;
  max-width: 400px;
  max-height: min(92vh, 720px);
  overflow-y: auto;
  padding: 32px 28px 24px;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.call-modal-card.acm-crm-open {
  max-width: 420px;
}

[data-theme="dark"] .call-modal-card {
  background: var(--surface);
  border-color: var(--border);
}

.acm-view.hidden {
  display: none;
}

.acm-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.acm-badge-incoming {
  background: #dcfce7;
  color: #15803d;
}

.acm-badge-connecting {
  background: #e0f2fe;
  color: #0369a1;
}

.acm-badge-conference {
  background: #ede9fe;
  color: #6d28d9;
  margin-bottom: 12px;
}

.acm-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
}

.acm-avatar-stage-conference {
  width: auto;
  min-height: 96px;
  height: auto;
  margin-bottom: 20px;
}

.acm-participants {
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 220px;
  z-index: 2;
}

.acm-participants.hidden {
  display: none;
}

.acm-participant-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.acm-participant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #dbeafe, #bfdbfe);
  border: 2px solid #3b82f6;
  color: #1e40af;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.acm-participant-chip--self .acm-participant-avatar {
  border-color: #22c55e;
  background: linear-gradient(145deg, #dcfce7, #bbf7d0);
  color: #166534;
}

.acm-participant-chip--ringing .acm-participant-avatar {
  border-color: #f59e0b;
  background: linear-gradient(145deg, #fef3c7, #fde68a);
  color: #92400e;
  animation: acm-participant-pulse 1.2s ease-in-out infinite;
}

.acm-participant-label {
  font-size: 0.55rem;
  color: #64748b;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

@keyframes acm-participant-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.94); opacity: 0.75; }
}

.acm-participant-chip--host .acm-participant-avatar {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.acm-pill-btn.active {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}

.acm-avatar-channel-conference {
  background: #8b5cf6;
}

.acm-avatar {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
  border: 3px solid #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: #475569;
}

.acm-avatar-active .acm-avatar {
  border-radius: 50%;
}

.acm-avatar-channel {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border: 2px solid #f8fafc;
}

.acm-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  line-height: 1.25;
}

[data-theme="dark"] .acm-name {
  color: var(--text);
}

.acm-meta {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 8px;
}

.acm-duration {
  font-size: 1.1rem;
  font-weight: 600;
  color: #22c55e;
  margin: 0 0 24px;
  font-variant-numeric: tabular-nums;
}

.acm-incoming-actions {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 28px 0 24px;
}

.acm-action-decline,
.acm-action-answer {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.acm-round-btn {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.acm-round-btn:hover {
  transform: scale(1.04);
}

.acm-round-decline {
  background: #fee2e2;
  color: #dc2626;
}

.acm-round-answer {
  background: #22c55e;
  color: #fff;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
}

.acm-action-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

.acm-action-label-answer {
  color: #15803d;
}

.acm-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.78rem;
  color: #64748b;
}

.acm-queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: acm-pulse 1.5s ease infinite;
}

@keyframes acm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.acm-controls-primary {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
  margin-bottom: 20px;
}

.acm-ctrl {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  min-width: 72px;
}

.acm-ctrl-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: background 0.15s ease;
}

.acm-ctrl-active .acm-ctrl-icon {
  background: #fef3c7;
  color: #b45309;
}

.acm-ctrl-end .acm-ctrl-icon-end {
  width: 68px;
  height: 68px;
  background: #ef4444;
  color: #fff;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

.acm-ctrl-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.acm-ctrl-label-end {
  color: #ef4444;
}

.acm-controls-secondary {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

/* In-call DTMF keypad (icon toggle, collapsed by default) */
.acm-dialer-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

[data-theme="dark"] .acm-dialer-wrap {
  border-top-color: var(--border);
}

.acm-dialer-wrap.hidden {
  display: none;
}

.acm-dialer-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

[data-theme="dark"] .acm-dialer-icon-btn {
  background: var(--bg2);
  border-color: var(--border);
  color: var(--text);
}

.acm-dialer-icon-btn:hover,
.acm-dialer-icon-btn[aria-expanded="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.acm-dialer-panel {
  overflow: hidden;
  max-height: 200px;
  opacity: 1;
  transition: max-height 0.2s ease, opacity 0.15s ease, margin-top 0.15s ease;
  margin-top: 10px;
}

.acm-dialer-panel--collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

.acm-dialer-sent {
  min-height: 1rem;
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-align: center;
  color: #64748b;
  letter-spacing: 0.08em;
}

[data-theme="dark"] .acm-dialer-sent {
  color: var(--text-muted);
}

.acm-dialer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 220px;
  margin: 0 auto;
}

.acm-dialer-key {
  height: 36px;
  border: none;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: transform 0.1s ease, background 0.1s ease;
}

[data-theme="dark"] .acm-dialer-key {
  background: var(--bg2);
  color: var(--text);
}

.acm-dialer-key:hover {
  background: var(--primary);
  color: #fff;
}

.acm-dialer-key:active,
.acm-dialer-key--pressed {
  transform: scale(0.95);
  background: var(--primary-dark, #1d4ed8);
  color: #fff;
}

.acm-dialer-key sub {
  font-size: 0.38rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.7;
  line-height: 1;
}

.acm-pill-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: none;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.acm-pill-btn:hover {
  background: #cbd5e1;
}

.acm-crm-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.acm-crm-section.hidden {
  display: none;
}

[data-theme="dark"] .acm-crm-section {
  border-top-color: var(--border);
}

.acm-crm-toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 0;
}

.acm-pill-btn.acm-crm-btn.active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

[data-theme="dark"] .acm-pill-btn.acm-crm-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

.acm-crm-panel {
  text-align: left;
  margin-top: 12px;
  padding-top: 4px;
}

.acm-crm-panel.hidden {
  display: none;
}

.acm-form-group {
  margin-bottom: 10px;
}

.acm-form-row {
  gap: 8px;
  margin-bottom: 4px;
}

.acm-notes-history {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
}

[data-theme="dark"] .acm-notes-history {
  border-top-color: var(--border);
}

.acm-notes-history-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 8px;
}

.acm-call-notes-list {
  font-size: 0.75rem;
  color: var(--text2);
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.acm-notes-empty {
  color: var(--text3);
  font-size: 0.72rem;
}

.acm-transfer-panel {
  text-align: left;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.acm-transfer-panel.hidden {
  display: none;
}

.acm-transfer-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.acm-transfer-tab {
  flex: 1;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.acm-transfer-tab.active {
  background: var(--primary, #0f2b4a);
  color: #fff;
  border-color: var(--primary, #0f2b4a);
}

.acm-transfer-attended {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.acm-transfer-attended.hidden {
  display: none;
}

.acm-transfer-picker {
  position: relative;
  margin-bottom: 10px;
}

.acm-transfer-search-wrap {
  position: relative;
}

.acm-transfer-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.75rem;
  pointer-events: none;
}

.acm-transfer-search {
  padding-left: 30px;
}

.acm-transfer-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 43, 74, 0.12);
  z-index: 20;
}

.acm-transfer-dropdown.hidden {
  display: none;
}

.acm-transfer-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.82rem;
  color: #0f172a;
}

.acm-transfer-option:hover,
.acm-transfer-option.active {
  background: #f1f5f9;
}

.acm-transfer-option-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.acm-transfer-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.acm-transfer-status-dot--available {
  background: #16a34a;
}

.acm-transfer-status-dot--busy {
  background: #dc2626;
}

.acm-transfer-status-dot--away {
  background: #d97706;
}

.acm-transfer-status-dot--offline {
  background: #94a3b8;
}

.acm-transfer-option-main {
  min-width: 0;
}

.acm-transfer-option-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acm-transfer-option-name--available {
  color: #166534;
}

.acm-transfer-option-name--busy {
  color: #b91c1c;
}

.acm-transfer-option-name--away {
  color: #b45309;
}

.acm-transfer-option-name--offline {
  color: #64748b;
}

.acm-transfer-option-meta {
  font-size: 0.72rem;
  color: #64748b;
}

.acm-transfer-option-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}

.acm-transfer-option-badge--available {
  background: #dcfce7;
  color: #166534;
}

.acm-transfer-option-badge--busy {
  background: #fee2e2;
  color: #b91c1c;
}

.acm-transfer-option-badge--away {
  background: #fef3c7;
  color: #b45309;
}

.acm-transfer-option-badge--offline {
  background: #f1f5f9;
  color: #64748b;
}

.acm-transfer-empty {
  padding: 12px;
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
}

.acm-status-line {
  font-style: italic;
}

.acm-conf-hint {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0 0 10px;
  text-align: left;
}