@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --bg-deep: #05090e;
  --bg-mid: #0d1520;
  --panel: rgba(10, 24, 44, 0.90);
  --panel-soft: rgba(7, 16, 32, 0.93);
  --line: rgba(62, 105, 168, 0.42);
  --accent: #35d4ff;
  --accent-2: #7ef0a8;
  --warn: #ffb020;
  --critical: #ff5c7a;
  --text: #deebfa;
  --text-soft: #9db1c8;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 24px;
  --radius-premium: 18px;
}

* {
  box-sizing: border-box;
}

/* Sidebar — in-flow flex child on desktop; fixed overlay on mobile */
#app-sidebar {
  flex-shrink: 0;
  width: 18rem;
  height: 100%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  scroll-behavior: smooth;
  background:
    radial-gradient(1200px 500px at 15% 0%, rgba(53, 212, 255, 0.08), transparent 55%),
    radial-gradient(1000px 400px at 85% 0%, rgba(126, 240, 168, 0.06), transparent 55%),
    linear-gradient(180deg, #04070b 0%, #05090f 40%, #070d15 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

.velocity-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 170, 220, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 220, 0.08) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: 0.22;
  mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
}

.brand-font {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.06em;
}

.glass-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow:
    inset 0 1px 0 rgba(211, 238, 255, 0.05),
    0 18px 40px rgba(0, 0, 0, 0.38);
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

.glass-panel-soft {
  background: var(--panel-soft);
  border: 1px solid rgba(55, 95, 158, 0.32);
  backdrop-filter: blur(10px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.glass-panel:hover,
.glass-panel-soft:hover {
  border-color: rgba(91, 160, 212, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(220, 243, 255, 0.07),
    0 22px 48px rgba(0, 0, 0, 0.42);
}

.glass-panel:hover {
  transform: translateY(-2px);
}

.data-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(83, 119, 157, 0.8) transparent;
}

.data-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.data-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(83, 119, 157, 0.8);
  border-radius: 999px;
}

.kpi-trend-up {
  color: var(--accent-2);
}

.kpi-trend-down {
  color: var(--critical);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 rgba(53, 212, 255, 0.6);
  animation: pulse-ring 2s infinite;
}

.kpi-executive-card {
  position: relative;
  overflow: hidden;
}

.kpi-executive-card::after {
  content: "";
  position: absolute;
  inset: -20% auto auto -10%;
  width: 70%;
  height: 120%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
  transform: rotate(12deg);
  pointer-events: none;
  opacity: 0.18;
}

.kpi-card-glow-strong {
  box-shadow:
    0 0 0 1px rgba(53, 212, 255, 0.2),
    0 0 28px rgba(53, 212, 255, 0.18),
    0 16px 40px rgba(0, 0, 0, 0.34);
}

.kpi-card-glow-stable {
  box-shadow:
    0 0 0 1px rgba(126, 240, 168, 0.16),
    0 0 22px rgba(126, 240, 168, 0.1),
    0 16px 40px rgba(0, 0, 0, 0.34);
}

.kpi-card-glow-watch {
  box-shadow:
    0 0 0 1px rgba(255, 176, 32, 0.2),
    0 0 22px rgba(255, 176, 32, 0.14),
    0 16px 40px rgba(0, 0, 0, 0.34);
}

.sortable-header {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9db1c8;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.sortable-header:hover {
  color: #35d4ff;
}

.exec-storyline {
  position: relative;
  overflow: hidden;
}

.exec-storyline::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto;
  height: 110px;
  background: radial-gradient(50% 100% at 50% 0%, rgba(53, 212, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.story-ribbon {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.story-step {
  min-height: 108px;
  border-color: rgba(91, 144, 186, 0.36);
}

.leaderboard-row:hover {
  transform: translateX(4px);
}

.chart-canvas {
  height: 280px;
  min-height: 280px;
  width: 100%;
  border-radius: 12px;
}

.experience-loading {
  position: relative;
}

body.page-nav-entering::after,
body.page-nav-exiting::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1500;
  background:
    radial-gradient(700px 300px at 50% 10%, rgba(53, 212, 255, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(5, 10, 16, 0.35), rgba(5, 10, 16, 0.72));
}

body.page-nav-entering::after {
  animation: nav-overlay-enter 0.42s ease forwards;
}

body.page-nav-exiting::after {
  animation: nav-overlay-exit 0.34s ease forwards;
}

@keyframes nav-overlay-enter {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes nav-overlay-exit {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.page-skeleton-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  border-radius: 16px;
  padding: 18px;
  background:
    linear-gradient(140deg, rgba(7, 15, 23, 0.94), rgba(9, 19, 30, 0.88)),
    radial-gradient(600px 280px at 10% 0%, rgba(53, 212, 255, 0.08), transparent 58%);
  backdrop-filter: blur(7px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.page-skeleton-overlay-out {
  opacity: 0;
  transform: translateY(8px);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.skeleton-card {
  min-height: 92px;
  border-radius: 14px;
  border: 1px solid rgba(78, 116, 148, 0.34);
  background: rgba(15, 29, 43, 0.84);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(78, 112, 141, 0.16), rgba(123, 183, 227, 0.5), rgba(78, 112, 141, 0.16));
  background-size: 220% 100%;
  animation: skeleton-flow 1.2s linear infinite;
}

@keyframes skeleton-flow {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

body.is-refreshing .glass-panel,
body.is-refreshing .glass-panel-soft {
  animation: panel-refresh 0.92s ease;
}

@keyframes panel-refresh {
  0% {
    filter: saturate(0.9) brightness(0.98);
  }
  30% {
    filter: saturate(1.15) brightness(1.06);
  }
  100% {
    filter: saturate(1) brightness(1);
  }
}

.pulse-boost {
  animation: pulse-boost 0.5s ease;
}

@keyframes pulse-boost {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.22);
    filter: brightness(1.26);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.store-kpi-card {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.store-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(53, 212, 255, 0.4);
}

.store-silo-launch {
  border: 1px solid rgba(83, 122, 158, 0.24);
  border-radius: 14px;
  background: rgba(10, 19, 30, 0.5);
  padding: 12px;
}

.store-silo-launch-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.silo-launch-btn {
  border-radius: 10px;
  border: 1px solid rgba(83, 122, 158, 0.34);
  background: rgba(14, 26, 39, 0.76);
  min-height: 42px;
  padding: 10px 12px;
  font-size: 12px;
  color: #d7e8fa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.silo-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

.silo-compact {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.silo-launch-btn.tone-sales {
  border-color: rgba(126, 240, 168, 0.4);
  color: #9df5bd;
}

.silo-launch-btn.tone-sales:hover {
  border-color: rgba(126, 240, 168, 0.68);
}

.silo-launch-btn.tone-service {
  border-color: rgba(53, 212, 255, 0.4);
  color: #8de8ff;
}

.silo-launch-btn.tone-service:hover {
  border-color: rgba(53, 212, 255, 0.7);
}

.silo-launch-btn.tone-fi {
  border-color: rgba(255, 176, 32, 0.42);
  color: #ffcd72;
}

.silo-launch-btn.tone-fi:hover {
  border-color: rgba(255, 176, 32, 0.7);
}

.silo-launch-btn.tone-acq {
  border-color: rgba(176, 140, 255, 0.42);
  color: #ceb6ff;
}

.silo-launch-btn.tone-acq:hover {
  border-color: rgba(176, 140, 255, 0.72);
}

.silo-launch-btn.tone-parts {
  border-color: rgba(108, 194, 255, 0.42);
  color: #a8dbff;
}

.silo-launch-btn.tone-parts:hover {
  border-color: rgba(108, 194, 255, 0.72);
}

.store-tab-btn {
  min-width: 110px;
}

.store-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.store-timeline-item {
  position: relative;
}

.store-timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #35d4ff;
  box-shadow: 0 0 10px rgba(53, 212, 255, 0.5);
}

.store-timeline-item::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(53, 212, 255, 0.35), rgba(53, 212, 255, 0.03));
}

.store-timeline-item:last-child::after {
  display: none;
}

.store-live-ticker-track {
  position: relative;
  overflow: hidden;
  min-height: 22px;
}

.store-live-ticker-text {
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.silo-metric-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.silo-metric-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(53, 212, 255, 0.1), transparent 55%);
  pointer-events: none;
}

.silo-metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(53, 212, 255, 0.38);
}

.service-widget-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.service-widget-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(126, 240, 168, 0.08), transparent 52%);
  pointer-events: none;
}

.service-widget-card:hover {
  transform: translateY(-2px);
  border-color: rgba(126, 240, 168, 0.36);
}

.recon-column {
  min-height: 260px;
}

.queue-pulse-item {
  transition: border-color 0.2s ease;
}

.queue-pulse-item:hover {
  border-color: rgba(53, 212, 255, 0.42);
}

.fi-widget-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.fi-widget-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(95, 157, 255, 0.11), rgba(255, 176, 32, 0.02) 56%);
  pointer-events: none;
}

.fi-widget-card:hover {
  transform: translateY(-2px);
  border-color: rgba(95, 157, 255, 0.42);
}

.fi-cit-card {
  transition: border-color 0.2s ease;
}

.fi-cit-card:hover {
  border-color: rgba(255, 176, 32, 0.4);
}

.fi-risk-alert {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.fi-risk-alert:hover {
  transform: translateY(-2px);
}

.acq-metric-card {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.acq-metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(53, 212, 255, 0.38);
}

.parts-kpi-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.parts-kpi-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(53, 212, 255, 0.1), rgba(126, 240, 168, 0.02) 58%);
  pointer-events: none;
}

.parts-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(53, 212, 255, 0.4);
}

