/* MoMo Shield — Console Opérateurs B2B
 * Architectural Light Paper × Emerald Brand System
 * Strict 8px spacing & radius grid · Plus Jakarta Sans + Manrope
 */

:root {
  /* Brand Emerald Scale */
  --green-900: #064E3B;
  --green-800: #065F46;
  --green-700: #047857;
  --green-600: #059669;
  --green-500: #10B981;
  --green-100: #D1FAE5;
  --green-50: #ECFDF5;

  /* Neutral Paper Surfaces */
  --bg: #F6F8F7;
  --surface: #FFFFFF;
  --surface-2: #FAFBFB;
  --border: #E2E8E5;
  --divider: #EEF2F0;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;

  /* Semantic States */
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;

  --warning: #B45309;
  --warning-bar: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;

  --safe: #059669;
  --safe-bg: #ECFDF5;
  --safe-border: #D1FAE5;

  /* Strict 8px Radii */
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-dot: 999px;

  /* Layout */
  --sidebar-width: 256px;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Manrope', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Subtle Architectural Elevation */
  --shadow-subtle: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-drawer: -12px 0 32px rgba(15, 23, 42, 0.10);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

button, input, select, pre, code {
  font-family: var(--font-sans);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.icon-xs {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.icon-sm {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.icon-md {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ==========================================================================
   Operator Authentication Gate & Sidebar Account Footer
   ========================================================================== */

body[data-auth-state="checking"] .auth-gate,
body[data-auth-state="checking"] .app-layout,
body[data-auth-state="checking"] .mobile-header {
  display: none !important;
}

body[data-auth-state="login"] .app-layout,
body[data-auth-state="login"] .mobile-header,
body[data-auth-state="login"] .sidebar-backdrop {
  display: none !important;
}

body[data-auth-state="authenticated"] .auth-gate {
  display: none !important;
}

.auth-gate {
  min-height: 100vh;
  background: var(--bg);
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 416px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.auth-emblem {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--green-600);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.auth-emblem svg {
  width: 26px;
  height: 26px;
}

.auth-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-brand-copy h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.auth-brand-copy p {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.45;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
}

.auth-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-footnote {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-account {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-role {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  appearance: none;
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn-logout:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-logout:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

/* ==========================================================================
   App Layout & Fixed 256px SaaS Sidebar
   ========================================================================== */

.mobile-header {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 45;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Brand Lockup */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 8px;
}

.brand-lockup.compact {
  gap: 8px;
  padding: 0;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--green-600);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-emblem svg {
  width: 22px;
  height: 22px;
}

.brand-lockup.compact .brand-emblem {
  width: 32px;
  height: 32px;
}

.brand-lockup.compact .brand-emblem svg {
  width: 18px;
  height: 18px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.25;
}

/* Sidebar Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 8px 4px;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  appearance: none;
  border: none;
  background: transparent;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.active {
  background: var(--green-50);
  color: var(--green-700);
  box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.14), 0 1px 3px 0 rgba(5, 150, 105, 0.10);
}

.nav-item:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  color: var(--green-600);
}

.nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--green-700);
  border: 1px solid var(--green-100);
}

.nav-item:not(.active) .nav-count {
  background: var(--bg);
  color: var(--muted);
  border-color: var(--border);
}

/* Bottom Pinned Status Card */
.sidebar-status {
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-status.paused {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

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

.live-dot-wrap {
  position: relative;
  width: 8px;
  height: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-dot);
  background: var(--green-600);
}

.live-ping {
  position: absolute;
  inset: -3px;
  border-radius: var(--radius-dot);
  background: var(--green-500);
  opacity: 0.45;
  animation: livePulse 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.sidebar-status.paused .live-dot {
  background: var(--warning-bar);
}

.sidebar-status.paused .live-ping {
  display: none;
}

@keyframes livePulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  75%, 100% { transform: scale(2.1); opacity: 0; }
}

.status-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-900);
}

.sidebar-status.paused .status-title {
  color: var(--warning);
}

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

.btn-status-toggle,
.btn-status-refresh {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--green-100);
  color: var(--green-800);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.btn-status-toggle {
  padding: 4px 10px;
}

.btn-status-refresh {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
}

.btn-status-toggle:hover,
.btn-status-refresh:hover {
  background: #FFFFFF;
  border-color: var(--green-500);
}

.sidebar-status.paused .btn-status-toggle,
.sidebar-status.paused .btn-status-refresh {
  border-color: var(--warning-border);
  color: var(--warning);
}

.btn-status-refresh.spinning svg {
  animation: spin 0.65s linear infinite;
}

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

.status-time {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--green-800);
}

.sidebar-status.paused .status-time {
  color: var(--warning);
}

.status-caption {
  font-size: 12px;
  color: var(--green-800);
  opacity: 0.85;
}

.sidebar-status.paused .status-caption {
  color: var(--warning);
}

/* ==========================================================================
   Main Content Canvas
   ========================================================================== */

.main-canvas {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px 48px;
  min-width: 0;
  max-width: calc(1360px + var(--sidebar-width));
}

.view-panel {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.view-panel.active {
  display: flex;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-copy h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.page-subtitle {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons (Strict 8px Radius) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--green-600);
  color: #FFFFFF;
  border-color: var(--green-600);
}

.btn-primary:hover {
  background: var(--green-700);
  border-color: var(--green-700);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-subtle);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: #CBD5D0;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--divider);
}

.btn-sm {
  padding: 8px 16px;
  min-height: 32px;
  font-size: 13px;
}

.btn-icon-quiet {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.btn-icon-quiet:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* ==========================================================================
   Stripe-Style Hairline Metric Strip (Unified 16px Card)
   ========================================================================== */

.metric-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}

.metric-cell {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.metric-cell + .metric-cell {
  border-left: 1px solid var(--divider);
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.metric-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.metric-value-emerald {
  color: var(--green-600);
}

.metric-value-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.metric-online-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-dot);
  background: #CBD5E1;
  flex-shrink: 0;
}

.metric-online-dot.active {
  background: var(--green-500);
  box-shadow: 0 0 0 4px var(--green-100);
}

.metric-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* ==========================================================================
   Quiet 1-Line Telemetry & Privacy Strip (8px Grid)
   ========================================================================== */

.telemetry-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-subtle);
}

.telemetry-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 24px;
  border-right: 1px solid var(--divider);
}

.telemetry-shield-icon {
  width: 16px;
  height: 16px;
  color: var(--green-600);
  flex-shrink: 0;
}

.telemetry-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.telemetry-items {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.telemetry-item + .telemetry-item {
  border-left: 1px solid var(--divider);
  padding-left: 16px;
}

.telemetry-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-val {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.telemetry-val-emerald {
  color: var(--green-600);
}

/* ==========================================================================
   Quiet Filter Toolbar (8px Inputs & Segmented Control)
   ========================================================================== */

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-field {
  position: relative;
  flex: 1 1 280px;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.input-text,
.select-field {
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  padding: 0 12px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
  box-shadow: var(--shadow-subtle);
}

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

.input-text:focus,
.select-field:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.search-input {
  width: 100%;
  padding-left: 38px;
}

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

.segmented-control {
  display: inline-flex;
  align-items: center;
  background: var(--divider);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-subtle);
}

.select-field {
  cursor: pointer;
  padding-right: 28px;
}

/* Bespoke Custom Dropdowns (Strict 8px Radius & Emerald Selection) */
.custom-select {
  position: relative;
  display: inline-block;
}

.custom-select-trigger {
  appearance: none;
  height: 40px;
  padding: 0 12px 0 16px;
  gap: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.custom-select-trigger:hover {
  background: var(--surface-2);
  border-color: #CBD5D0;
}

.custom-select-trigger:focus-visible,
.custom-select.open .custom-select-trigger {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.custom-select.has-value .custom-select-trigger {
  border-color: var(--green-500);
  background: var(--green-50);
  color: var(--green-900);
  font-weight: 600;
}

.custom-select-label {
  pointer-events: none;
}

.custom-select-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.18s ease, color 0.16s ease;
}

.custom-select.has-value .custom-select-chevron,
.custom-select.open .custom-select-chevron {
  color: var(--green-700);
}

.custom-select.open .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 280px;
  max-height: 304px;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 60;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.custom-select.open .custom-select-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.custom-select-option {
  appearance: none;
  border: none;
  background: transparent;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.custom-select-option:hover {
  background: var(--bg);
  color: var(--ink);
}

.custom-select-option:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: -2px;
}

.custom-select-option.selected {
  background: var(--green-50);
  color: var(--green-700);
  font-weight: 600;
}

.custom-select-check {
  width: 16px;
  height: 16px;
  color: var(--green-600);
  flex-shrink: 0;
  opacity: 0;
}

.custom-select-option.selected .custom-select-check {
  opacity: 1;
}

/* Fixed-Slot Icon-Only Filter Reset Button (40x40px, zero layout shift) */
.btn-reset-icon {
  appearance: none;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  opacity: 1;
  transition: opacity 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.btn-reset-icon:hover {
  background: var(--green-50);
  border-color: var(--green-500);
  color: var(--green-700);
}

.btn-reset-icon:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

.btn-reset-icon.inactive {
  opacity: 0.38;
  pointer-events: none;
}

/* ==========================================================================
   Cards & Editorial Table Card (16px Radius)
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
}

.panel-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
}

.table-card {
  overflow: hidden;
}

.table-card-header {
  padding: 24px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.table-card-header h2,
.card-head h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.card-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-head-wrap {
  flex-wrap: wrap;
}

.subtle-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--divider);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 820px;
}

.data-table thead th {
  padding: 16px 24px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 16px 24px;
  font-size: 14px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}

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

.data-table tbody tr.clickable-row {
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.data-table tbody tr.clickable-row:hover {
  background: var(--surface-2);
}

.data-table tbody tr.clickable-row:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: -2px;
}

.data-table tbody tr.row-fresh {
  background: var(--danger-bg);
}

.data-table tbody tr.row-fresh:hover {
  background: #FEE2E2;
}

.data-table tbody tr.row-highlight-emerald {
  background: var(--green-50);
}

/* Table Cells */
.phone-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.country-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
  display: block;
}

.phone-primary {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.operator-text {
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}

.typology-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--divider);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.channels-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}

.confidence-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 128px;
}

.confidence-track {
  width: 64px;
  height: 6px;
  border-radius: var(--radius-sm);
  background: var(--divider);
  overflow: hidden;
  flex-shrink: 0;
}

.confidence-fill {
  height: 100%;
  border-radius: var(--radius-sm);
}

.confidence-fill.level-high {
  background: var(--danger);
}

.confidence-fill.level-medium {
  background: var(--warning-bar);
}

.confidence-fill.level-low {
  background: var(--green-600);
}

.confidence-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

/* Status Pill Badges (8px radius, circular 999px dot inside) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-dot);
  background: currentColor;
  flex-shrink: 0;
}

.status-confirmed {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.status-suspect {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.status-cleared {
  background: var(--safe-bg);
  color: var(--safe);
  border-color: var(--safe-border);
}

.status-unknown {
  background: var(--bg);
  color: var(--muted);
  border-color: var(--border);
}

.activity-time {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.activity-time.fresh {
  color: var(--danger);
  font-weight: 700;
}

/* Refined Empty State */
.table-loading-cell {
  padding: 40px 24px !important;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
}

.empty-state-cell {
  padding: 48px 24px !important;
  text-align: center;
}

.empty-state {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-emblem {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--green-50);
  border: 1px solid var(--green-100);
  color: var(--green-600);
  display: grid;
  place-items: center;
}

.empty-emblem svg {
  width: 24px;
  height: 24px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.empty-state p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.empty-inline {
  font-size: 13px;
  color: var(--muted);
  padding: 16px 0;
}

/* ==========================================================================
   Bottom 2-Column Insights Grid
   ========================================================================== */

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.insights-grid > .panel-card {
  height: 100%;
  padding: 24px;
  gap: 16px;
  overflow: visible;
}

.typology-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 0 auto;
  overflow: visible;
}

.bar-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.bar-name {
  font-weight: 600;
  color: var(--ink-2);
}

.bar-stat {
  font-weight: 700;
  color: var(--ink);
}

.bar-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-sm);
  background: var(--divider);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.25s ease;
}

/* Channel Tiles */
.channel-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  flex: 1 0 auto;
  align-content: start;
}

.channel-tile {
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-tile-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.channel-tile-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

.channel-tile-sub {
  font-size: 12px;
  color: var(--muted);
}

.production-notice {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--green-50);
  border: 1px solid var(--green-100);
  color: var(--green-900);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.notice-icon {
  width: 20px;
  height: 20px;
  color: var(--green-600);
  flex-shrink: 0;
}

/* ==========================================================================
   View 2 : API & Watchlist
   ========================================================================== */

.endpoint-tag {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-800);
  background: var(--green-50);
  border: 1px solid var(--green-100);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.lookup-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lookup-input {
  flex: 1 1 280px;
  max-width: 420px;
}

.lookup-result {
  padding-top: 16px;
  border-top: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lookup-result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.lookup-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lookup-result-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink-2);
}

.lookup-path {
  font-size: 12px;
  color: var(--muted);
}

.payload-box {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
}

.endpoint-list {
  display: flex;
  flex-direction: column;
}

.endpoint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
}

.endpoint-row:first-child {
  padding-top: 0;
}

.endpoint-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.endpoint-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.endpoint-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.method-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid var(--green-100);
}

