/* Fonts moved to index.html for parallel preloading */

:root {
  color-scheme: light dark;
  --bg-gradient: radial-gradient(at 0% 0%, hsla(242,100%,90%,1) 0px, transparent 50%),
                 radial-gradient(at 100% 0%, hsla(168,100%,88%,1) 0px, transparent 50%),
                 radial-gradient(at 100% 100%, hsla(285,100%,91%,1) 0px, transparent 50%),
                 radial-gradient(at 0% 100%, hsla(202,100%,88%,1) 0px, transparent 50%);
  --bg-color: #f0f4fd;
  --text-main: #0f172a; /* Slate 900 for high contrast */
  --text-muted: #475569; /* Slate 600 for better readability */
  --text-subtle: #475569; /* Slate 600 instead of 500 for WCAG AA compliance */
  
  --card-bg: rgba(255, 255, 255, 0.65); /* More opaque for readability */
  --card-border: rgba(255, 255, 255, 0.7);
  --card-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.06);
  
  --sidebar-bg: rgba(255, 255, 255, 0.45);
  --sidebar-border: rgba(255, 255, 255, 0.6);
  
  --input-bg: rgba(255, 255, 255, 0.55);
  --input-border: rgba(255, 255, 255, 0.8);
  
  --primary: #4f46e5; /* Indigo 600 for WCAG AA compliance */
  --primary-hover: #3730a3; /* Indigo 800 */
  --primary-rgb: 79, 70, 229;
  --accent: #7c3aed; /* Purple 600 */
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-text: #047857; /* High contrast success text */
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-text: #b45309; /* High contrast warning text */
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-text: #b91c1c; /* High contrast danger text */
  
  --sidebar-width: 260px;
  --header-height: 70px;
  --radius: 16px;
  --radius-sm: 10px;
}

.dark {
  --bg-gradient: radial-gradient(at 0% 0%, hsla(242,50%,12%,1) 0px, transparent 50%),
                 radial-gradient(at 100% 0%, hsla(168,50%,10%,1) 0px, transparent 50%),
                 radial-gradient(at 100% 100%, hsla(285,40%,12%,1) 0px, transparent 50%),
                 radial-gradient(at 0% 100%, hsla(202,60%,11%,1) 0px, transparent 50%);
  --bg-color: #0b1329;
  --text-main: #f8fafc; /* Slate 50 */
  --text-muted: #cbd5e1; /* Slate 300 for better readability */
  --text-subtle: #94a3b8; /* Slate 400 */
  
  --card-bg: rgba(15, 23, 42, 0.65); /* More opaque */
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.4);
  
  --sidebar-bg: rgba(15, 23, 42, 0.45);
  --sidebar-border: rgba(255, 255, 255, 0.05);
  
  --input-bg: rgba(15, 23, 42, 0.5);
  --input-border: rgba(255, 255, 255, 0.08);
  
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-rgb: 129, 140, 248;
  --accent: #a78bfa;
  
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.15);
  --success-text: #34d399; /* Green 400 for dark mode */
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.15);
  --warning-text: #fbbf24; /* Amber 400 for dark mode */
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.15);
  --danger-text: #f87171; /* Red 400 for dark mode */
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: Inter, system-ui, sans-serif; }
body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 13.5px;
  transition: background-color 0.3s ease, color 0.3s ease;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { flex-shrink: 0; }

/* Login Box Redesign */
.login {
  width: min(450px, calc(100% - 32px));
  margin: clamp(24px, 8vh, 72px) auto;
  padding: 32px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.login .brand { padding: 0; margin-bottom: 24px; justify-content: center; }
.login h1 { font-size: 26px; line-height: 1.1; letter-spacing: -0.5px; margin-bottom: 10px; font-weight: 800; }
.login p { color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }
.login label { display: block; color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.login input {
  width: 100%;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: all 0.2s;
}
.login input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15); }
.login-error { color: var(--danger-text); min-height: 20px; margin-top: 12px; font-size: 12px; font-weight: 600; }