.parts-activity-item {
  transition: border-color 0.2s ease;
}

.parts-activity-item:hover {
  border-color: rgba(53, 212, 255, 0.38);
}

#ai-copilot-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
}

.ai-copilot-fab {
  width: auto;
  height: 54px;
  padding: 0 1.2rem 0 8px;
  gap: 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(53, 212, 255, 0.65);
  background: linear-gradient(135deg, #0c2438 0%, #071828 100%);
  color: #dff3ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(53, 212, 255, 0.18),
    0 0 28px rgba(53, 212, 255, 0.4),
    0 0 60px rgba(53, 212, 255, 0.12),
    0 12px 32px rgba(0, 0, 0, 0.75);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: visible;
}

.ai-fab-avatar {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.ai-fab-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: #c8ecff;
}

.ai-copilot-fab:hover {
  transform: scale(1.04);
  box-shadow:
    0 0 0 1px rgba(53, 212, 255, 0.3),
    0 0 36px rgba(53, 212, 255, 0.6),
    0 0 70px rgba(53, 212, 255, 0.2),
    0 14px 36px rgba(0, 0, 0, 0.8);
}

.ai-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1px solid rgba(53, 212, 255, 0.35);
  animation: ai-pulse 2.1s infinite;
}

.ai-fab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ff5c7a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #071828;
  z-index: 2;
}

.ai-copilot-panel {
  width: min(420px, calc(100vw - 22px));
  max-height: min(78vh, 780px);
  margin-bottom: 12px;
  background: rgba(13, 23, 35, 0.86);
  border: 1px solid rgba(83, 122, 158, 0.4);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.ai-copilot-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(88, 116, 143, 0.32);
  background: linear-gradient(120deg, rgba(53, 212, 255, 0.09), rgba(126, 240, 168, 0.02));
}

.ai-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(88, 116, 143, 0.4);
  background: rgba(16, 28, 41, 0.78);
  color: #cde6ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-copilot-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-chip-button {
  border: 1px solid rgba(88, 116, 143, 0.45);
  background: rgba(17, 30, 45, 0.76);
  color: #d8e9fb;
  border-radius: 999px;
  font-size: 11px;
  padding: 5px 9px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.ai-chip-button:hover {
  border-color: rgba(53, 212, 255, 0.58);
  color: #35d4ff;
}

.ai-conversation {
  min-height: 170px;
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.ai-msg-wrap {
  display: flex;
}

.ai-msg-wrap.user {
  justify-content: flex-end;
}

.ai-msg-wrap.ai {
  justify-content: flex-start;
}

.ai-msg {
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 92%;
  border: 1px solid rgba(88, 116, 143, 0.36);
}

.ai-msg.user {
  background: rgba(53, 212, 255, 0.14);
}

.ai-msg.ai {
  background: rgba(14, 26, 39, 0.78);
}

.ai-msg-title {
  font-size: 12px;
  font-weight: 700;
  color: #dff1ff;
  margin-bottom: 2px;
}

.ai-msg-text {
  font-size: 13px;
  color: #deebfa;
  line-height: 1.35;
}

.ai-msg-list {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 12px;
  color: #c5dbef;
  display: grid;
  gap: 3px;
}

.ai-msg-time {
  margin-top: 6px;
  font-size: 10px;
  color: #95adc7;
}

.ai-dependency-grid,
.ai-reco-grid {
  display: grid;
  gap: 6px;
}

.ai-dependency-card,
.ai-reco-card {
  border-radius: 10px;
  border: 1px solid rgba(88, 116, 143, 0.4);
  background: rgba(13, 24, 36, 0.76);
  padding: 8px;
}

.ai-thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(88, 116, 143, 0.35);
  background: rgba(13, 24, 36, 0.7);
}

.ai-thinking .dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #35d4ff;
  animation: ai-dot 0.8s infinite ease-in-out;
}

.ai-thinking .dot:nth-child(2) {
  animation-delay: 0.1s;
}

.ai-thinking .dot:nth-child(3) {
  animation-delay: 0.2s;
}

.ai-copilot-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(88, 116, 143, 0.32);
  background: rgba(12, 22, 34, 0.86);
}

.ai-input {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(88, 116, 143, 0.4);
  background: rgba(12, 21, 32, 0.86);
  color: #deebfa;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
}

