/* Business-health Dashboard — Classic / Mission / City / Factory — Safari & touch first */

.sci-dash-page {
  --dash-chrome-estimate: 120px;
  --dash-accent: var(--accent2, #4f8ef7);
  --dash-accent-muted: var(--accent-light, #7fb0ff);
  --dash-highlight: var(--accent, #5fd7a3);
  --dash-surface: color-mix(in srgb, var(--bg0, #060b1a) 78%, transparent);
  --dash-surface-raised: color-mix(in srgb, var(--panel, #0d1730) 90%, transparent);
  --dash-panel: color-mix(in srgb, var(--panel, #0d1730) 82%, transparent);
  position: relative;
  margin: -8px -4px 0;
  min-height: calc(var(--sci-app-h, 100dvh) - 88px - var(--sci-safe-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: max(4px, var(--sci-safe-bottom, 0px));
}

/* Full-bleed canvas: chrome floats over the stage */
.sci-dash-page--canvas-fill {
  gap: 0;
  padding-bottom: 0;
  margin-bottom: calc(-1 * var(--sci-safe-bottom, 0px));
}

.sci-dash-page--canvas-fill .sci-dash-page__stage-wrap {
  flex: 1 1 auto;
  min-height: calc(var(--sci-app-h, 100dvh) - 88px - var(--sci-safe-bottom, 0px));
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.sci-dash-page__chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 0 4px;
  z-index: 2;
}

.sci-dash-page__chrome--overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  padding: 12px 14px 18px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg0, #060b1a) 88%, transparent) 0%,
    color-mix(in srgb, var(--bg0, #060b1a) 42%, transparent) 62%,
    transparent 100%
  );
}

.sci-dash-page__chrome--overlay .sci-dash-page__controls,
.sci-dash-page__chrome--overlay .sci-dash-page__window {
  pointer-events: auto;
}

.sci-dash-page__viz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sci-dash-page__viz > * {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.sci-dash-page__alert {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9;
  margin: 0 !important;
}

.sci-dash-page__title {
  font-size: clamp(1.25rem, 2.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text, #e7ecff);
  line-height: 1.15;
}

.sci-dash-page__sub {
  color: var(--muted, #a9b3d1);
  font-size: 0.82rem;
  margin-top: 4px;
  max-width: 52ch;
}

.sci-dash-page__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sci-dash-page__window {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--dash-surface-raised);
  border: 1px solid var(--border, #1e2c52);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sci-dash-page__window > .subtle {
  color: var(--muted, #93a5cc);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

.sci-dash-page__window .sci-select {
  width: 100%;
}

.sci-dash-page__window .sci-select input {
  background-color: var(--sci-input-bg, #0a1330) !important;
  border-color: var(--border, #1e2c52) !important;
  min-height: 36px !important;
  border-radius: 9px !important;
}

.sci-dash-page__window .sci-select input:hover {
  border-color: color-mix(in srgb, var(--dash-accent) 45%, var(--border, #1e2c52)) !important;
}

.sci-dash-page__window .sci-select input:focus,
.sci-dash-page__window .sci-select input:focus-visible {
  border-color: var(--dash-accent) !important;
  box-shadow: 0 0 0 3px var(--sci-focus-ring, rgba(79, 142, 247, 0.18)) !important;
}

.sci-dash-page--city .sci-dash-page__window,
.sci-dash-page--block .sci-dash-page__window {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(30, 80, 120, 0.2);
  box-shadow: 0 8px 20px rgba(40, 90, 130, 0.12);
}

.sci-dash-page--city .sci-dash-page__window > .subtle,
.sci-dash-page--block .sci-dash-page__window > .subtle {
  color: rgba(40, 70, 100, 0.75);
}

.sci-dash-page--city .sci-dash-page__window .sci-select input,
.sci-dash-page--block .sci-dash-page__window .sci-select input {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(45, 125, 255, 0.28) !important;
  color: #1a2a3a !important;
}

.sci-dash-page__stage-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: min(62vh, 640px);
  border-radius: calc(var(--radius, 14px) + 4px);
  overflow: hidden;
  border: 1px solid var(--border, rgba(231, 236, 255, 0.1));
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, var(--sci-glow-a, rgba(79, 142, 247, 0.22)), transparent 60%),
    radial-gradient(ellipse 55% 45% at 70% 70%, var(--sci-glow-b, rgba(16, 33, 79, 0.55)), transparent 55%),
    linear-gradient(160deg, var(--bg0, #060b1a) 0%, var(--bg1, #0d1730) 55%, var(--panel-2, #111d40) 100%);
  box-shadow: var(--shadow, 0 18px 50px rgba(0, 0, 0, 0.45));
}

.sci-dash-page--canvas-fill .sci-dash-page__stage-wrap .cube-loading,
.sci-dash-page--canvas-fill .sci-dash-page__stage-wrap .cube-loading-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* City Map + City Block: daylight atlas (Mission / Classic keep the dark stage) */
.sci-dash-page--city .sci-dash-page__chrome--overlay,
.sci-dash-page--block .sci-dash-page__chrome--overlay {
  background: linear-gradient(
    180deg,
    rgba(158, 201, 239, 0.92) 0%,
    rgba(197, 228, 247, 0.55) 58%,
    transparent 100%
  );
}

.sci-dash-page--city .sci-dash-page__chrome--overlay .sci-dash-page__title,
.sci-dash-page--block .sci-dash-page__chrome--overlay .sci-dash-page__title {
  color: #1c2a3a;
}

.sci-dash-page--city .sci-dash-page__chrome--overlay .sci-dash-page__sub,
.sci-dash-page--block .sci-dash-page__chrome--overlay .sci-dash-page__sub {
  color: #5a6d82;
}

.sci-dash-page--city .sci-dash-scene__signal,
.sci-dash-page--city .sci-dash-station-chips,
.sci-dash-page--city .sci-dash-city__sheet,
.sci-dash-page--block .sci-dash-scene__signal,
.sci-dash-page--block .sci-dash-station-chips,
.sci-dash-page--block .sci-dash-city__sheet {
  background: color-mix(in srgb, #ffffff 82%, transparent);
  border-color: rgba(40, 70, 110, 0.14);
  color: #1c2a3a;
  box-shadow: 0 8px 24px rgba(40, 70, 110, 0.12);
}

.sci-dash-page--city .sci-dash-scene__signal-label,
.sci-dash-page--city .sci-dash-scene__signal-rates strong,
.sci-dash-page--city .sci-dash-city__sheet-title,
.sci-dash-page--city .sci-dash-scene__metric strong,
.sci-dash-page--city .sci-dash-funnel__meta strong,
.sci-dash-page--block .sci-dash-scene__signal-label,
.sci-dash-page--block .sci-dash-scene__signal-rates strong,
.sci-dash-page--block .sci-dash-city__sheet-title,
.sci-dash-page--block .sci-dash-scene__metric strong,
.sci-dash-page--block .sci-dash-funnel__meta strong {
  color: #1c2a3a;
}

.sci-dash-page--city .sci-dash-scene__signal-sub,
.sci-dash-page--city .sci-dash-scene__signal-rates span,
.sci-dash-page--city .sci-dash-scene__metric span,
.sci-dash-page--city .sci-dash-funnel__meta span,
.sci-dash-page--city .sci-dash-city__sheet-hint,
.sci-dash-page--city .sci-dash-city__hint,
.sci-dash-page--block .sci-dash-scene__signal-sub,
.sci-dash-page--block .sci-dash-scene__signal-rates span,
.sci-dash-page--block .sci-dash-scene__metric span,
.sci-dash-page--block .sci-dash-funnel__meta span,
.sci-dash-page--block .sci-dash-city__sheet-hint,
.sci-dash-page--block .sci-dash-city__hint {
  color: #5a6d82;
}

.sci-dash-page--city .sci-dash-station-chips__btn,
.sci-dash-page--block .sci-dash-station-chips__btn {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(40, 70, 110, 0.18);
  color: #1c2a3a;
}

.sci-dash-page--city .sci-dash-station-chips__btn.is-active,
.sci-dash-page--block .sci-dash-station-chips__btn.is-active {
  background: color-mix(in srgb, var(--ring, #3cb371) 28%, #fff);
  border-color: var(--ring, #3cb371);
}

.sci-dash-page--city .sci-dash-city__sheet-close,
.sci-dash-page--block .sci-dash-city__sheet-close {
  border-color: rgba(40, 70, 110, 0.2);
  color: #1c2a3a;
}

.sci-dash-page--city .sci-dash-city__cta,
.sci-dash-page--block .sci-dash-city__cta {
  color: #0b3d2a;
  background: #5fd08a;
}

.sci-dash-page--city .sci-dash-glance,
.sci-dash-page--block .sci-dash-glance {
  color: #1c2a3a;
}

.sci-dash-page--city .sci-dash-glance__rates span,
.sci-dash-page--block .sci-dash-glance__rates span {
  color: #5a6d82;
}

.sci-dash-page--city .sci-dash-glance__rates strong,
.sci-dash-page--block .sci-dash-glance__rates strong {
  color: #1c2a3a;
}

.sci-dash-scene,
.sci-dash-mission,
.sci-dash-city {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: min(62vh, 640px);
}

.sci-dash-scene__stage,
.sci-dash-mission__stage,
.sci-dash-city__stage {
  position: absolute;
  inset: 0;
}

.sci-dash-scene__stage canvas,
.sci-dash-mission__stage canvas,
.sci-dash-city__stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

.sci-dash-scene__signal {
  position: absolute;
  top: max(12px, var(--sci-safe-top, 0px));
  left: 12px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--dash-surface);
  border: 1px solid var(--border, rgba(231, 236, 255, 0.12));
  backdrop-filter: blur(10px);
  max-width: min(100% - 24px, 520px);
  pointer-events: none;
}

.sci-dash-scene__signal-score {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.03em;
}

.sci-dash-scene__signal-label {
  font-weight: 650;
  color: var(--text, #e7ecff);
  font-size: 0.95rem;
}

.sci-dash-scene__signal-sub {
  color: var(--muted, #a9b3d1);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sci-dash-scene__signal-rates {
  display: flex;
  gap: 14px;
  margin-left: 4px;
}

.sci-dash-scene__signal-rates div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sci-dash-scene__signal-rates span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #a9b3d1);
}

.sci-dash-scene__signal-rates strong {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--text, #e7ecff);
}

/* Desktop: chips float above bottom; sheet is side dock */
.sci-dash-station-chips {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 6px;
  border-radius: 999px;
  background: var(--dash-surface);
  border: 1px solid var(--border, rgba(231, 236, 255, 0.1));
  backdrop-filter: blur(10px);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sci-dash-station-chips__btn {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--ring, var(--dash-accent)) 45%, transparent);
  background: transparent;
  color: var(--text, #e7ecff);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sci-dash-station-chips__btn.is-active {
  background: color-mix(in srgb, var(--ring, var(--dash-accent)) 24%, transparent);
  border-color: var(--ring, var(--dash-accent));
}

.sci-dash-scene__panel,
.sci-dash-dock,
.sci-dash-city__sheet {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 72px;
  width: min(300px, calc(100% - 32px));
  z-index: 3;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--dash-panel);
  border: 1px solid var(--border, rgba(231, 236, 255, 0.12));
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

.sci-dash-scene__panel.is-open,
.sci-dash-dock.is-open,
.sci-dash-city__sheet.is-open {
  border-color: color-mix(in srgb, var(--dash-accent) 40%, var(--border, rgba(231, 236, 255, 0.12)));
}

.sci-dash-scene__panel-title,
.sci-dash-dock__title,
.sci-dash-city__sheet-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #a9b3d1);
}

.sci-dash-scene__panel-grid {
  display: grid;
  gap: 8px;
}

.sci-dash-scene__metric {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px solid rgba(231, 236, 255, 0.06);
  padding-bottom: 6px;
}

.sci-dash-scene__metric span {
  color: var(--muted, #a9b3d1);
  font-size: 0.78rem;
}

.sci-dash-scene__metric strong {
  color: var(--text, #e7ecff);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.sci-dash-scene__spark {
  width: 100%;
  height: 56px;
  opacity: 0.9;
}

.sci-dash-scene__spark-empty {
  font-size: 0.75rem;
  color: var(--muted, #a9b3d1);
}

.sci-dash-funnel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sci-dash-funnel__step {
  display: grid;
  gap: 4px;
}

.sci-dash-funnel__bar {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--dash-accent), var(--dash-accent-muted));
  max-width: 100%;
}

.sci-dash-funnel__meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted, #a9b3d1);
}

.sci-dash-funnel__meta strong {
  color: var(--text, #e7ecff);
  font-variant-numeric: tabular-nums;
}

.sci-dash-funnel__arrow {
  height: 8px;
  border-left: 1px dashed rgba(231, 236, 255, 0.18);
  margin-left: 8px;
}

.sci-dash-dock__cta,
.sci-dash-city__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text, #eef2fb);
  background: var(--dash-accent);
  font-size: 0.85rem;
  font-weight: 650;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sci-dash-city__sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sci-dash-city__sheet-close {
  appearance: none;
  border: 1px solid rgba(231, 236, 255, 0.2);
  background: transparent;
  color: var(--text, #e7ecff);
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sci-dash-city__sheet-close:hover {
  border-color: var(--dash-accent);
}

.sci-dash-city__sheet-hint,
.sci-dash-city__load-error {
  font-size: 0.8rem;
  color: var(--muted, #a9b3d1);
  padding: 8px 4px;
}

.sci-dash-city__load-error {
  position: absolute;
  top: 72px;
  left: 12px;
  z-index: 4;
  color: var(--warn, #ffb020);
}

/* When metrics sheet is closed, reclaim space for the map */
.sci-dash-city--investigate.is-sheet-closed .sci-dash-city__stage {
  bottom: 58px;
}

.sci-dash-city--investigate.is-sheet-closed .sci-dash-station-chips {
  bottom: 12px;
}

.sci-dash-mission__alert {
  position: absolute;
  top: 88px;
  left: 16px;
  z-index: 3;
  max-width: min(420px, calc(100% - 340px));
  pointer-events: none;
}

.sci-dash-glance__alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  border: 1px solid rgba(231, 236, 255, 0.12);
  background: var(--dash-surface);
  color: var(--text, #e7ecff);
}

.sci-dash-glance__alert.is-ok {
  border-color: color-mix(in srgb, var(--dash-accent) 35%, transparent);
}

.sci-dash-glance__alert.is-warn {
  border-color: color-mix(in srgb, var(--warn, #ffb020) 45%, transparent);
}

.sci-dash-glance__alert.is-danger {
  border-color: color-mix(in srgb, var(--danger, #ff4d6d) 45%, transparent);
}

/* Glance = document flow, no absolute overlays covering a canvas */
.sci-dash-mission--glance,
.sci-dash-glance,
.sci-dash-city--glance {
  min-height: 0;
  height: auto;
  padding: 14px 14px max(14px, var(--sci-safe-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.sci-dash-glance .sci-dash-station-chips,
.sci-dash-glance .sci-dash-dock,
.sci-dash-city--glance .sci-dash-station-chips,
.sci-dash-city--glance .sci-dash-city__sheet {
  position: static;
  transform: none;
  width: 100%;
  max-width: none;
  bottom: auto;
  top: auto;
  right: auto;
  left: auto;
}

.sci-dash-glance__hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sci-dash-glance__score {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sci-dash-glance__rates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sci-dash-glance__rates div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(231, 236, 255, 0.1);
  background: var(--dash-surface);
}

.sci-dash-glance__rates span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #a9b3d1);
}

.sci-dash-glance__rates strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--text, #e7ecff);
}

.sci-dash-fallback {
  height: 100%;
  min-height: 280px;
  display: grid;
  place-items: center;
  gap: 20px;
  padding: 32px 16px;
}

.sci-dash-fallback__core {
  width: min(180px, 55vw);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--dash-accent);
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 35%, var(--sci-glow-a, rgba(79, 142, 247, 0.22)), transparent 55%);
}

.sci-dash-fallback__score {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}

.sci-dash-fallback__label {
  text-align: center;
  color: var(--muted, #a9b3d1);
  margin-top: 6px;
  font-size: 0.85rem;
}

.sci-dash-city__hint {
  position: absolute;
  left: 12px;
  bottom: 80px;
  z-index: 3;
  font-size: 0.72rem;
  color: var(--muted, #a9b3d1);
  pointer-events: none;
  background: var(--dash-surface);
  padding: 6px 10px;
  border-radius: 8px;
}

/* —— Mobile / iPhone: one sheet, no stacked overlays on canvas —— */
@media (max-width: 900px), (pointer: coarse) {
  .sci-dash-page__sub {
    display: none;
  }

  .sci-dash-page__links a {
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  .sci-dash-page__stage-wrap {
    min-height: calc(
      var(--sci-app-h, 100dvh) - var(--dash-chrome-estimate) - var(--sci-safe-top, 0px) -
        var(--sci-safe-bottom, 0px)
    );
    border-radius: 12px;
  }

  /* Classic investigate on coarse: hide side panel rates on signal; sheet only */
  .sci-dash-scene--touch .sci-dash-scene__signal-rates,
  .sci-dash-mission--investigate .sci-dash-scene__signal-rates {
    display: none;
  }

  .sci-dash-scene--touch .sci-dash-scene__signal,
  .sci-dash-mission--investigate .sci-dash-scene__signal {
    max-width: calc(100% - 24px);
    padding: 8px 12px;
  }

  .sci-dash-scene--touch,
  .sci-dash-mission--investigate,
  .sci-dash-city--investigate {
    --sheet-h: min(38vh, 320px);
    min-height: calc(
      var(--sci-app-h, 100dvh) - var(--dash-chrome-estimate) - var(--sci-safe-top, 0px) -
        var(--sci-safe-bottom, 0px) - 8px
    );
  }

  .sci-dash-scene--touch .sci-dash-scene__stage,
  .sci-dash-mission--investigate .sci-dash-mission__stage,
  .sci-dash-city--investigate.is-sheet-open .sci-dash-city__stage {
    bottom: calc(var(--sheet-h) + 52px + var(--sci-safe-bottom, 0px));
  }

  .sci-dash-city--investigate.is-sheet-closed .sci-dash-city__stage {
    bottom: calc(58px + var(--sci-safe-bottom, 0px));
  }

  .sci-dash-scene--touch .sci-dash-station-chips,
  .sci-dash-mission--investigate .sci-dash-station-chips,
  .sci-dash-city--investigate.is-sheet-open .sci-dash-station-chips {
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
    bottom: calc(var(--sheet-h) + var(--sci-safe-bottom, 0px) + 6px);
    border-radius: 12px;
  }

  .sci-dash-city--investigate.is-sheet-closed .sci-dash-station-chips {
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
    bottom: calc(8px + var(--sci-safe-bottom, 0px));
    border-radius: 12px;
  }

  .sci-dash-scene--touch .sci-dash-station-chips__btn,
  .sci-dash-mission--investigate .sci-dash-station-chips__btn,
  .sci-dash-city--investigate .sci-dash-station-chips__btn {
    flex: 1 1 0;
  }

  .sci-dash-scene--touch .sci-dash-scene__panel,
  .sci-dash-mission--investigate .sci-dash-dock,
  .sci-dash-city--investigate .sci-dash-city__sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: var(--sheet-h);
    border-radius: 16px 16px 0 0;
    padding: 12px 14px calc(12px + var(--sci-safe-bottom, 0px));
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .sci-dash-mission__alert,
  .sci-dash-city__hint {
    display: none;
  }

  .sci-dash-mission--glance,
  .sci-dash-city--glance {
    min-height: calc(
      var(--sci-app-h, 100dvh) - var(--dash-chrome-estimate) - var(--sci-safe-top, 0px) -
        var(--sci-safe-bottom, 0px)
    );
  }
}

@media (prefers-reduced-motion: reduce) {
  .sci-dash-page__links a,
  .sci-dash-scene__panel,
  .sci-dash-dock,
  .sci-dash-city__sheet {
    transition: none;
  }
}

/* —— Factory floor (Anime.js / industrial ops floor) —— */
.sci-dash-page--factory .sci-dash-page__stage-wrap--factory {
  border-color: var(--border, #1e2c52);
  background:
    radial-gradient(ellipse 70% 50% at 50% 18%, var(--sci-glow-a, rgba(79, 142, 247, 0.22)), transparent 55%),
    linear-gradient(165deg, var(--bg0, #060b1a) 0%, var(--bg1, #0d1730) 45%, var(--panel-2, #111d40) 100%);
  box-shadow: var(--shadow, 0 18px 48px rgba(0, 0, 0, 0.5));
}

.sci-dash-factory {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.sci-dash-factory__hint {
  position: absolute;
  top: max(88px, calc(72px + var(--sci-safe-top, 0px)));
  left: 12px;
  z-index: 3;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #93a5cc);
  pointer-events: none;
  max-width: min(420px, 70vw);
}

.sci-dash-factory__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 12px 16px;
  perspective: 1400px;
}

.sci-dash-factory__board {
  position: relative;
  width: min(100%, 1100px);
  aspect-ratio: 1100 / 640;
  transform: rotateX(16deg) rotateZ(-4deg);
  transform-style: preserve-3d;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 16px;
  border: 1px solid var(--border, #1e2c52);
  background: linear-gradient(180deg, var(--panel-2, #111d40) 0%, var(--panel, #0d1730) 100%);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.45),
    inset 0 0 80px rgba(79, 142, 247, 0.04);
  overflow: visible;
}

.sci-dash-factory--floor.is-zoomed .sci-dash-factory__board {
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.55),
    inset 0 0 100px rgba(79, 142, 247, 0.06);
}

.sci-dash-factory__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sci-dash-factory__node {
  position: absolute;
  width: min(148px, 24%);
  transform: translate(-50%, -50%) translateZ(12px);
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel, #0d1730);
  border: 1px solid color-mix(in srgb, var(--node, #5fd08a) 45%, rgba(255, 255, 255, 0.12));
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.4),
    inset 0 0 14px color-mix(in srgb, var(--node, #5fd08a) 8%, transparent);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  overflow: visible;
  transition: transform 200ms ease, border-color 160ms ease, opacity 200ms ease;
}

.sci-dash-factory__node.is-compact {
  width: min(118px, 20%);
  padding: 7px 8px;
}

.sci-dash-factory--floor.is-zoomed .sci-dash-factory__node:not(.is-selected) {
  opacity: 0.55;
  pointer-events: none;
}

.sci-dash-factory__node:hover,
.sci-dash-factory__node.is-selected {
  transform: translate(-50%, -50%) translateZ(28px) scale(1.05);
  border-color: var(--node, #5fd08a);
  z-index: 4;
}

.sci-dash-factory__node.is-selected:not(.is-compact) {
  width: min(168px, 28%);
}

.sci-dash-factory__node-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.sci-dash-factory__node-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--node, #5fd08a);
  box-shadow: 0 0 8px var(--node, #5fd08a);
  flex-shrink: 0;
}

.sci-dash-factory__node-label {
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted, #93a5cc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sci-dash-factory__node-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text, #eef2fb);
  line-height: 1.1;
  margin-top: 6px;
}

.sci-dash-factory__node-sub {
  font-size: 0.68rem;
  color: var(--muted, #93a5cc);
}

.sci-dash-factory__yard-stage {
  --cw: 11px;
  --gap: 2px;
  position: relative;
  width: 100%;
  min-height: 52px;
  margin: 6px 0 4px;
  perspective: 720px;
  perspective-origin: 50% 35%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
  pointer-events: none;
  transform-style: preserve-3d;
}

.sci-dash-factory__yard-stage--caballete {
  --cw: 18px;
  --gap: 3px;
  min-height: 168px;
  margin: 8px 0 14px;
  perspective: 980px;
  perspective-origin: 50% 20%;
  padding: 12px 8px 28px;
  border-radius: 12px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 70%, rgba(255, 255, 255, 0.04), transparent 70%),
    linear-gradient(180deg, var(--panel-2, #111d40), var(--panel, #0d1730));
  border: 1px solid var(--border, #1e2c52);
}

.sci-dash-factory__yard {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(64deg) rotateZ(-38deg);
  transform-origin: center center;
}

.sci-dash-factory__yard-stage--caballete .sci-dash-factory__yard {
  transform: rotateX(58deg) rotateZ(-42deg) scale(1.05);
}

.sci-dash-factory__cell {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--cw);
  transform-style: preserve-3d;
}

.sci-dash-factory__cube {
  --s: var(--cw);
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s);
  height: var(--s);
  transform-style: preserve-3d;
  transform:
    translate3d(
      calc(var(--jx, 0px) + var(--s) / 2),
      calc(var(--s) / 2),
      calc(var(--level, 0) * var(--s) + var(--s) / 2)
    )
    rotateZ(var(--rot, 0deg));
}

.sci-dash-factory__cube-face {
  position: absolute;
  inset: 0;
  width: var(--s);
  height: var(--s);
  backface-visibility: hidden;
  box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--crate, #5fd08a) 40%, #000);
}

.sci-dash-factory__cube-face--front {
  background: linear-gradient(
    180deg,
    var(--crate, #5fd08a) 0%,
    color-mix(in srgb, var(--crate, #5fd08a) 62%, #000) 100%
  );
  transform: rotateY(0deg) translateZ(calc(var(--s) / 2));
}

.sci-dash-factory__cube-face--back {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--crate, #5fd08a) 70%, #000) 0%,
    color-mix(in srgb, var(--crate, #5fd08a) 45%, #000) 100%
  );
  transform: rotateY(180deg) translateZ(calc(var(--s) / 2));
}

.sci-dash-factory__cube-face--right {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--crate, #5fd08a) 78%, #000) 0%,
    color-mix(in srgb, var(--crate, #5fd08a) 52%, #000) 100%
  );
  transform: rotateY(90deg) translateZ(calc(var(--s) / 2));
}

.sci-dash-factory__cube-face--left {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--crate, #5fd08a) 68%, #000) 0%,
    color-mix(in srgb, var(--crate, #5fd08a) 42%, #000) 100%
  );
  transform: rotateY(-90deg) translateZ(calc(var(--s) / 2));
}

.sci-dash-factory__cube-face--top {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--crate, #5fd08a) 48%, #fff) 0%,
    color-mix(in srgb, var(--crate, #5fd08a) 82%, #fff) 100%
  );
  border-color: color-mix(in srgb, var(--crate, #5fd08a) 35%, #fff);
  transform: rotateX(90deg) translateZ(calc(var(--s) / 2));
}

.sci-dash-factory__cube-face--bottom {
  background: color-mix(in srgb, var(--crate, #5fd08a) 35%, #000);
  transform: rotateX(-90deg) translateZ(calc(var(--s) / 2));
}

.sci-dash-factory__cube.is-jitter .sci-dash-factory__cube-face--top {
  filter: brightness(1.06);
}

.sci-dash-factory__node.is-compact .sci-dash-factory__yard-stage {
  min-height: 44px;
}

.sci-dash-factory__node-value.is-compact-val {
  font-size: 0.78rem;
  margin-top: 2px;
}

.sci-dash-factory__sheet {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  width: min(320px, calc(100% - 24px));
  max-height: min(58vh, 420px);
  overflow: auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel, #0d1730);
  border: 1px solid color-mix(in srgb, var(--node, #5fd08a) 45%, rgba(255, 255, 255, 0.12));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.sci-dash-factory__sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sci-dash-factory__sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #eef2fb);
}

.sci-dash-factory__sheet-sub {
  font-size: 0.75rem;
  color: var(--muted, #93a5cc);
  margin-top: 2px;
}

.sci-dash-factory__sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.sci-dash-factory__sync-btn {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--node, #5fd08a) 55%, rgba(255, 255, 255, 0.15));
  background: color-mix(in srgb, var(--node, #5fd08a) 18%, var(--panel, #0d1730));
  color: var(--text, #eef2fb);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.sci-dash-factory__sync-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.sci-dash-factory__sheet-actions .sci-dash-city__cta {
  margin-top: 0;
}

.sci-dash-factory__sheet-close {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #e8fff4;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.sci-dash-factory__sheet .sci-dash-factory__yard-stage--caballete {
  margin-bottom: 12px;
}

.sci-dash-factory--floor.is-touch .sci-dash-factory__stage {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 100px 10px 28px;
  perspective: none;
}

.sci-dash-factory--floor.is-touch .sci-dash-factory__board {
  width: max(720px, 100%);
  min-width: 720px;
  min-height: 420px;
  aspect-ratio: 1100 / 640;
  transform: none !important;
  margin: 0 auto 80px;
  flex: 0 0 auto;
}

.sci-dash-factory--floor.is-touch .sci-dash-factory__hint {
  display: block;
  top: max(92px, calc(78px + var(--sci-safe-top, 0px)));
}

.sci-dash-factory--floor.is-touch .sci-dash-factory__node {
  width: min(118px, 24%);
}

.sci-dash-factory--floor.is-touch .sci-dash-factory__sheet {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: max(10px, var(--sci-safe-bottom, 0px));
  width: auto;
  max-height: 42vh;
  z-index: 12;
}

.sci-dash-factory--floor.is-touch.is-zoomed .sci-dash-factory__node:not(.is-selected) {
  opacity: 0.65;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .sci-dash-factory__board {
    transition: none;
  }
}

/* Light mode — Mission / Classic / Factory (City/Block keep their daylight palette) */
html[data-mantine-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block),
html[data-sci-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) {
  --dash-surface: color-mix(in srgb, var(--panel) 92%, transparent);
  --dash-surface-raised: var(--panel);
  --dash-panel: color-mix(in srgb, var(--panel) 96%, var(--bg1));
}

html[data-mantine-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__title,
html[data-sci-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__title {
  color: var(--text);
}

html[data-mantine-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__sub,
html[data-sci-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__sub {
  color: var(--muted);
}

html[data-mantine-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__chrome--overlay,
html[data-sci-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__chrome--overlay {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg0) 92%, transparent) 0%,
    color-mix(in srgb, var(--bg0) 55%, transparent) 62%,
    transparent 100%
  );
}

html[data-mantine-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__stage-wrap,
html[data-sci-color-scheme="light"] .sci-dash-page:not(.sci-dash-page--city):not(.sci-dash-page--block) .sci-dash-page__stage-wrap {
  border-color: var(--border);
  box-shadow: var(--shadow);
}

html[data-mantine-color-scheme="light"] .sci-dash-page--factory .sci-dash-factory__board,
html[data-sci-color-scheme="light"] .sci-dash-page--factory .sci-dash-factory__board {
  box-shadow:
    0 24px 48px rgba(12, 18, 40, 0.08),
    inset 0 0 80px rgba(79, 142, 247, 0.05);
}

html[data-mantine-color-scheme="light"] .sci-dash-page--factory .sci-dash-factory__node,
html[data-sci-color-scheme="light"] .sci-dash-page--factory .sci-dash-factory__node,
html[data-mantine-color-scheme="light"] .sci-dash-page--factory .sci-dash-factory__sheet,
html[data-sci-color-scheme="light"] .sci-dash-page--factory .sci-dash-factory__sheet {
  box-shadow: 0 10px 24px rgba(12, 18, 40, 0.08);
}

html[data-mantine-color-scheme="light"] .sci-dash-dock__cta,
html[data-sci-color-scheme="light"] .sci-dash-city__cta,
html[data-sci-color-scheme="light"] .sci-dash-dock__cta,
html[data-sci-color-scheme="light"] .sci-dash-city__cta {
  color: #ffffff;
}