/* Shell Layout */
.shell { min-height: 100vh; display: none; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 50;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.brand { padding: 24px 20px; display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}
.brand-text { font-size: 16px; font-weight: 800; color: var(--text-main); letter-spacing: -0.4px; }
.brand-text span { color: var(--primary); }

.nav-menu { padding: 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.nav-group-label {
  margin: 12px 14px 4px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  opacity: 0.78;
}
.nav-group-label:first-child { margin-top: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 13.5px;
  text-align: left;
  transition: all 0.2s;
  cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; stroke-width: 2.2; opacity: 0.8; }
.nav-item:hover { background: rgba(var(--primary-rgb), 0.08); color: var(--text-main); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(139, 92, 246, 1));
  color: white;
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}
.dark .nav-item.active {
  background: linear-gradient(135deg, rgba(129, 140, 248, 1), rgba(167, 139, 250, 1));
  color: #0b1329;
}
.nav-item.active svg { opacity: 1; color: inherit; }
.nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
.nav-item.active .nav-count { background: #fff; color: #dc2626; }

.client-directory-table { min-width: 980px !important; }
.client-store-cell { min-width: 190px; }
.client-plan-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 175px; font-size: 11px; font-weight: 700; }
.plan-chip { padding: 3px 8px; border-radius: 999px; background: rgba(var(--primary-rgb), 0.1); color: var(--primary); text-transform: capitalize; font-size: 10px; }
.client-usage-track { width: 100%; height: 5px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: rgba(var(--primary-rgb), 0.1); }
.client-usage-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--success), var(--primary)); }
.integration-pills { display: flex; gap: 6px; min-width: 112px; }
.integration-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid var(--card-border); border-radius: 8px; font-size: 10px; font-weight: 800; color: var(--text-muted); }
.integration-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.integration-pill.is-ready { color: var(--text-main); background: rgba(16, 185, 129, 0.07); }
.integration-pill.is-ready i { background: var(--success); }
.integration-pill.is-attention i { background: var(--warning); }
.client-directory-actions { display: flex; gap: 8px; white-space: nowrap; }

.payment-metrics-grid { margin-bottom: 18px; }
.payment-history-table { min-width: 980px !important; }
.payment-history-heading { align-items: flex-start; }
.payment-trx { font-family: "JetBrains Mono", monospace; }
.payment-result-note { max-width: 260px; margin-top: 6px; white-space: normal; line-height: 1.4; }

.support-ticket-target {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  animation: support-ticket-focus 1.4s ease-out 2;
}

.support-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 120px;
}

.support-attachment-preview {
  display: inline-flex;
  width: 92px;
  flex-direction: column;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 10px;
  text-decoration: none;
}

.support-attachment-preview img {
  width: 92px;
  height: 62px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  object-fit: cover;
}

.support-attachment-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-attachment-file {
  display: inline-flex;
}

@keyframes support-ticket-focus {
  50% { background: color-mix(in srgb, var(--primary) 14%, transparent); }
}

.platform-usage-box {
  margin: 16px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}
.dark .platform-usage-box {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.05);
}
.platform-usage-title { color: var(--primary); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.progress-bar-bg { width: 100%; height: 6px; background: rgba(0,0,0,0.1); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.dark .progress-bar-bg { background: rgba(255,255,255,0.1); }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
.pro-plan-stats { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: 4px; }

.main-wrapper { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }

/* Topbar styling */
.topbar {
  height: var(--header-height);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  width: 320px;
  backdrop-filter: blur(12px);
}
.search-box svg { width: 16px; height: 16px; color: var(--text-muted); }
.search-box input { background: none; border: none; outline: none; color: var(--text-main); width: 100%; font-size: 13px; }
.search-box .kbd { background: rgba(var(--primary-rgb), 0.1); border: 1px solid rgba(var(--primary-rgb), 0.2); padding: 2px 6px; border-radius: 4px; font-size: 9px; color: var(--primary); font-family: monospace; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 20px; }

/* Environment Badge */
.env-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--success-bg);
  border-radius: 99px;
  border: 1px solid rgba(16,185,129,0.2);
  font-size: 10px;
  font-weight: 800;
  color: var(--success);
  letter-spacing: 0.5px;
}
.env-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--success); }

/* Theme switcher styling */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  min-height: 44px; /* WCAG 44x44px Touch Target */
  min-width: 44px;
  justify-content: center;
}
.theme-toggle-btn:hover {
  border-color: var(--primary);
}
.theme-icon-light { display: inline; }
.theme-icon-dark { display: none; }
.dark .theme-icon-light { display: none; }
.dark .theme-icon-dark { display: inline; }