.ai-input:focus {
  border-color: rgba(53, 212, 255, 0.62);
}

.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(53, 212, 255, 0.45);
  background: rgba(25, 63, 90, 0.65);
  color: #dff1ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes ai-pulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

@keyframes ai-dot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes sb-slide-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.sb-new-item {
  animation: sb-slide-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@media (max-width: 768px) {
  .store-silo-launch-grid {
    grid-template-columns: 1fr;
  }

  .story-ribbon {
    grid-template-columns: 1fr;
  }

  #ai-copilot-root {
    right: 12px;
    bottom: 12px;
  }

  .ai-copilot-panel {
    width: calc(100vw - 16px);
    margin-bottom: 10px;
  }
}

@media (min-width: 1024px) {
  .chart-canvas {
    height: 320px;
    min-height: 320px;
  }

  .store-silo-launch-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(53, 212, 255, 0.6);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(53, 212, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(53, 212, 255, 0);
  }
}

@media (max-width: 1023.98px) {
  /* Sidebar ẩn mặc định trên mobile — overlay cố định, không chiếm không gian flex */
  #app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    height: 100%;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #app-sidebar.sidebar-open {
    transform: translateX(0);
  }
}

/* Mobile sidebar backdrop */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
#sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* Prevent body scroll when mobile sidebar is open */
body.sidebar-open-mobile {
  overflow: hidden;
}

/* ── Sidebar Label & Collapse Button Base (all breakpoints) ──── */
#app-sidebar .sidebar-label {
  transition: opacity 0.2s ease, width 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
}

#sidebar-collapse-btn {
  position: absolute;
  right: -0.875rem;
  top: 1.75rem;
  z-index: 50;
}

#sidebar-collapse-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Sidebar Desktop Collapse — desktop only (≥1024px) ──────── */
@media (min-width: 1024px) {
  body.sidebar-collapsed #app-sidebar {
    width: 6rem;
    padding: 0.5rem;
  }

  body.sidebar-collapsed #app-sidebar > div {
    padding: 0.75rem;
  }

  body.sidebar-collapsed #app-sidebar .sidebar-label {
    opacity: 0;
    width: 0;
    pointer-events: none;
  }

  body.sidebar-collapsed #app-sidebar .nav-item {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
  }

  body.sidebar-collapsed #app-sidebar .sidebar-header-logo-row {
    justify-content: center;
    gap: 0;
    margin-bottom: 0;
  }

  body.sidebar-collapsed #app-sidebar .sidebar-header-logo-row img {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: contain;
  }

  body.sidebar-collapsed #app-sidebar .sidebar-footer {
    justify-content: center;
  }

  body.sidebar-collapsed #app-sidebar .sidebar-user-profile {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  body.sidebar-collapsed #app-sidebar #settings-menu-wrapper {
    display: none;
  }

  body.sidebar-collapsed #app-sidebar .sidebar-label-block {
    display: none;
  }

  body.sidebar-collapsed #sidebar-collapse-icon {
    transform: rotate(180deg);
  }
}

/* #main-content width managed automatically by flexbox — no manual padding-left needed */

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME
   Applied when <html data-theme="light">
   ══════════════════════════════════════════════════════════════ */

html[data-theme="light"] {
  --bg-deep: #f1f5fb;
  --bg-mid: #e6edf6;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-soft: rgba(247, 251, 255, 0.98);
  --line: rgba(100, 140, 185, 0.18);
  --accent: #0499c2;
  --accent-2: #16a34a;
  --warn: #d97706;
  --critical: #dc2626;
  --text: #0c1c2e;
  --text-soft: #4a6480;
}

/* Page background */
html[data-theme="light"] body {
  background:
    radial-gradient(1200px 500px at 15% 0%, rgba(4, 153, 194, 0.06), transparent 55%),
    radial-gradient(1000px 400px at 85% 0%, rgba(22, 163, 74, 0.04), transparent 55%),
    linear-gradient(180deg, #eef3fa 0%, #f1f5fb 40%, #f5f8fd 100%);
  color: var(--text);
}

/* Subtle light grid overlay */
html[data-theme="light"] .velocity-body::before {
  background-image:
    linear-gradient(rgba(60, 100, 160, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 100, 160, 0.06) 1px, transparent 1px);
  opacity: 0.35;
}

/* Glass panels → clean white cards */
html[data-theme="light"] .glass-panel {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(100, 140, 185, 0.16);
  backdrop-filter: blur(4px);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 30, 80, 0.07);
}

html[data-theme="light"] .glass-panel:hover {
  border-color: rgba(4, 153, 194, 0.32);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.07),
    0 12px 32px rgba(4, 153, 194, 0.09);
}

html[data-theme="light"] .glass-panel-soft {
  background: rgba(248, 252, 255, 0.98);
  border: 1px solid rgba(100, 140, 185, 0.13);
  backdrop-filter: blur(4px);
}

html[data-theme="light"] .glass-panel-soft:hover {
  border-color: rgba(4, 153, 194, 0.26);
}

/* Sidebar — distinct surface in both modes */
html[data-theme="light"] #app-sidebar > div {
  background: linear-gradient(180deg, #c8daea 0%, #b8cadc 55%, #aec2d6 100%) !important;
  border: 1px solid rgba(100, 150, 200, 0.3) !important;
  box-shadow:
    4px 0 24px rgba(0, 30, 80, 0.1),
    inset -1px 0 0 rgba(80, 130, 180, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
}

/* Hub title gradient — on light soft sidebar, use dark saturated gradient */
html[data-theme="light"] #app-sidebar .hub-title-gradient {
  background: linear-gradient(100deg, #0284c7 0%, #059669 52%, #7c3aed 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
}

html[data-theme="light"] #app-sidebar .brand-font,
html[data-theme="light"] #app-sidebar h1 {
  color: #0c1c2e !important;
}

html[data-theme="light"] #app-sidebar header {
  border-bottom-color: rgba(80, 130, 180, 0.22) !important;
}

html[data-theme="light"] #app-sidebar .sidebar-label,
html[data-theme="light"] #app-sidebar .text-slate-300,
html[data-theme="light"] #app-sidebar .text-slate-400 {
  color: #1e3a56 !important;
}

html[data-theme="light"] #app-sidebar .text-slate-500 {
  color: #2e5070 !important;
}

html[data-theme="light"] #app-sidebar .text-slate-600 {
  color: #3e6080 !important;
}

html[data-theme="light"] #app-sidebar .text-slate-100 {
  color: #0c1c2e !important;
}

html[data-theme="light"] #app-sidebar .border-slate-700\/60,
html[data-theme="light"] #app-sidebar .border-slate-700\/40,
html[data-theme="light"] #app-sidebar .border-slate-700\/50 {
  border-color: rgba(80, 130, 180, 0.22) !important;
}

html[data-theme="light"] #app-sidebar .sidebar-user-profile {
  border-top-color: rgba(80, 130, 180, 0.22) !important;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 12px;
}

