/* NotSquat Enterprise Gym Operator Free Data Warehouse & Analytics Suite
   Tailored for High-Volume Commercial Chains: Planet Fitness, LA Fitness, Gold's Gym, Crunch */

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

:root {
  --bg-deep: #050608;
  --bg-primary: #0b0d11;
  --bg-surface: #12151b;
  --bg-card: #161922;
  --bg-card-hover: #1c212c;
  --bg-glass: rgba(11, 13, 17, 0.94);
  --bg-card-subtle: #191d27;

  --text-pure: #ffffff;
  --text-main: #e8ecf2;
  --text-muted: #8e99ab;
  --text-dim: #546073;

  --border-subtle: #1e2430;
  --border-medium: #2a3344;
  --border-highlight: #3e4c66;
  --border-active: #ffffff;

  /* Functional Commercial Gym High-Contrast Accents */
  --pf-purple: #702082;
  --pf-yellow: #fdd835;
  --la-blue: #0056b3;
  --la-cyan: #00c0f3;
  
  --accent-emerald: #00e599;
  --accent-emerald-glow: rgba(0, 229, 153, 0.15);
  --accent-amber: #ffb300;
  --accent-amber-glow: rgba(255, 179, 0, 0.15);
  --accent-crimson: #ff334b;
  --accent-crimson-glow: rgba(255, 51, 75, 0.2);
  --accent-cyan: #00d4ff;

  --font-main: 'Plus Jakarta Sans', 'Space Grotesk', -apple-system, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(0, 229, 153, 0.12);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Planet Fitness Commercial Brand Mode */
body.theme-planet {
  --border-highlight: #702082;
  --accent-chain: #fdd835;
}

/* LA Fitness Commercial Brand Mode */
body.theme-lafitness {
  --border-highlight: #0056b3;
  --accent-chain: #00c0f3;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-highlight);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-pure);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

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

/* Sticky Enterprise Header Bar */
.navbar-analytics {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  gap: 1.5rem;
}

.nav-brand-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #000;
  color: #fff;
  border: 1px solid var(--border-medium);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.nav-brand-badge .badge-icon {
  color: var(--accent-emerald);
}

.nav-club-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.nav-club-select-wrap span {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 600;
}

.club-select {
  background: transparent;
  color: var(--text-pure);
  border: none;
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.club-select option {
  background: var(--bg-surface);
  color: var(--text-pure);
}

.nav-status-indicators {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-pill strong {
  color: var(--text-pure);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseAnim 2s infinite ease-in-out;
}

.pulse-dot.crimson {
  background: var(--accent-crimson);
  box-shadow: 0 0 8px var(--accent-crimson);
}

@keyframes pulseAnim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Button UI Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}
.btn-primary:hover {
  background: #e6e6e6;
  border-color: #e6e6e6;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-pure);
  border-color: var(--border-medium);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.btn-outline {
  background: transparent;
  color: var(--text-pure);
  border-color: var(--border-medium);
}
.btn-outline:hover {
  border-color: var(--text-pure);
  background: rgba(255, 255, 255, 0.05);
}

.btn-emerald {
  background: var(--accent-emerald);
  color: #000000;
  font-weight: 700;
}
.btn-emerald:hover {
  background: #00c986;
}

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

/* Commercial Gym Barter Hero Ribbon */
.barter-tier-hero {
  background: radial-gradient(circle at 80% 20%, rgba(0, 229, 153, 0.06) 0%, rgba(11, 13, 17, 0) 60%),
              linear-gradient(180deg, #11141b 0%, #0b0d11 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.barter-headline {
  max-width: 840px;
}

.badge-barter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 229, 153, 0.3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  margin-bottom: 0.6rem;
  letter-spacing: 0.5px;
}

.barter-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 0.35rem;
}

.barter-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.barter-desc strong {
  color: #fff;
}

.barter-metrics-summary {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.barter-stat-item {
  display: flex;
  flex-direction: column;
}

.barter-stat-label {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.barter-stat-val {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-pure);
  line-height: 1.1;
}

.barter-stat-val.highlight-green {
  color: var(--accent-emerald);
}

/* Turnstile vs Optical Re-ID Discrepancy Banner */
.discrepancy-alert-bar {
  background: linear-gradient(90deg, rgba(255, 179, 0, 0.08) 0%, rgba(255, 179, 0, 0.02) 100%);
  border-bottom: 1px solid rgba(255, 179, 0, 0.25);
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent-amber);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.discrepancy-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Simulation Controls & Time Context Bar */
.sim-controls-bar {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
}

.sim-btn-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.sim-tab-btn {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sim-tab-btn:hover {
  color: var(--text-pure);
  border-color: var(--border-medium);
}

.sim-tab-btn.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  font-weight: 700;
}

/* Main Dashboard Container */
.dashboard-container {
  max-width: 1680px;
  margin: 0 auto;
  padding: 2rem 2rem 5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* High-Volume Commercial KPI Grid */
.kpis-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.kpi-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
  box-shadow: var(--shadow-sm);
}

.kpi-stat-card:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.kpi-badge-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.kpi-icon {
  font-size: 1.25rem;
}

.kpi-main-number {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-pure);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.kpi-main-number span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-trend-caption {
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-family: var(--font-main);
}

.kpi-trend-caption.good { color: var(--accent-emerald); }
.kpi-trend-caption.alert { color: var(--accent-amber); }
.kpi-trend-caption.critical { color: var(--accent-crimson); }

/* Pillar Section Container & Headers */
.pillar-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pillar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
}

.pillar-title-wrap h2 {
  font-size: 1.45rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pillar-title-wrap p {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-top: 2px;
}

/* Grids */
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
}

.grid-1-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.25rem;
}

.grid-3-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

@media (max-width: 1120px) {
  .grid-2-1, .grid-1-1, .grid-1-2 {
    grid-template-columns: 1fr;
  }
}

/* Telemetry Card Containers */
.telemetry-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.telemetry-card:hover {
  border-color: var(--border-medium);
}

.telemetry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.telemetry-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Interactive Architectural Floor Plan */
.floorplan-canvas-wrap {
  position: relative;
  width: 100%;
  height: 480px;
  background: #040507;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#floorplanCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.canvas-floating-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 5px;
  background: rgba(11, 13, 17, 0.92);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  backdrop-filter: blur(8px);
}

.layer-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.layer-btn:hover {
  color: #fff;
}

.layer-btn.active {
  background: #252c3b;
  color: #ffffff;
  border-color: #3e4c66;
}

.canvas-legend-bar {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(11, 13, 17, 0.92);
  border: 1px solid var(--border-medium);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(8px);
}

.legend-scale-bar {
  width: 120px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, #00e599 0%, #ffb300 55%, #ff334b 100%);
}

/* Zone Telemetry Inspector Sidebar */
.zone-telemetry-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.zone-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zone-tile:hover, .zone-tile.active-selected {
  border-color: var(--border-active);
  background: #1c222e;
}

.zone-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zone-tile-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-pure);
}