.icon-btn { position: relative; background: none; border: none; color: var(--text-muted); display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; transition: all 0.2s; }
.icon-btn svg { width: 20px; height: 20px; stroke-width: 2; }
.icon-btn:hover { color: var(--text-main); background: rgba(var(--primary-rgb), 0.08); }
.badge-dot { position: absolute; top: 2px; right: 2px; min-width: 14px; height: 14px; background: var(--danger); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; color: white; font-weight: bold; }

.user-profile { display: flex; align-items: center; gap: 10px; border-left: 1px solid var(--sidebar-border); padding-left: 20px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: white; box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2); }
.user-info { display: flex; flex-direction: column; }
.user-info .name { font-size: 13px; font-weight: 700; color: var(--text-main); }
.user-info .email { font-size: 11px; color: var(--text-muted); }
.content { padding: 32px; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 20px; }
.page-title { font-size: 24px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; letter-spacing: -0.5px; }
.page-sub { color: var(--text-muted); font-size: 13px; }
.header-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.dashboard-window-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-muted);
}
.dashboard-window-control select {
  border: 0;
  padding: 0;
  min-height: auto;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.dashboard-window-control select:focus { outline: none; }
.dashboard-freshness {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.dashboard-freshness.is-live { color: var(--success); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 9999px; /* pill buttons */
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
  text-decoration: none;
  transition: box-shadow 0.3s ease, transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn-outline {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: rgba(var(--primary-rgb), 0.08);
  border-color: rgba(var(--primary-rgb), 0.3);
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.1);
}
.btn-primary {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(139, 92, 246, 0.9));
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.dark .btn-primary {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.85), rgba(167, 139, 250, 0.95));
  color: #0b1329;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-primary:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 1.0));
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.3);
}
.btn-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.8), rgba(225, 29, 72, 0.9));
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.section { display: none; }
.section.active { display: block; }

/* Metrics Grid Redesign */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.metric-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
}
.metric-card:hover { transform: translateY(-2px); border-color: rgba(var(--primary-rgb), 0.3); }
.metric-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.m-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.m-icon svg { width: 16px; height: 16px; stroke-width: 2.2; }
.m-title { font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 30px; font-weight: 800; color: var(--text-main); letter-spacing: -1px; margin-bottom: 8px; line-height: 1; overflow-wrap: anywhere; }
.trend { font-size: 12px; display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.trend span { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.trend-up span { color: var(--success); }
.trend-down span { color: var(--danger); }

/* Neon glows for SVG sparklines */
polyline[stroke="#3B82F6"] { filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.4)); }
polyline[stroke="#A78BFA"] { filter: drop-shadow(0 2px 4px rgba(167, 139, 250, 0.4)); }
polyline[stroke="#F87171"] { filter: drop-shadow(0 2px 4px rgba(248, 113, 113, 0.4)); }
polyline[stroke="#818CF8"] { filter: drop-shadow(0 2px 4px rgba(129, 140, 248, 0.4)); }

/* Card & Tables styling */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  overflow: hidden;
  margin-bottom: 24px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--card-shadow);
  transition: border-color 0.3s ease;
}
.card-header { padding: 18px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--card-border); gap: 16px; }
.card-title { font-size: 14px; font-weight: 800; color: var(--text-main); text-transform: uppercase; letter-spacing: 0.05em; }
.card-subtitle { margin-top: 4px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.card-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.card-tools select {
  min-width: 150px;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  font-size: 12px;
  font-weight: 700;
}

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 14px 20px; font-size: 11px; font-weight: 750; color: var(--text-muted); border-bottom: 1px solid var(--card-border); text-transform: uppercase; letter-spacing: 0.05em; }
td { padding: 16px 20px; font-size: 13px; border-bottom: 1px solid var(--card-border); color: var(--text-main); vertical-align: middle; }
tr:hover td { background: rgba(var(--primary-rgb), 0.04); }
tr:last-child td { border-bottom: none; }
.table-wrap { 
  overflow-x: auto; 
  position: relative;
  -webkit-overflow-scrolling: touch;
}
/* Setup responsive data table scrolling with visual fade hint */
.table-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(to right, transparent, rgba(var(--primary-rgb), 0.06));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
@media (max-width: 820px) {
  .table-wrap::after {
    opacity: 1; /* Shows scroll indicators on mobile/tablet viewports */
  }
}
/* Default min-width for columns-heavy tables to guarantee readability */
.table-wrap table {
  min-width: 850px;
}
/* Simple 5-column matrices easily fit on tablets and desktops natively */
#integrations table {
  min-width: 100% !important;
}
#health table { min-width: 980px !important; }
@media (max-width: 768px) {
  #integrations table {
    min-width: 520px !important;
  }
  #health table { min-width: 820px !important; }
}