.method-tag.method-post {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.endpoint-url {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-all;
}

.endpoint-desc {
  font-size: 13px;
  color: var(--muted);
}

.export-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
}

.export-option h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.export-option p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   View 3 : Benchmarks GPU (Tesla T4)
   ========================================================================== */

.hw-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-800);
  background: var(--green-50);
  border: 1px solid var(--green-100);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
}

.takeaway-banner {
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.takeaway-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.takeaway-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green-700);
  text-transform: uppercase;
}

.takeaway-source {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-800);
}

.takeaway-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--green-900);
  line-height: 1.4;
}

.model-title {
  font-weight: 700;
  color: var(--ink);
}

.model-role {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.metric-good {
  color: var(--green-700);
  font-weight: 700;
}

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

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

.split-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.split-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--divider);
  font-size: 13px;
}

.split-chip span {
  color: var(--muted);
  font-weight: 500;
}

.split-chip strong {
  color: var(--ink);
  font-weight: 700;
}

.matrix-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.45fr);
  gap: 24px;
  align-items: start;
}

.sub-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 16px;
}

.confusion-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.confusion-top .sub-heading {
  margin-bottom: 0;
}

.cm-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

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

.cm-swatch {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-dot);
  display: inline-block;
}

.cm-swatch-ok {
  background: var(--green-600);
}