html[data-theme="light"] #app-sidebar #sidebar-collapse-btn {
  background: rgba(255, 255, 255, 0.5) !important;
  border-color: rgba(80, 130, 180, 0.3) !important;
  color: #1e3a56 !important;
  box-shadow: 0 2px 8px rgba(0, 30, 80, 0.1) !important;
}

html[data-theme="light"] #app-sidebar #sidebar-collapse-btn:hover {
  color: #0499c2 !important;
}

/* Nav items on light — soft sidebar, dark text */
html[data-theme="light"] #app-sidebar .nav-item .sidebar-label {
  color: #1e3a56 !important;
}

html[data-theme="light"] #app-sidebar .nav-item:hover .sidebar-label {
  color: #0c1c2e !important;
}

html[data-theme="light"] #app-sidebar [class*="hover:bg-slate-8"]:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Settings dropdown */
html[data-theme="light"] #settings-dropdown {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid rgba(100, 140, 185, 0.18) !important;
  box-shadow: 0 8px 24px rgba(0, 30, 80, 0.12) !important;
}

html[data-theme="light"] #settings-dropdown a {
  color: #1e3550 !important;
}

html[data-theme="light"] #settings-dropdown a:hover {
  background: rgba(4, 153, 194, 0.06) !important;
}

/* Top header bar */
html[data-theme="light"] #app-top-header .glass-panel {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(100, 140, 185, 0.16) !important;
}

html[data-theme="light"] #app-top-header .text-slate-400 {
  color: #2e4a65 !important;
}

html[data-theme="light"] #app-top-header .text-slate-100 {
  color: #0c1c2e !important;
}

html[data-theme="light"] #app-top-header .brand-font {
  color: #0c1c2e !important;
}

/* Live Stream badge */
html[data-theme="light"] .glass-panel-soft .pulse-dot {
  box-shadow: 0 0 0 rgba(4, 153, 194, 0.6);
}

/* Page content panels – generic text overrides */
html[data-theme="light"] #page-root .text-slate-100,
html[data-theme="light"] #page-root .text-slate-200 {
  color: #0c1c2e !important;
}

html[data-theme="light"] #page-root .text-slate-300 {
  color: #162d46 !important;
}

html[data-theme="light"] #page-root .text-slate-400 {
  color: #244060 !important;
}

html[data-theme="light"] #page-root .text-slate-500 {
  color: #3e5e7a !important;
}

html[data-theme="light"] #page-root .text-slate-600 {
  color: #557898 !important;
}

/* Panel backgrounds inside page-root */
html[data-theme="light"] #page-root [class*="bg-terminal"],
html[data-theme="light"] #page-root [class*="bg-slate-9"],
html[data-theme="light"] #page-root [class*="bg-slate-8"] {
  background-color: rgba(240, 246, 254, 0.7) !important;
}

html[data-theme="light"] #page-root [class*="bg-slate-800"],
html[data-theme="light"] #page-root [class*="bg-slate-900"] {
  background-color: rgba(235, 243, 254, 0.8) !important;
}

/* Borders inside page-root */
html[data-theme="light"] #page-root [class*="border-slate-7"],
html[data-theme="light"] #page-root [class*="border-slate-6"] {
  border-color: rgba(100, 140, 185, 0.2) !important;
}

/* Table row dividers & outer table borders */
html[data-theme="light"] #page-root [class*="border-slate-8"] {
  border-color: rgba(100, 140, 185, 0.14) !important;
}

/* Table wrapper outer border */
html[data-theme="light"] #page-root .overflow-auto[class*="border"] {
  border-color: rgba(100, 140, 185, 0.16) !important;
}

/* Table header background */
html[data-theme="light"] #page-root [class*="bg-slate-9"] {
  background-color: rgba(235, 242, 252, 0.85) !important;
}

/* Table body / inner dark bg */
html[data-theme="light"] #page-root [class*="bg-slate-95"] {
  background-color: rgba(248, 251, 255, 0.6) !important;
}

/* Table hover rows */
html[data-theme="light"] #page-root [class*="hover:bg-cyan-9"]:hover {
  background-color: rgba(4, 153, 194, 0.05) !important;
}

/* KPI glow variants adapted for light */
html[data-theme="light"] .kpi-card-glow-strong {
  box-shadow:
    0 0 0 1px rgba(4, 153, 194, 0.18),
    0 4px 16px rgba(4, 153, 194, 0.1),
    0 8px 24px rgba(0, 30, 80, 0.08);
}

html[data-theme="light"] .kpi-card-glow-stable {
  box-shadow:
    0 0 0 1px rgba(22, 163, 74, 0.16),
    0 4px 16px rgba(22, 163, 74, 0.08),
    0 8px 24px rgba(0, 30, 80, 0.08);
}

html[data-theme="light"] .kpi-card-glow-watch {
  box-shadow:
    0 0 0 1px rgba(217, 119, 6, 0.18),
    0 4px 16px rgba(217, 119, 6, 0.09),
    0 8px 24px rgba(0, 30, 80, 0.08);
}

/* Force light color-scheme for native browser controls */
html[data-theme="light"] {
  color-scheme: light;
}

/* Sortable table headers */
html[data-theme="light"] .sortable-header {
  color: #2e4a65;
}

html[data-theme="light"] .sortable-header:hover {
  color: #0499c2;
}

/* Input & select fields */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  color: #0c1c2e !important;
  background-color: rgba(248, 252, 255, 0.98) !important;
}

html[data-theme="light"] input[class*="border-slate"],
html[data-theme="light"] select[class*="border-slate"] {
  border-color: rgba(80, 130, 175, 0.4) !important;
}

html[data-theme="light"] input::placeholder {
  color: #7a96b2 !important;
  opacity: 1;
}

/* Nav item borders in sidebar (inline-style override) */
html[data-theme="light"] #app-sidebar .nav-item {
  border-color: rgba(80, 130, 180, 0.26) !important;
  background: rgba(245, 249, 255, 0.6) !important;
}

/* Hover states that use dark slate backgrounds */
html[data-theme="light"] #page-root [class*="hover:bg-slate-8"]:hover,
html[data-theme="light"] #page-root [class*="hover:bg-slate-7"]:hover {
  background-color: rgba(4, 153, 194, 0.05) !important;
}

html[data-theme="light"] #app-sidebar [class*="hover:bg-slate-8"]:hover {
  background-color: rgba(4, 153, 194, 0.06) !important;
}

/* Hardcoded inline style color:#94a3b8 — too light on white */
html[data-theme="light"] [style*="color:#94a3b8"] {
  color: #2e4a65 !important;
}

/* Hardcoded inline style color:#64748b — too light on white */
html[data-theme="light"] [style*="color:#64748b"] {
  color: #3a5c7a !important;
}

/* Silo tone buttons — adjust colors for light backgrounds */
html[data-theme="light"] .silo-launch-btn.tone-sales {
  border-color: rgba(22, 163, 74, 0.45);
  color: #15603a;
}