.client-name { font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.client-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-family: monospace; }
.domain-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-main); text-decoration: none; font-weight: 600; }
.domain-link:hover { text-decoration: underline; color: var(--primary); }

/* Status Badges */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 9999px; font-size: 11px; font-weight: 700; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-healthy { background: var(--success-bg); color: var(--success-text); border: 1px solid rgba(16,185,129,0.15); }
.status-healthy::before { background: var(--success); }
.status-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid rgba(245,158,11,0.15); }
.status-warning::before { background: var(--warning); }
.status-degraded, .status-critical, .status-inactive { background: var(--danger-bg); color: var(--danger-text); border: 1px solid rgba(239,68,68,0.15); }
.status-degraded::before, .status-critical::before, .status-inactive::before { background: var(--danger); }

/* Integration Badges */
.integration-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.integration-status svg { width: 16px; height: 16px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-active { background: var(--success); box-shadow: 0 0 6px var(--success); }
.dot-warning { background: var(--warning); box-shadow: 0 0 6px rgba(245, 158, 11, 0.45); }
.dot-inactive { background: var(--danger); }

/* Action Buttons */
.action-btn { background: var(--input-bg); border: 1px solid var(--input-border); color: var(--text-main); width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; }
.action-btn:hover { background: rgba(var(--primary-rgb), 0.08); border-color: rgba(var(--primary-rgb), 0.3); }

.grid-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.team-layout { align-items: start; }
.team-layout .form-card { display: grid; gap: 14px; }
.team-role { display: inline-flex; border-radius: 999px; padding: 4px 9px; background: rgba(var(--primary-rgb), .1); color: var(--primary); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.team-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ops-monitor-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.worker-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--card-border);
}
.worker-summary-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(var(--primary-rgb), .045);
}
.worker-summary-item span { display: block; color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.worker-summary-item strong { display: block; margin-top: 8px; color: var(--text-main); font-size: 24px; line-height: 1; }
.worker-summary-item small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 10px; }
.worker-monitor-table table { min-width: 760px; }
.worker-system-label { color: var(--primary); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.worker-value { color: var(--text-main); font-size: 14px; }
.client-intelligence-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.client-intel-card { min-width: 0; }
.client-intel-card .table-wrap table { min-width: 760px; }
.client-intel-card-wide .table-wrap table { min-width: 920px; }
.health-reason { max-width: 250px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.view-all { font-size: 11px; color: var(--primary); text-decoration: none; font-weight: 700; background: none; border: 0; cursor: pointer; text-transform: uppercase; letter-spacing: 0.05em; }
.view-all:hover { color: var(--primary-hover); }

@keyframes slideInFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.stream-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--card-border); animation: slideInFade 0.35s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stream-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.stream-dot.info { background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.stream-dot.success { background: var(--success); box-shadow: 0 0 8px var(--success); }
.stream-dot.warning { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.stream-content { flex: 1; min-width: 0; }
.stream-title { font-size: 13px; font-weight: 700; color: var(--text-main); margin-bottom: 2px; }
.stream-desc { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.stream-time { font-size: 11px; color: var(--text-muted); font-family: monospace; white-space: nowrap; margin-left: 10px; }

.alert-rank { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 99px; margin-right: 10px; }
.alert-high { color: var(--danger); border: 1px solid rgba(239,68,68,0.3); background: var(--danger-bg); }
.alert-medium { color: var(--warning); border: 1px solid rgba(245,158,11,0.3); background: var(--warning-bg); }
.alert-low { color: var(--primary); border: 1px solid rgba(99,102,241,0.3); background: rgba(99,102,241,0.1); }
.signal-alert-row { gap: 10px; }
.signal-alert-row .stream-content { min-width: 180px; }
.alert-action { flex: 0 0 auto; white-space: nowrap; }

.queue-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px;
}
.queue-summary > div {
  background: rgba(var(--primary-rgb), 0.05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-width: 0;
}
.queue-summary strong {
  display: block;
  margin-top: 8px;
  color: var(--text-main);
  font-size: 20px;
  line-height: 1;
  overflow-wrap: anywhere;
}
.queue-summary-stack {
  grid-template-columns: 1fr;
}
.queue-alerts {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
}
.queue-alert {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-main);
}
.queue-alert strong {
  text-transform: capitalize;
  font-size: 12px;
}
.queue-alert span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.queue-alert-critical {
  background: var(--danger-bg);
  border-color: rgba(239,68,68,0.24);
}
.queue-alert-warning {
  background: var(--warning-bg);
  border-color: rgba(245,158,11,0.24);
}
.queue-alert-healthy {
  background: var(--success-bg);
  border-color: rgba(16,185,129,0.24);
}
.queue-health-banner {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text-main);
}
.queue-health-banner strong {
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
}
.queue-health-banner span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
}
.queue-health-critical {
  background: var(--danger-bg);
  border-color: rgba(239,68,68,0.28);
}
.queue-health-warning {
  background: var(--warning-bg);
  border-color: rgba(245,158,11,0.28);
}
.queue-health-healthy {
  background: var(--success-bg);
  border-color: rgba(16,185,129,0.24);
}
.refresh-status {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.site-binding-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.table-footer-meta {
  padding: 14px 20px;
  border-top: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.site-binding-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}
.site-binding-panel textarea {
  resize: vertical;
  min-height: 96px;
}
.form-msg {
  min-height: 18px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.site-binding-policy {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
}
.site-binding-policy > div {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 13px;
  background: rgba(var(--primary-rgb), 0.05);
}
.site-binding-policy strong {
  display: block;
  color: var(--text-main);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.site-binding-policy span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.queue-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  justify-content: flex-end;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}
.queue-drawer {
  width: min(520px, 100%);
  height: 100vh;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  box-shadow: -24px 0 60px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--card-border);
}
.drawer-kicker {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 850;
  margin-bottom: 6px;
}
.drawer-header h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 20px;
}
.drawer-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}
.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--card-border);
}
.drawer-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.drawer-status-row span {
  color: var(--text-muted);
  font-weight: 750;
}
.drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.drawer-grid > div,
.drawer-block {
  background: rgba(var(--primary-rgb), 0.05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 13px;
  min-width: 0;
}
.drawer-grid span,
.drawer-block span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.drawer-grid strong {
  display: block;
  color: var(--text-main);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.drawer-block {
  margin-top: 12px;
}
.drawer-block pre {
  margin: 0;
  color: var(--text-main);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: JetBrains Mono, monospace;
  font-size: 12px;
}
.setup-snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.setup-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.035);
  padding: 12px;
  min-width: 0;
}
.setup-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.setup-card-head strong {
  color: var(--text-main);
  font-size: 12px;
}
.setup-card p {
  margin: 0;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.setup-card > span {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
}
.setup-card > em {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.45;
}
.funnel-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.funnel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 750;
}
.funnel-item span {
  min-width: 46px;
  color: var(--warning);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.funnel-item.done {
  background: var(--success-bg);
  border-color: rgba(16,185,129,0.2);
}
.funnel-item.done span {
  color: var(--success);
}
.support-notes-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.support-note {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: rgba(var(--primary-rgb), 0.05);
  color: var(--text-main);
}
.support-note div {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  margin-bottom: 8px;
}
.support-note span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.connection-footer { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px 24px; display: flex; gap: 24px; flex-wrap: wrap; justify-content: space-between; }
.conn-item { display: flex; align-items: center; gap: 12px; }
.conn-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-family: Space Grotesk, sans-serif; font-size: 15px; }
.conn-title { font-size: 12.5px; font-weight: 800; color: var(--text-main); }
.conn-status { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.conn-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--success); }

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