.zone-tile-metric {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
}

.zone-progress-wrap {
  width: 100%;
  height: 6px;
  background: #1c212c;
  border-radius: 2px;
  overflow: hidden;
}

.zone-progress-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.zone-tile-subinfo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Station Live Status Grid */
.station-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.station-mini-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.station-mini-card.state-occupied {
  border-left: 3px solid var(--accent-emerald);
}

.station-mini-card.state-longrest {
  border-left: 3px solid var(--accent-amber);
}

.station-mini-card.state-free {
  border-left: 3px solid #444;
  opacity: 0.75;
}

.station-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-pure);
}

.station-mini-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Dwell Time Breakdown */
.dwell-chart-container {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.dwell-bars-list {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.dwell-bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dwell-bar-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.dwell-bar-labels .station-name {
  font-weight: 600;
  color: var(--text-pure);
}

.dwell-bar-labels .dwell-stats {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.segmented-progress-bar {
  display: flex;
  width: 100%;
  height: 13px;
  background: #171b24;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.seg-active { background: #ffffff; }
.seg-rest { background: #556277; }
.seg-idle { background: var(--accent-amber); }
.seg-wipe { background: #2f3849; }

.dwell-legend-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

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

.dot-sq {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

/* Biomechanical Risk Wireframes & Actuarial Flags */
.hazard-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 980px) {
  .hazard-split-grid {
    grid-template-columns: 1fr;
  }
}

.wireframe-visualizer-box {
  background: #040507;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  height: 310px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#skeletonCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.wireframe-overlay-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(11, 13, 17, 0.9);
  border: 1px solid var(--accent-crimson);
  color: var(--accent-crimson);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-xs);
  backdrop-filter: blur(8px);
}

.wireframe-angles-hud {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(11, 13, 17, 0.9);
  border: 1px solid var(--border-medium);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 6px 10px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(8px);
}

.wireframe-angles-hud span strong {
  color: #fff;
}

.actuarial-audit-feed {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 310px;
  overflow-y: auto;
}

.actuarial-row {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-crimson);
  border-top: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 0.9rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.actuarial-row.severity-medium {
  border-left-color: var(--accent-amber);
}

.actuarial-row.severity-low {
  border-left-color: var(--accent-cyan);
}

.actuarial-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
}

.actuarial-row-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.actuarial-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* Peak Hours 24x7 Matrix */
.heatmap-24x7-wrap {
  width: 100%;
  overflow-x: auto;
}

.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.heatmap-table th, .heatmap-table td {
  padding: 6px;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.heatmap-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-surface);
}

.heat-cell {
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.heat-cell:hover {
  outline: 1px solid #ffffff;
  transform: scale(1.1);
  z-index: 10;
}

.heat-0 { background: #0c0e14; color: #3b4455; }
.heat-1 { background: #12291d; color: #00e599; }
.heat-2 { background: #203f29; color: #94ecb8; }
.heat-3 { background: #4a4114; color: #ffb800; }
.heat-4 { background: #5a2618; color: #ff7e5a; }
.heat-5 { background: #66111f; color: #ff334b; font-weight: 800; }

/* Churn Risk & AI Capacity Reallocation */
.churn-insight-card {
  background: linear-gradient(145deg, #181d28 0%, #12151e 100%);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.churn-insight-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 8px;
}

.churn-correlation-stat {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-surface);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.churn-highlight {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-crimson);
  line-height: 1;
}

.churn-explain {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.churn-explain strong {
  color: #fff;
}

.recommendation-banner {
  background: rgba(0, 229, 153, 0.08);
  border: 1px solid rgba(0, 229, 153, 0.35);
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-main);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* Data Warehouse Live ClickHouse Terminal */
.sql-terminal-box {
  background: #040507;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sql-terminal-header {
  background: var(--bg-surface);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sql-query-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-chip {
  background: #1c222e;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-chip:hover {
  color: #fff;
  border-color: #556277;
}

.sql-editor-area {
  padding: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: #020304;
  color: var(--accent-emerald);
  min-height: 95px;
  outline: none;
  white-space: pre-wrap;
  border-bottom: 1px solid var(--border-subtle);
}

.sql-results-table-wrap {
  max-height: 240px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #080a0f;
}

.sql-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.sql-table th, .sql-table td {
  padding: 7px 12px;
  text-align: left;
  border-bottom: 1px solid #1c222e;
}

.sql-table th {
  color: #8e99ab;
  background: #121620;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.sql-table td {
  color: #e8ecf2;
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  max-width: 840px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 1rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close-btn:hover { color: #fff; }

/* Responsive */
@media (max-width: 768px) {
  .navbar-analytics {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .dashboard-container {
    padding: 1rem;
  }
  .barter-tier-hero {
    padding: 1.25rem 1rem;
  }
}