html[data-theme="light"] .silo-launch-btn.tone-service {
  border-color: rgba(4, 153, 194, 0.45);
  color: #0a5f7a;
}

html[data-theme="light"] .silo-launch-btn.tone-fi {
  border-color: rgba(217, 119, 6, 0.45);
  color: #7c4200;
}

html[data-theme="light"] .silo-launch-btn.tone-acq {
  border-color: rgba(120, 60, 240, 0.4);
  color: #5b21b6;
}

html[data-theme="light"] .silo-launch-btn.tone-parts {
  border-color: rgba(37, 99, 235, 0.4);
  color: #1e3fa8;
}

/* Loading overlay (beginPageLoad) */
html[data-theme="light"] .page-skeleton-overlay {
  background:
    linear-gradient(140deg, rgba(224, 236, 252, 0.97), rgba(235, 245, 255, 0.95)),
    radial-gradient(600px 280px at 10% 0%, rgba(4, 153, 194, 0.06), transparent 58%);
}

/* Skeleton shimmer adapted */
html[data-theme="light"] .skeleton-card {
  background: rgba(230, 240, 252, 0.9);
  border-color: rgba(100, 140, 185, 0.18);
}

html[data-theme="light"] .skeleton-line {
  background: linear-gradient(
    90deg,
    rgba(170, 200, 230, 0.3),
    rgba(200, 225, 248, 0.7),
    rgba(170, 200, 230, 0.3)
  );
}

/* bg-slate-700/* badge chips inside page-root */
html[data-theme="light"] #page-root [class*="bg-slate-7"] {
  background-color: rgba(220, 233, 248, 0.8) !important;
}

/* Page navigation overlay */
html[data-theme="light"] body.page-nav-entering::after,
html[data-theme="light"] body.page-nav-exiting::after {
  background:
    radial-gradient(700px 300px at 50% 10%, rgba(4, 153, 194, 0.08), transparent 70%),
    linear-gradient(180deg, rgba(241, 245, 251, 0.4), rgba(241, 245, 251, 0.8));
}

/* Silo buttons */
html[data-theme="light"] .silo-launch-btn {
  background: rgba(240, 246, 255, 0.9);
  border-color: rgba(100, 140, 185, 0.28);
  color: #1e3550;
}

html[data-theme="light"] .silo-launch-btn:hover {
  box-shadow: 0 6px 16px rgba(0, 30, 80, 0.1);
}

/* Store timeline */
html[data-theme="light"] .store-timeline-item::before {
  background: #0499c2;
  box-shadow: 0 0 8px rgba(4, 153, 194, 0.35);
}

html[data-theme="light"] .store-timeline-item::after {
  background: linear-gradient(180deg, rgba(4, 153, 194, 0.3), rgba(4, 153, 194, 0.02));
}

/* Scrollbar */
html[data-theme="light"] .data-scrollbar {
  scrollbar-color: rgba(100, 150, 200, 0.5) transparent;
}

html[data-theme="light"] .data-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(100, 150, 200, 0.5);
}