.bg-blue { background: rgba(59,130,246,0.12); color: #3b82f6; border: 1px solid rgba(59,130,246,0.2); }
.bg-purple { background: rgba(139,92,246,0.12); color: #8b5cf6; border: 1px solid rgba(139,92,246,0.2); }
.bg-red { background: rgba(239,68,68,0.12); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
.bg-indigo { background: rgba(99,102,241,0.12); color: #818cf8; border: 1px solid rgba(99,102,241,0.2); }

.form-card { padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field label { display: block; margin-bottom: 7px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }

/* Inputs */
.field input, select, textarea {
  width: 100%;
  background-color: var(--input-bg) !important;
  backdrop-filter: blur(12px);
  border: 1px solid var(--input-border) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02), 0 2px 8px rgba(0, 0, 0, 0.02) !important;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  outline: none;
  color: var(--text-main);
  transition: all 0.2s;
}
.field input:focus, select:focus, textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15) !important;
}
.notice { margin-top: 12px; color: var(--success); min-height: 18px; font-weight: 600; }
.empty { padding: 36px 20px; text-align: center; color: var(--text-muted); font-weight: 600; }

.hamburger { 
  display: none; 
  flex-direction: column; 
  justify-content: center; 
  align-items: center;
  gap: 5px; 
  background: var(--input-bg); 
  border: 1px solid var(--input-border); 
  border-radius: 9px; 
  cursor: pointer; 
  padding: 0; 
  position: fixed; 
  top: 14px; 
  left: 14px; 
  z-index: 200; 
  backdrop-filter: blur(12px); 
  width: 44px; /* Increased to meet WCAG 44x44px minimum touch target size */
  height: 44px; /* Increased to meet WCAG 44x44px minimum touch target size */
  transition: background-color 0.2s, border-color 0.2s;
}
.hamburger span { 
  display: block; 
  width: 20px; 
  height: 2px; 
  background: var(--text-muted); 
  border-radius: 2px; 
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
/* Smooth transition of hamburger lines into 'X' close icon when sidebar is open */
.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}
.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.sidebar-overlay { 
  display: block; /* Kept display block and transition opacity for hardware acceleration */
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.5); 
  z-index: -1; 
  backdrop-filter: blur(4px); 
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0.28s;
}
.sidebar-overlay.open { 
  z-index: 99; 
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), z-index 0s 0s;
}

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-layout { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .hamburger { display: flex; }
  .sidebar { position: fixed; left: -272px; top: 0; height: 100vh; width: 260px; z-index: 100; transition: left 0.28s cubic-bezier(0.4,0,0.2,1); }
  .sidebar.open { left: 0; box-shadow: 8px 0 40px rgba(0,0,0,0.4); }
  .sidebar-overlay.open { display: block; }
  .shell { display: none; }
  .shell.ready { display: block; }
  .main-wrapper { margin-left: 0; }
  .topbar { height: auto; padding: 12px 16px 12px 60px; display: grid; gap: 12px; }
  .search-box { width: 100%; }
  .topbar-right { flex-wrap: wrap; gap: 10px; }
  .content { padding: 18px; }
  .setup-snapshot { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .header-actions { flex-wrap: wrap; }
  .queue-health-banner { align-items: flex-start; flex-direction: column; }
  
  /* Keep high-efficiency 2-column layout on tablets (iPad size) */
  .metrics-grid, .form-grid { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 12px; }
  
  /* Hide keyboard shortcut on touch screens */
  .search-box .kbd { display: none !important; }
  
  /* Hide user profile details (text) on tablet/mobile to prevent topbar wrapping */
  .user-profile .user-info { display: none !important; }
  .user-profile { border-left: none; padding-left: 0; }
  
  /* Global Touch Target optimizations for standard mobile/tablet viewports (min 44x44px) */
  .nav-item {
    padding: 12px 18px !important;
    min-height: 44px;
  }
  .nav-group-label { margin-top: 16px; }
  .icon-btn {
    width: 44px !important;
    height: 44px !important;
  }
  .icon-btn .badge-dot {
    top: 6px;
    right: 6px;
  }
  .action-btn {
    width: 44px !important;
    height: 44px !important;
  }
  
  /* Responsive Typography Scale */
  .page-title { font-size: 20px; }
  .metric-value { font-size: 26px; }
  .queue-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 580px) {
  /* Stack grid columns only on mobile viewports */
  .metrics-grid, .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .connection-footer { flex-direction: column; align-items: flex-start; gap: 14px; padding: 16px; }
  .queue-summary { grid-template-columns: 1fr; }
  .queue-alert { align-items: flex-start; flex-direction: column; }
  .drawer-grid { grid-template-columns: 1fr; }
  .queue-drawer { width: 100%; }
  .payment-history-heading { align-items: flex-start; gap: 12px; }
  .payment-history-heading .view-all { align-self: flex-start; }
  
  /* Modal optimization to prevent clipping and cramping */
  .modal-overlay { padding: 10px; }
  .modal { max-height: 95vh; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .tabs { margin-bottom: 16px; gap: 2px; }
  .tab-btn { padding: 8px 12px; font-size: 12px; }
  .form-card { padding: 0; }
  .api-key-cell { padding: 8px 10px; font-size: 12px; }
  
  /* Checkboxes layout stacking and padding for high touch targets */
  .tab-content .form-grid .field {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

@media (max-width: 480px) {
  /* Ultra mobile viewport styling (320px-480px) */
  .topbar { padding: 12px 12px 12px 60px; }
  .topbar-right { justify-content: flex-start; width: 100%; }
  .env-badge { padding: 4px 8px; font-size: 9px; }
  .theme-toggle-btn { padding: 6px 10px; font-size: 9px; }
  .theme-toggle-btn span { font-size: 9px; }
  
  .page-title { font-size: 18px; }
  .metric-value { font-size: 22px; }
  .login h1 { font-size: 22px; }
}

/* Modals & Tabs Redesign */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); z-index: 99; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal {
  background: var(--card-bg);
  width: 100%;
  max-width: 720px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--card-border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: 850; color: var(--text-main); text-transform: uppercase; letter-spacing: 0.05em; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; transition: color 0.2s; }
.modal-close:hover { color: var(--text-main); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.decision-overlay { z-index: 120; }
.decision-modal { max-width: 460px; }
.decision-body { display: flex; flex-direction: column; gap: 16px; }
.decision-message { margin: 0; color: var(--text-main); font-size: 15px; font-weight: 750; line-height: 1.5; }
.decision-detail { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.decision-input-wrap { margin: 0; }
.decision-error { min-height: 16px; margin-top: 6px; color: var(--danger); font-size: 12px; font-weight: 700; }
.decision-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.client360-quick {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(var(--primary-rgb), 0.05);
}
.client360-quick:empty { display: none; }
.client360-quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.client360-quick-head strong,
.client360-title strong { display: block; color: var(--text-main); font-size: 13px; }
.client360-quick-head span,
.client360-title span { display: block; margin-top: 3px; color: var(--text-muted); font-size: 11px; }
.client360-quick-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.client360-quick-item {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--card-border);
  border-radius: 9px;
  background: var(--card-bg);
}
.client360-quick-item span { display: block; color: var(--text-muted); font-size: 10px; font-weight: 750; }
.client360-quick-item strong { display: block; margin-top: 3px; color: var(--text-main); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client360-quick-item.ready { border-color: rgba(16, 185, 129, 0.28); }
.client360-quick-item.attention { border-color: rgba(245, 158, 11, 0.35); }
.client360-title { margin-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--card-border); }
.tab-btn { padding: 10px 18px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 13px; font-weight: 700; cursor: pointer; margin-bottom: -2px; transition: all 0.2s; }
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.api-key-cell { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.1); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 10px 14px; font-family: monospace; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.dark .api-key-cell { background: rgba(0,0,0,0.3); }
.api-key-cell span { flex: 1; word-break: break-all; }
.copy-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 4px; transition: color 0.2s; }
.copy-icon:hover { color: var(--primary); }
.copy-icon:disabled { opacity: 0.42; cursor: not-allowed; }
.danger-link { color: var(--danger); }
.danger-link:hover { color: #ef4444; }

.notification-sender-card { border-color: rgba(var(--primary-rgb), 0.26); }
.notification-card-heading { padding-top: 14px; padding-bottom: 14px; }
.notification-sender-form {
  margin: 0;
  padding: 14px 20px;
  border: 0;
  border-bottom: 1px solid var(--card-border);
  border-radius: 0;
  background: rgba(var(--primary-rgb), 0.025);
}
.notification-sender-form .form-grid { gap: 12px; }
.notification-sender-form .field label { margin-bottom: 5px; }
.notification-sender-form .field input { padding-top: 10px; padding-bottom: 10px; }
.notification-list-card { margin-bottom: 18px; }
.ops-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: rgba(var(--primary-rgb), 0.035);
}
.ops-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}
.ops-tab:hover { color: var(--text-main); background: var(--card-bg); }
.ops-tab.active {
  border-color: rgba(var(--primary-rgb), .28);
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 7px 18px rgba(15, 23, 42, .07);
}
.ops-tab-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), .1);
  color: currentColor;
  font-size: 10px;
  text-align: center;
}
.notification-panel[hidden] { display: none !important; }
.notification-panel.active { animation: fadeIn .18s ease-out; }