.cm-swatch-err {
  background: var(--danger);
}

.cm-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.cm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: center;
}

.cm-table th,
.cm-table td {
  padding: 8px;
  border: 1px solid var(--divider);
}

.cm-table thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.cm-row-label {
  text-align: left;
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 700;
  white-space: nowrap;
}

.cm-cell {
  font-weight: 700;
  min-width: 40px;
}

/* ==========================================================================
   Slide-Over Detail Drawer (16px Radius)
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 80;
}

.detail-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(520px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-drawer);
  z-index: 90;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header {
  padding: 24px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.drawer-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green-700);
  margin-bottom: 4px;
}

.drawer-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.drawer-metric {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-metric + .drawer-metric {
  border-left: 1px solid var(--divider);
}

.drawer-metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.drawer-metric-val {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-section-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.incidents-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.incident-item {
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.incident-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.incident-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.signal-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
}

.incident-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  transition: opacity 0.25s ease;
}

.toast-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.toast-body {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1200px) {
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-cell:nth-child(3) {
    border-left: none;
  }

  .metric-cell:nth-child(n + 3) {
    border-top: 1px solid var(--divider);
  }

  .telemetry-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .telemetry-head {
    padding-right: 0;
    padding-bottom: 12px;
    border-right: none;
    border-bottom: 1px solid var(--divider);
  }

  .telemetry-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .telemetry-item:nth-child(3) {
    border-left: none;
    padding-left: 0;
  }

  .insights-grid,
  .matrix-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .mobile-menu-btn {
    appearance: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--ink);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.14);
  }

  .main-canvas {
    margin-left: 0;
    padding: 24px 16px 40px;
  }
}

@media (max-width: 640px) {
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .metric-cell + .metric-cell {
    border-left: none;
    border-top: 1px solid var(--divider);
  }

  .telemetry-items {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .telemetry-item + .telemetry-item {
    border-left: none;
    border-top: 1px solid var(--divider);
    padding-left: 0;
    padding-top: 12px;
  }

  .channel-tiles {
    grid-template-columns: 1fr;
  }

  .search-field {
    max-width: none;
  }

  .detail-drawer {
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }
}