/* Enterprise Hub title gradient */
.hub-title-gradient {
  background: linear-gradient(105deg, #38d9f5 0%, #7ef0a8 38%, #c4b5fd 72%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
/* Dark mode sidebar: cancel gradient, let text-slate-100 color show */
html:not([data-theme="light"]) #app-sidebar .hub-title-gradient {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  color: inherit !important;
}
html[data-theme="light"] .hub-title-gradient {
  background: linear-gradient(100deg, #0284c7 0%, #059669 52%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* AI Copilot FAB */
html[data-theme="light"] .ai-copilot-fab {
  background: linear-gradient(135deg, #e2f2fc 0%, #cce6f8 100%);
  border-color: rgba(4, 153, 194, 0.45);
  color: #1a4a6e;
  box-shadow:
    0 0 0 1px rgba(4, 153, 194, 0.12),
    0 0 18px rgba(4, 153, 194, 0.14),
    0 6px 20px rgba(0, 50, 120, 0.12);
}

html[data-theme="light"] .ai-fab-label {
  color: #1a4a6e;
}

html[data-theme="light"] .ai-fab-badge {
  border-color: #e2f2fc;
}

html[data-theme="light"] .ai-copilot-fab:hover {
  box-shadow:
    0 0 0 1px rgba(4, 153, 194, 0.22),
    0 0 26px rgba(4, 153, 194, 0.22),
    0 8px 24px rgba(0, 50, 120, 0.16);
}

html[data-theme="light"] .ai-fab-pulse {
  border-color: rgba(4, 153, 194, 0.30);
}

/* AI Copilot panel */
html[data-theme="light"] .ai-copilot-panel {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(100, 140, 185, 0.24);
  box-shadow: 0 12px 40px rgba(0, 30, 80, 0.14);
}

html[data-theme="light"] .ai-copilot-header {
  background: linear-gradient(120deg, rgba(4, 153, 194, 0.06), rgba(22, 163, 74, 0.02));
  border-bottom-color: rgba(100, 140, 185, 0.18);
}

html[data-theme="light"] .ai-icon-btn {
  background: rgba(240, 246, 255, 0.9);
  border-color: rgba(100, 140, 185, 0.28);
  color: #1e3550;
}

html[data-theme="light"] .ai-chip-button {
  background: rgba(240, 246, 255, 0.9);
  border-color: rgba(100, 140, 185, 0.32);
  color: #1e3550;
}

html[data-theme="light"] .ai-chip-button:hover {
  border-color: rgba(4, 153, 194, 0.5);
  color: #0499c2;
}

html[data-theme="light"] .ai-msg.ai {
  background: rgba(240, 246, 255, 0.9);
  border-color: rgba(100, 140, 185, 0.22);
}

html[data-theme="light"] .ai-msg.user {
  background: rgba(4, 153, 194, 0.1);
  border-color: rgba(4, 153, 194, 0.22);
}

html[data-theme="light"] .ai-msg-title {
  color: #0c1c2e;
}

html[data-theme="light"] .ai-msg-text {
  color: #1e3550;
}

html[data-theme="light"] .ai-msg-list {
  color: #3a5070;
}

html[data-theme="light"] .ai-msg-time {
  color: #7a96b2;
}

html[data-theme="light"] .ai-dependency-card,
html[data-theme="light"] .ai-reco-card {
  background: rgba(240, 246, 255, 0.9);
  border-color: rgba(100, 140, 185, 0.22);
}

html[data-theme="light"] .ai-thinking {
  background: rgba(240, 246, 255, 0.9);
  border-color: rgba(100, 140, 185, 0.22);
}

html[data-theme="light"] .ai-copilot-footer {
  background: rgba(247, 251, 255, 0.98);
  border-top-color: rgba(100, 140, 185, 0.18);
}

html[data-theme="light"] .ai-input {
  background: rgba(248, 252, 255, 0.98);
  border-color: rgba(100, 140, 185, 0.28);
  color: #0c1c2e;
}

html[data-theme="light"] .ai-input:focus {
  border-color: rgba(4, 153, 194, 0.55);
}

html[data-theme="light"] .ai-send-btn {
  background: rgba(4, 153, 194, 0.12);
  border-color: rgba(4, 153, 194, 0.4);
  color: #0499c2;
}

/* Darken slate-400 muted labels in light mode */
html[data-theme="light"] .text-slate-400 {
  color: #475569 !important; /* slate-600 */
}

/* Executive storyline light adaptation */
html[data-theme="light"] .exec-storyline::before {
  background: radial-gradient(50% 100% at 50% 0%, rgba(4, 153, 194, 0.08), transparent 70%);
}

/* KPI executive card shimmer */
html[data-theme="light"] .kpi-executive-card::after {
  background: linear-gradient(125deg, rgba(4, 153, 194, 0.09), rgba(22, 163, 74, 0.02) 58%);
  opacity: 1;
}

/* Executive KPI cards — light mode: tinted bg + lift-on-hover (matches parts-kpi-card feel) */
html[data-theme="light"] .glass-panel.kpi-executive-card {
  background: linear-gradient(140deg, rgba(232, 246, 255, 0.98) 0%, rgba(244, 251, 255, 0.97) 100%);
  border-color: rgba(100, 140, 185, 0.22);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

html[data-theme="light"] .glass-panel.kpi-executive-card:hover {
  transform: translateY(-2px);
  border-color: rgba(4, 153, 194, 0.42) !important;
  box-shadow:
    0 0 0 1px rgba(4, 153, 194, 0.16),
    0 8px 22px rgba(4, 153, 194, 0.12),
    0 14px 32px rgba(0, 30, 80, 0.09) !important;
}

/* Leaderboard signal colors — remap for readability on light backgrounds */
html[data-theme="light"] #leaderboard-body .text-signal-lime {
  color: #15803d !important;
}
html[data-theme="light"] #leaderboard-body .text-signal-amber {
  color: #b45309 !important;
}
html[data-theme="light"] #leaderboard-body .text-signal-red {
  color: #dc2626 !important;
}

/* Pulse ring on light */
html[data-theme="light"] .pulse-dot {
  box-shadow: 0 0 0 rgba(4, 153, 194, 0.6);
}

@keyframes pulse-ring-light {
  0% { box-shadow: 0 0 0 0 rgba(4, 153, 194, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(4, 153, 194, 0); }
  100% { box-shadow: 0 0 0 0 rgba(4, 153, 194, 0); }
}

html[data-theme="light"] .pulse-dot {
  animation: pulse-ring-light 2s infinite;
}

/* ── Theme Toggle Button ──────────────────────────────── */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(90, 117, 148, 0.24);
  background: rgba(16, 28, 42, 0.45);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  text-align: left;
}

.theme-toggle-btn:hover {
  border-color: rgba(53, 212, 255, 0.38);
  background: rgba(53, 212, 255, 0.06);
}

.theme-toggle-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: rgba(53, 212, 255, 0.18);
  border: 1px solid rgba(53, 212, 255, 0.35);
  flex-shrink: 0;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.theme-toggle-thumb {
  position: absolute;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #35d4ff;
  box-shadow: 0 1px 4px rgba(53, 212, 255, 0.4);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, box-shadow 0.3s ease;
}

html[data-theme="light"] .theme-toggle-track {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
}

html[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(16px);
  background: #f59e0b;
  box-shadow: 0 1px 6px rgba(245, 158, 11, 0.5);
}

html[data-theme="light"] .theme-toggle-btn {
  border-color: rgba(80, 130, 180, 0.28);
  background: rgba(255, 255, 255, 0.28);
}

html[data-theme="light"] .theme-toggle-btn:hover {
  border-color: rgba(4, 153, 194, 0.45);
  background: rgba(255, 255, 255, 0.38);
}

html[data-theme="light"] .theme-toggle-label {
  color: #1e3a56 !important;
}

html[data-theme="light"] .theme-toggle-icon {
  color: #c97000 !important;
}

.theme-toggle-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #9db1c8;
  transition: color 0.2s ease;
}

.theme-toggle-icon {
  color: #7ab8d4;
  transition: color 0.2s ease;
}

/* Collapsed sidebar hides toggle label/icon — desktop only */
@media (min-width: 1024px) {
  body.sidebar-collapsed #app-sidebar .theme-toggle-btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    background: transparent;
    border-color: transparent;
  }

  body.sidebar-collapsed #app-sidebar .theme-toggle-label,
  body.sidebar-collapsed #app-sidebar .theme-toggle-icon {
    display: none;
  }

  body.sidebar-collapsed #app-sidebar .theme-toggle-track {
    width: 28px;
    height: 16px;
  }

  body.sidebar-collapsed #app-sidebar .theme-toggle-thumb {
    width: 12px;
    height: 12px;
  }

  html[data-theme="light"] body.sidebar-collapsed #app-sidebar .theme-toggle-thumb {
    transform: translateX(12px);
  }
}

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME — Page-specific overrides
   About · Data Fabric · Technical · AI Copilot
   ══════════════════════════════════════════════════════════════ */

/* ── Shared: hardcoded inline text colors used across pages ── */
html[data-theme="light"] [style*="color:#deebfa"] { color: #0c1c2e !important; }
html[data-theme="light"] [style*="color:#cbd5e1"] { color: #162d46 !important; }

/* ──────────────────────────────────────────────────────────
   ABOUT PAGE  (#ab-root)
   ────────────────────────────────────────────────────────── */

/* Root text color (inline style="color:#deebfa" on #ab-root) */
html[data-theme="light"] #ab-root {
  color: #0c1c2e !important;
}

/* All white text in about-page → dark (headings, card labels) */
html[data-theme="light"] #ab-root [style*="color:#fff"] {
  color: #0c1c2e !important;
}

/* About glass cards → clean white */
html[data-theme="light"] .ab-glass {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(100, 140, 185, 0.2) !important;
  backdrop-filter: blur(4px) !important;
  box-shadow:
    0 2px 8px rgba(0, 30, 80, 0.06),
    0 8px 24px rgba(0, 30, 80, 0.05) !important;
}

html[data-theme="light"] .ab-glass-soft {
  background: rgba(248, 252, 255, 0.98) !important;
  border-color: rgba(100, 140, 185, 0.16) !important;
  backdrop-filter: blur(4px) !important;
}

/* Hover on glass cards */
html[data-theme="light"] .ab-hover:hover {
  border-color: rgba(4, 153, 194, 0.42) !important;
  box-shadow:
    0 0 0 1px rgba(4, 153, 194, 0.1),
    0 16px 36px rgba(0, 30, 80, 0.1) !important;
}

/* Hero section background */
html[data-theme="light"] #ab-hero {
  background:
    radial-gradient(ellipse 900px 600px at 20% 50%, rgba(4, 153, 194, 0.07), transparent 70%),
    radial-gradient(ellipse 700px 500px at 80% 30%, rgba(22, 163, 74, 0.04), transparent 70%),
    linear-gradient(180deg, #deeefa, #e8f4fd 60%, #f0f7fb) !important;
}