.event-stream-wrap { overflow-x: auto; overflow-y: visible; }
.event-stream-wrap table { min-width: 1060px; }
.event-stream-head { position: sticky; top: 0; z-index: 10; background: var(--bg-color); }
.event-row { cursor: pointer; }
.event-row-failed td { background: rgba(239, 68, 68, .035); }
.event-row-failed td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.event-detail-button {
  padding: 6px 10px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.event-detail-button-failed { border-color: rgba(239, 68, 68, .3); background: var(--danger-bg); color: var(--danger-text); }
.table-pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 18px;
  border-top: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 12px;
}
.table-pager[hidden] { display: none; }
.table-pager-button {
  width: 34px;
  height: 30px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-main);
  font-size: 16px;
  cursor: pointer;
}
.table-pager-button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.table-pager-button:disabled { opacity: 0.38; cursor: not-allowed; }

.wa-pairing-layout { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 14px; }
.wa-pairing-label { margin-bottom: 8px; color: var(--text-muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.wa-qr-section { width: 260px; flex: 0 0 260px; text-align: center; }
.wa-qr-canvas { width: 256px; min-height: 256px; display: grid; place-items: center; margin-bottom: 8px; padding: 8px; border: 1px solid var(--card-border); border-radius: 12px; background: #fff; }
.wa-qr-canvas img, .wa-qr-canvas canvas { display: block; width: 240px !important; height: 240px !important; }
.wa-qr-canvas.is-unavailable { color: #7f1d1d; font-size: 12px; line-height: 1.5; }
.wa-pairing-details { min-width: 0; flex: 1; }
#waPairingCode { margin-bottom: 8px; color: var(--text-main); font-size: 30px; font-weight: 900; letter-spacing: .16em; overflow-wrap: anywhere; }
#waPairingHelp { margin-bottom: 12px; white-space: normal; }
.wa-pairing-expiry { margin-bottom: 12px; color: #b45309; font-size: 11px; line-height: 1.5; }
#waQrRawDetails summary { cursor: pointer; }
#waQrRaw { max-height: 120px; overflow: auto; margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-muted); font-size: 10px; }

.instr-box { background: rgba(0,0,0,0.1); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 16px; font-family: monospace; font-size: 12px; color: var(--primary); white-space: pre-wrap; word-break: break-all; margin: 0 0 16px 0; overflow-x: auto; }
.dark .instr-box { background: rgba(0,0,0,0.4); color: #93c5fd; }

.btn-sm { padding: 5px 14px; font-size: 12px; border-radius: 9999px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.animate-fade-in { animation: fadeIn 0.2s ease-out forwards; }
.animate-slide-up { animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Mobile Performance Optimizations for Budget Android processors */
@media (max-width: 820px) {
  .sidebar, .topbar, .shell, .metric-card, .card, .modal {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .sidebar {
    background-color: var(--bg-color) !important;
  }
  .topbar, .metric-card, .card, .modal {
    background-color: var(--card-bg) !important;
  }
  .dark .sidebar, .dark .topbar, .dark .metric-card, .dark .card, .dark .modal {
    background-color: #0f172a !important; /* solid fallback to eliminate redraw blend cost */
  }
  .worker-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signal-alert-row { flex-wrap: wrap; }
  .signal-alert-row .stream-content { flex-basis: calc(100% - 40px); }
}

@media (max-width: 640px) {
  .wa-pairing-layout { flex-direction: column; }
  .wa-qr-section { width: 100%; flex-basis: auto; }
  .wa-qr-canvas { margin-inline: auto; }
  .client360-quick-head { align-items: flex-start; }
  .client360-quick-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-tabs { overflow-x: auto; }
  .ops-tab { flex: 0 0 auto; }
}
@media (max-width: 480px) {
  .worker-summary-grid { grid-template-columns: 1fr; }
  .theme-btn-text { display: none; }
  .theme-toggle-btn { padding: 8px 12px; }
  .topbar-right { gap: 8px; justify-content: space-between; width: 100%; }
  .env-badge { font-size: 8px; padding: 4px 8px; }
  .user-profile { padding-left: 10px; }
  .user-info { display: none; }
}
