/* ==========================================================================
   CONTROL GESTIÓN SOPORTE - COMPLETE RESPONSIVE DESIGN SYSTEM
   Optimizado para Smartphones (iOS / Android), Tablets y Pantallas de Escritorio
   ========================================================================== */

:root {
  /* Primary Palettes */
  --navy-dark: #0b2253;
  --navy-primary: #0f3d99;
  --blue-primary: #1976d2;
  --blue-accent: #2563eb;
  --blue-light: #eff6ff;

  /* Semantic Colors */
  --orange-primary: #f97316;
  --orange-dark: #ea580c;
  --orange-light: #fff7ed;
  --orange-border: #fdba74;

  --green-primary: #10b981;
  --green-dark: #059669;
  --green-light: #ecfdf5;
  --green-border: #6ee7b7;

  --red-primary: #ef4444;
  --red-dark: #dc2626;
  --red-light: #fef2f2;
  --red-border: #fca5a5;

  --yellow-primary: #f59e0b;
  --yellow-light: #fefce8;
  --yellow-border: #fde047;

  /* Neutral Surface & Typography */
  --bg-app: #f4f6fb;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.1);
  --shadow-hover: 0 12px 28px -4px rgba(15, 23, 42, 0.12);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   TOP GLOBAL HEADER
   ========================================================================== */

.top-nav-header {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-primary) 100%);
  color: #ffffff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(11, 34, 83, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #60a5fa;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.brand-pre {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #93c5fd;
  font-weight: 600;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
}

.nav-center {
  display: flex;
  align-items: center;
}

.live-indicator-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  white-space: nowrap;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  min-width: 9px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.live-text {
  font-weight: 500;
  color: #e2e8f0;
}

.live-time {
  color: #93c5fd;
  font-family: monospace;
  font-weight: 600;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 8px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-mode-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--navy-dark);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.action-btn {
  background: #2563eb;
  border: 1px solid #3b82f6;
  color: #ffffff;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  transition: var(--transition);
  white-space: nowrap;
}

.action-btn:hover {
  background: #1d4ed8;
}