/* Hero h1 gradient — #fff would vanish on light bg */
html[data-theme="light"] #ab-hero h1 {
  background: linear-gradient(135deg, #0c1c2e 0%, #0499c2 55%, #16a34a 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

/* Grid overlay — lighter lines */
html[data-theme="light"] .ab-grid-overlay {
  background-image:
    linear-gradient(rgba(60, 100, 160, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 100, 160, 0.06) 1px, transparent 1px) !important;
}

/* CTA button */
html[data-theme="light"] .ab-cta {
  background: linear-gradient(135deg, rgba(4, 153, 194, 0.12), rgba(22, 163, 74, 0.07)) !important;
  border-color: rgba(4, 153, 194, 0.5) !important;
  color: #0499c2 !important;
}
html[data-theme="light"] .ab-cta:hover {
  border-color: rgba(4, 153, 194, 0.75) !important;
  box-shadow: 0 0 18px rgba(4, 153, 194, 0.2) !important;
}

/* Badge accents — keep them bright, just lighter bg */
html[data-theme="light"] .ab-badge {
  background: rgba(4, 153, 194, 0.08) !important;
  border-color: rgba(4, 153, 194, 0.3) !important;
}

/* Architecture step connector */
html[data-theme="light"] .ab-arch-step::after {
  background: linear-gradient(to bottom, rgba(4, 153, 194, 0.35), rgba(4, 153, 194, 0.02));
}

/* AI card hover */
html[data-theme="light"] .ab-ai-card:hover {
  border-color: rgba(4, 153, 194, 0.45) !important;
}

/* ──────────────────────────────────────────────────────────
   DATA FABRIC PAGE  (#fab-root)
   ────────────────────────────────────────────────────────── */

/* Tooltip overlays */
html[data-theme="light"] #fab-tooltip,
html[data-theme="light"] #mch-tooltip {
  background: rgba(255, 255, 255, 0.98) !important;
  border-color: rgba(100, 140, 185, 0.3) !important;
  box-shadow: 0 8px 28px rgba(0, 30, 80, 0.14) !important;
  color: #0c1c2e !important;
}

/* Canvas container — give it a light bg so edges look clean */
html[data-theme="light"] #fab-canvas-wrap {
  background: rgba(240, 246, 255, 0.5);
}

/* Stage pips separator */
html[data-theme="light"] .fab-stage-pip {
  border-right-color: rgba(100, 140, 185, 0.18) !important;
}

/* Inline tooltip backgrounds used by JS (rgba dark) */
html[data-theme="light"] [style*="background:rgba(2,5,15"],
html[data-theme="light"] [style*="background:rgba(2, 5, 15"] {
  background: rgba(255, 255, 255, 0.98) !important;
  color: #0c1c2e !important;
  border-color: rgba(100, 140, 185, 0.28) !important;
  box-shadow: 0 8px 24px rgba(0, 30, 80, 0.12) !important;
}

/* ──────────────────────────────────────────────────────────
   TECHNICAL PAGE  (#technical-root)
   ────────────────────────────────────────────────────────── */

/* Ingestion tooltip */
html[data-theme="light"] .ing-tooltip {
  background: rgba(255, 255, 255, 0.98) !important;
  border-color: rgba(4, 153, 194, 0.3) !important;
  box-shadow: 0 12px 36px rgba(0, 30, 80, 0.14) !important;
  color: #0c1c2e !important;
}

/* CDM domain tooltip */
html[data-theme="light"] .cdm-domain-tooltip {
  background: rgba(255, 255, 255, 0.98) !important;
  border-color: rgba(4, 153, 194, 0.28) !important;
  box-shadow: 0 12px 36px rgba(0, 30, 80, 0.14) !important;
  color: #0c1c2e !important;
}

/* Lineage tray (fixed bottom panel) */
html[data-theme="light"] .hub-lineage-tray {
  background: rgba(255, 255, 255, 0.98) !important;
  border-top-color: rgba(100, 140, 185, 0.2) !important;
  box-shadow: 0 -4px 24px rgba(0, 30, 80, 0.08) !important;
  color: #0c1c2e !important;
}

/* Animated dot grid in background */
html[data-theme="light"] #hub-grid-layer {
  background-image:
    radial-gradient(circle, rgba(4, 153, 194, 0.05) 1px, transparent 1px),
    radial-gradient(circle, rgba(22, 163, 74, 0.03) 1px, transparent 1px) !important;
}

/* Inline tooltip backgrounds from technical page JS */
html[data-theme="light"] [style*="background:rgba(4,8,18"],
html[data-theme="light"] [style*="background:rgba(6,12,20"],
html[data-theme="light"] [style*="background:rgba(4, 8, 18"],
html[data-theme="light"] [style*="background:rgba(6, 12, 20"] {
  background: rgba(255, 255, 255, 0.98) !important;
  color: #0c1c2e !important;
  border-color: rgba(100, 140, 185, 0.25) !important;
  box-shadow: 0 8px 24px rgba(0, 30, 80, 0.12) !important;
}

/* Source category groups */
html[data-theme="light"] .src-cat-group {
  border-color: rgba(100, 140, 185, 0.2) !important;
}

/* ──────────────────────────────────────────────────────────
   AI COPILOT — extra text overrides
   ────────────────────────────────────────────────────────── */

/* Header text using Tailwind classes */
html[data-theme="light"] .ai-copilot-header .text-slate-400 {
  color: #3e5e7a !important;
}

html[data-theme="light"] .ai-copilot-header .text-slate-100 {
  color: #0c1c2e !important;
}

html[data-theme="light"] .ai-copilot-header .text-slate-300 {
  color: #244060 !important;
}

/* Body section headings */
html[data-theme="light"] .ai-copilot-body .text-slate-400 {
  color: #3e5e7a !important;
}

/* ──────────────────────────────────────────────────────────
   STORE DASHBOARD — Silos Operation Details bar
   ────────────────────────────────────────────────────────── */

/* Main bar background */
html[data-theme="light"] .store-silo-launch {
  background: rgba(255, 255, 255, 0.88) !important;
  border-color: rgba(100, 140, 185, 0.22) !important;
  box-shadow: 0 1px 6px rgba(0, 30, 80, 0.05) !important;
}