.spin-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.avatar-circle {
  width: 30px;
  height: 30px;
  min-width: 30px;
  background: #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}

.user-role {
  font-size: 9.5px;
  color: #93c5fd;
}

/* ==========================================================================
   SUB-HEADER FILTERS BAR
   ========================================================================== */

.sub-header-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.filter-group select {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  max-width: 100%;
}

.filter-group select:focus {
  border-color: var(--blue-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.refresh-countdown {
  margin-left: auto;
  font-size: 12px;
  background: var(--blue-light);
  color: var(--blue-primary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid #bfdbfe;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.cd-val {
  font-weight: 700;
  font-family: monospace;
}

/* ==========================================================================
   MAIN CONTAINER
   ========================================================================== */

.main-dashboard-container {
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1700px;
  margin: 0 auto;
  width: 100%;
}

/* ==========================================================================
   KPI CARDS GRID
   ========================================================================== */

.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.card-blue { background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%); }
.card-orange { background: linear-gradient(135deg, #ea580c 0%, #f97316 100%); }
.card-green { background: linear-gradient(135deg, #047857 0%, #10b981 100%); }
.card-red { background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%); }

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

.card-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.92;
}

.card-icon {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.kpi-value-wrapper {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-number {
  font-family: 'Outfit', sans-serif;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
}

.kpi-subtext {
  font-size: 12.5px;
  opacity: 0.85;
  font-weight: 500;
}

.kpi-percent {
  background: rgba(255, 255, 255, 0.25);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
}

.card-footer-info {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  flex-wrap: wrap;
}

.chip-metric {
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.chip-val {
  font-weight: 700;
  margin-left: 3px;
}

.card-footer-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.state-badge {
  background: rgba(0, 0, 0, 0.18);
  padding: 5px 3px;
  border-radius: var(--radius-sm);
  text-align: center;
  display: flex;
  flex-direction: column;
}

.st-num {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}

.st-lbl {
  font-size: 9px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   SECTIONS & HEADERS
   ========================================================================== */

.dashboard-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: var(--transition);
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 12px;
}

.header-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.orange-green-icon {
  background: #fff7ed;
  color: var(--orange-dark);
  border: 1px solid var(--orange-border);
}

.green-icon {
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid var(--green-border);
}

.red-icon {
  background: var(--red-light);
  color: var(--red-dark);
  border: 1px solid var(--red-border);
}

.red-amber-icon {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.section-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.text-green { color: var(--green-dark) !important; }
.text-red { color: var(--red-dark) !important; }

.badge-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 11px;
}

.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-green { background: #d1fae5; color: #047857; }

.header-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.dot-orange { background-color: var(--orange-primary); }
.dot-green { background-color: var(--green-primary); }

.badge-pill {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pill-green {
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid var(--green-border);
}

.pill-red {
  background: var(--red-light);
  color: var(--red-dark);
  border: 1px solid var(--red-border);
}

/* ==========================================================================
   CHARTS
   ========================================================================== */

.chart-container-wrapper {
  position: relative;
  width: 100%;
}

.main-chart-wrapper {
  height: 360px;
}

.specialists-grid-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 20px;
}

.specialist-chart-wrapper {
  height: 260px;
  margin-bottom: 14px;
}

.specialist-list-table {
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  font-size: 12.5px;
}

.sp-rank {
  font-weight: 700;
  width: 22px;
  color: var(--text-muted);
}

.sp-name {
  font-weight: 600;
  flex: 1;
  margin-left: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-count-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 11.5px;
}

.count-green { background: #d1fae5; color: #047857; }
.count-red { background: #fee2e2; color: #b91c1c; }

/* ==========================================================================
   REALTIME ANS SECTION
   ========================================================================== */

.realtime-header {
  border-bottom: none;
  margin-bottom: 14px;
  padding-bottom: 0;
}

.table-controls-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 240px;
}

.table-search-box i {
  position: absolute;
  left: 12px;
  color: var(--text-light);
  font-size: 13px;
}

.table-search-box input {
  padding: 8px 12px 8px 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: var(--transition);
}

.table-search-box input:focus {
  border-color: var(--blue-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.table-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 11px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill.active {
  background: var(--navy-primary);
  color: #ffffff;
  border-color: var(--navy-primary);
}

.pill-red-filter.active {
  background: var(--red-primary);
  border-color: var(--red-primary);
  color: #ffffff;
}

.pill-yellow-filter.active {
  background: var(--yellow-primary);
  border-color: var(--yellow-primary);
  color: #ffffff;
}

/* Desktop / Tablet Table */
.table-responsive-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  display: block;
}

.realtime-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}

.realtime-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.realtime-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.realtime-table tr:hover {
  background-color: #f8fafc;
}

.case-id-tag {
  font-weight: 700;
  font-family: monospace;
  color: var(--blue-primary);
  background: var(--blue-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
}

.badge-state {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.state-en-proceso { background: #ffedd5; color: #c2410c; }
.state-registrado { background: #e0f2fe; color: #0369a1; }
.state-suspendido { background: #f1f5f9; color: #475569; }

.sla-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.sla-fuera {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.sla-proximo {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.sla-dentro {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.progress-track {
  width: 80px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
}

.fill-red { background: #ef4444; }
.fill-amber { background: #f59e0b; }
.fill-green { background: #10b981; }

.btn-view-case {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--blue-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-view-case:hover {
  background: var(--blue-primary);
  color: #ffffff;
}

/* ==========================================================================
   MOBILE TICKETS STREAM (< 768px)
   ========================================================================== */

.mobile-tickets-stream {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.mobile-ticket-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mt-id-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mt-proj-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.mt-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mt-category {
  font-size: 13.5px;
  color: var(--text-main);
}

.mt-specialist {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mt-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

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

.mt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.mt-progress-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mt-time-info {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.mt-action-btn {
  padding: 6px 12px;
}

.empty-state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  color: var(--text-muted);
  gap: 8px;
}

/* ==========================================================================
   POWER BI EMBED TAB
   ========================================================================== */

.powerbi-tab-container {
  padding: 16px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1700px;
  margin: 0 auto;
  width: 100%;
}

.pbi-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 10px;
}

.pbi-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}

.pbi-refresh-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pbi-embed-box {
  width: 100%;
  height: 800px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ==========================================================================
   MODAL
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-badge {
  background: var(--blue-light);
  color: var(--blue-primary);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: monospace;
  font-size: 12px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-secondary {
  background: #e2e8f0;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================================================================
   SMARTPHONE & TABLET RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablets and small laptops */
@media (max-width: 1024px) {
  .specialists-grid-section {
    grid-template-columns: 1fr;
  }
}

/* Smartphones (< 768px) */
@media (max-width: 768px) {
  .top-nav-header {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

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

  .brand-title {
    font-size: 17px;
  }

  .nav-center {
    justify-content: flex-start;
  }

  .live-indicator-pill {
    width: 100%;
    justify-content: space-between;
    font-size: 11.5px;
    padding: 4px 10px;
  }

  .nav-right {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    width: 100%;
  }

  .view-mode-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tab-btn {
    justify-content: center;
    padding: 6px 4px;
    font-size: 11.5px;
  }

  .action-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .user-profile-badge {
    padding: 3px 6px;
  }

  .user-info {
    display: none; /* Hide user name on small phones, show avatar */
  }

  /* Sub-header filters */
  .sub-header-bar {
    padding: 10px 14px;
    gap: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .filter-group label {
    font-size: 11.5px;
  }

  .filter-group select {
    width: 100%;
    font-size: 12px;
    padding: 6px 8px;
  }

  .refresh-countdown {
    grid-column: span 2;
    margin-left: 0;
    justify-content: center;
    padding: 3px 8px;
    font-size: 11.5px;
  }

  /* Main Container */
  .main-dashboard-container {
    padding: 14px;
    gap: 16px;
  }

  /* KPI Cards */
  .kpi-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kpi-card {
    padding: 16px;
  }

  .kpi-number {
    font-size: 32px;
  }

  /* Charts */
  .main-chart-wrapper {
    height: 280px;
  }

  .specialist-chart-wrapper {
    height: 230px;
  }

  .specialists-grid-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Realtime ANS Section */
  .table-responsive-container {
    display: none; /* Switch to touch-friendly cards on mobile */
  }

  .mobile-tickets-stream {
    display: flex;
  }

  .table-controls-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .table-filter-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .table-filter-pills .filter-pill:first-child {
    grid-column: span 2;
  }

  /* PowerBI container */
  .pbi-embed-box {
    height: 520px;
  }
}

/* Extra small smartphones (< 400px) */
@media (max-width: 400px) {
  .sub-header-bar {
    grid-template-columns: 1fr;
  }
  
  .refresh-countdown {
    grid-column: span 1;
  }
}