/* Vertical separator between label and buttons */
html[data-theme="light"] .store-silo-launch .bg-slate-700\/60 {
  background-color: rgba(100, 140, 185, 0.35) !important;
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE — Text tone-down
   Softens near-pure-white Tailwind text classes so they don't
   cause eye strain on the deep dark backgrounds.
   These rules are scoped to dark mode only via :not([data-theme="light"]).
   The light-mode html[data-theme="light"] overrides retain full priority.
   ══════════════════════════════════════════════════════════════ */

/* Pure white → soft blue-white */
html:not([data-theme="light"]) .text-white {
  color: #d6eaf8 !important;
}

/* slate-100 (#f1f5f9 ≈ 95% brightness) → readable blue-white */
html:not([data-theme="light"]) .text-slate-100 {
  color: #c4d8eb !important;
}

/* slate-200 (#e2e8f0 ≈ 90% brightness) → softer mid tone */
html:not([data-theme="light"]) .text-slate-200 {
  color: #a8bfd4 !important;
}

/* slate-300 (#cbd5e1 ≈ 83% brightness) → align with --text-soft variable */
html:not([data-theme="light"]) .text-slate-300 {
  color: #96afc6 !important;
}

/* ── Dark mode sidebar — deepest anchor surface, clearly darker than body panels ── */
#app-sidebar > div {
  background: linear-gradient(180deg, #071320 0%, #050e18 55%, #040b14 100%) !important;
  border-color: rgba(25, 60, 125, 0.52) !important;
  box-shadow:
    inset 0 1px 0 rgba(53, 212, 255, 0.04),
    inset -1px 0 0 rgba(53, 212, 255, 0.07),
    4px 0 40px rgba(0, 0, 0, 0.72) !important;
  backdrop-filter: blur(0) !important;
}

/* ═══════════════════════════════════════════════════════════════
   KPI Detail Panel — right-side slide-in (2/3 screen width)
   ═══════════════════════════════════════════════════════════════ */

/* Clickable KPI cards */
.kpi-card--clickable {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card--clickable:hover {
  border-color: rgba(53, 212, 255, 0.35) !important;
  box-shadow: 0 0 0 1px rgba(53, 212, 255, 0.15), 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}
.kpi-card--clickable:focus-visible {
  outline: 2px solid rgba(53, 212, 255, 0.6);
  outline-offset: 2px;
}
.kpi-card-detail-hint {
  border-top: 1px solid rgba(62, 105, 168, 0.22);
  opacity: 0.7;
  transition: opacity 0.2s;
}
.kpi-card--clickable:hover .kpi-card-detail-hint {
  opacity: 1;
}

/* Backdrop */
#kpi-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Panel shell */
#kpi-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 66.666%;
  min-width: 360px;
  height: 100%;
  z-index: 60;
  background: linear-gradient(180deg, #071320 0%, #050e18 55%, #040b14 100%);
  border-left: 1px solid rgba(62, 105, 168, 0.35);
  box-shadow: -12px 0 56px rgba(0, 8, 24, 0.75);
  will-change: transform;
  overflow: hidden;
}
@media (max-width: 767px) {
  #kpi-detail-panel { width: 96%; min-width: 0; }
}

/* Header divider */
.kpi-panel-header {
  border-bottom: 1px solid rgba(62, 105, 168, 0.28);
}

/* Internal dividers */
.kpi-panel-divider {
  border-color: rgba(62, 105, 168, 0.22);
}
.kpi-panel-row-border {
  border-bottom: 1px solid rgba(62, 105, 168, 0.18);
}

/* Progress track */
.kpi-panel-progress-track {
  background: rgba(30, 60, 110, 0.4);
}

/* Insight cards */
.kpi-panel-insight {
  background: rgba(10, 24, 44, 0.5);
  border: 1px solid transparent;
}
.kpi-panel-insight--positive {
  border-color: rgba(53, 212, 255, 0.35);
  color: #35d4ff;
}
.kpi-panel-insight--watch {
  border-color: rgba(255, 176, 32, 0.35);
  color: #ffb020;
}
.kpi-panel-insight--info {
  border-color: rgba(100, 130, 180, 0.3);
  color: #94a3b8;
}

/* Light mode overrides */
html[data-theme="light"] #kpi-detail-panel {
  background: linear-gradient(180deg, #dce8f5 0%, #ccd8e8 55%, #c0d2e4 100%);
  border-left-color: rgba(100, 150, 200, 0.35);
  box-shadow: -12px 0 48px rgba(0, 30, 80, 0.2);
}

/* ── Light mode: force readable dark-navy text throughout the panel ── */
/* Override slate utility classes that are near-white in light mode */
html[data-theme="light"] #kpi-detail-panel .text-slate-100,
html[data-theme="light"] #kpi-detail-panel h2,
html[data-theme="light"] #kpi-detail-panel #kpi-panel-value,
html[data-theme="light"] #kpi-detail-panel #kpi-panel-target {
  color: #0d2b4e !important;
}
html[data-theme="light"] #kpi-detail-panel .text-slate-200 {
  color: #1a3d65 !important;
}
html[data-theme="light"] #kpi-detail-panel .text-slate-300 {
  color: #2d5280 !important;
}
html[data-theme="light"] #kpi-detail-panel .text-slate-400 {
  color: #486d8c !important;
}
html[data-theme="light"] #kpi-detail-panel .text-slate-500 {
  color: #6a8aa4 !important;
}

/* Section heading caps (uppercase tracking labels) */
html[data-theme="light"] #kpi-detail-panel h3 {
  color: #486d8c !important;
}

/* Insight boxes — remap neon colors to dark, readable equivalents */
html[data-theme="light"] #kpi-detail-panel .kpi-panel-insight--positive {
  color: #006b99 !important;
  border-color: rgba(0, 107, 153, 0.35) !important;
  background: rgba(195, 228, 245, 0.55) !important;
}
html[data-theme="light"] #kpi-detail-panel .kpi-panel-insight--watch {
  color: #7a4e00 !important;
  border-color: rgba(122, 78, 0, 0.35) !important;
  background: rgba(248, 235, 200, 0.6) !important;
}
html[data-theme="light"] #kpi-detail-panel .kpi-panel-insight--info {
  color: #2d5070 !important;
  border-color: rgba(45, 80, 112, 0.35) !important;
  background: rgba(205, 222, 238, 0.55) !important;
}

/* Insight icon and text inherit the parent color */
html[data-theme="light"] #kpi-detail-panel .kpi-panel-insight p,
html[data-theme="light"] #kpi-detail-panel .kpi-panel-insight i[data-lucide] {
  color: inherit !important;
}

/* Close button */
html[data-theme="light"] #kpi-panel-close {
  color: #486d8c;
}
html[data-theme="light"] #kpi-panel-close:hover {
  color: #0d2b4e;
}
html[data-theme="light"] .kpi-panel-header {
  border-bottom-color: rgba(100, 150, 200, 0.3);
}
html[data-theme="light"] .kpi-panel-divider {
  border-color: rgba(100, 150, 200, 0.25);
}
html[data-theme="light"] .kpi-panel-row-border {
  border-bottom-color: rgba(100, 150, 200, 0.2);
}
html[data-theme="light"] .kpi-panel-progress-track {
  background: rgba(100, 150, 200, 0.2);
}
html[data-theme="light"] .kpi-panel-insight {
  background: rgba(200, 218, 234, 0.5);
}
html[data-theme="light"] .kpi-card--clickable:hover {
  border-color: rgba(30, 100, 180, 0.4) !important;
  box-shadow: 0 0 0 1px rgba(30, 100, 180, 0.15), 0 8px 24px rgba(0, 30, 80, 0.15) !important;
}
