/*
  Dashboard Ultra — observatory-grade live panel
  Layer on sr-dashboard-pro.css
*/

body.sr-site .sr-dash-ultra {
  --ultra-gold: #e8c97a;
  --ultra-cyan: #5eead4;
  --ultra-blue: #7dd3fc;
  --ultra-violet: #c4b5fd;
  --ultra-ink: #040810;
  --ultra-panel: rgba(6, 12, 22, 0.88);
  --ultra-line: rgba(186, 230, 253, 0.14);
}

/* ── Ambient section glow ── */
body.sr-site .sr-dash-ultra::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: min(72rem, 120%);
  height: 28rem;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 20% 0%, rgba(56, 189, 248, 0.12), transparent 70%),
    radial-gradient(ellipse 40% 35% at 85% 8%, rgba(251, 191, 36, 0.08), transparent 72%);
  z-index: 0;
}

body.sr-site .sr-dash-ultra > .max-w-7xl {
  position: relative;
  z-index: 1;
}

/* ── Header badge ── */
body.sr-site .sr-ultra-head-badge {
  margin-left: auto;
  padding: 0.22rem 0.55rem;
  border-radius: 0.4rem;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.14), rgba(6, 78, 59, 0.2));
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.12);
}

body.sr-site .sr-ultra-head-badge.is-mid {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.35);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(120, 53, 15, 0.15));
}

body.sr-site .sr-ultra-head-badge.is-low {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(127, 29, 29, 0.15));
}

/* ── Command telemetry strip ── */
body.sr-site .sr-ultra-command {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1.1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid var(--ultra-line);
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.06) 0%, transparent 42%, rgba(251, 191, 36, 0.04) 100%),
    var(--ultra-panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

@media (min-width: 768px) {
  body.sr-site .sr-ultra-command {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

body.sr-site .sr-ultra-command__cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}

body.sr-site .sr-ultra-command__cell--wide {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  body.sr-site .sr-ultra-command__cell--wide {
    grid-column: auto;
  }
}

body.sr-site .sr-ultra-command__k {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.9);
}

body.sr-site .sr-ultra-command__v {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: #f8fafc;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.sr-site .sr-ultra-command__v--mono {
  font-size: 0.68rem;
  color: var(--ultra-cyan);
}

/* ── Spectro tools (were unstyled) ── */
body.sr-site .sr-prism-spectro-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.35rem;
}

@media (min-width: 900px) {
  body.sr-site .sr-prism-spectro-head {
    align-items: center;
  }

  body.sr-site .sr-prism-spectro-tools {
    width: auto;
    margin-top: 0;
    margin-left: auto;
  }
}

body.sr-site .sr-dash-pro-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.65rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(2, 8, 18, 0.55);
  color: rgba(226, 232, 240, 0.88);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

body.sr-site .sr-dash-pro-tool svg {
  width: 0.85rem;
  height: 0.85rem;
  opacity: 0.85;
}

body.sr-site .sr-dash-pro-tool:hover {
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(14, 30, 52, 0.65);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

body.sr-site .sr-dash-pro-tool[aria-pressed="true"] {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
  background: rgba(251, 191, 36, 0.1);
}

/* ── Spectro HUD + color scale ── */
body.sr-site .sr-ultra-spectro-hud {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: rgba(2, 8, 18, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

body.sr-site .sr-ultra-spectro-hud__tag {
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #6ee7b7;
}

body.sr-site .sr-ultra-spectro-hud__hz {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: #f8fafc;
}

body.sr-site .sr-ultra-spectro-scale {
  position: absolute;
  left: 0.55rem;
  bottom: 0.55rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.3rem;
  border-radius: 0.45rem;
  background: rgba(2, 8, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.85);
  pointer-events: none;
}

body.sr-site .sr-ultra-spectro-scale i {
  display: block;
  width: 0.45rem;
  height: 3.25rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #1d4ed8, #22c55e 45%, #eab308 72%, #ef4444);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

/* ── 4 insight tiles ── */
body.sr-site .sr-dash-pro-insight--teal {
  --dp-insight-accent: #2dd4bf;
}

@media (min-width: 900px) {
  body.sr-site .sr-ultra-insights {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 899px) {
  body.sr-site .sr-ultra-insight-span {
    grid-column: 1 / -1;
  }
}

/* ── Tab stack (mini charts) ── */
body.sr-site .sr-ultra-tab-stack {
  margin-top: 0.65rem;
}

body.sr-site .sr-ultra-tab-panel {
  display: none;
  padding: 0.75rem 0.85rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.22);
}

body.sr-site .sr-ultra-tab-panel.active {
  display: block;
  animation: sr-ultra-tab-in 0.35s ease;
}

@keyframes sr-ultra-tab-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

body.sr-site .sr-ultra-tab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  font-size: 0.625rem;
  color: rgba(148, 163, 184, 0.9);
}

body.sr-site .sr-ultra-tab-head strong {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ultra-cyan);
}

body.sr-site .sr-ultra-mini-chart {
  position: relative;
  height: 7.5rem;
  border-radius: 0.65rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(4, 12, 30, 0.85), rgba(2, 6, 16, 0.95)),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(255, 255, 255, 0.02) 39px, rgba(255, 255, 255, 0.02) 40px);
}

body.sr-site .sr-ultra-mini-chart canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

body.sr-site .sr-ultra-tabs .tab-btn.active {
  box-shadow:
    0 4px 16px rgba(212, 160, 23, 0.22),
    0 0 0 1px rgba(251, 191, 36, 0.2) inset !important;
}

/* ── Ultra metric cards ── */
body.sr-site .sr-ultra-metric {
  position: relative;
  overflow: hidden;
  border-radius: 1rem !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    rgba(6, 12, 22, 0.82) !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

body.sr-site .sr-ultra-metric::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.04) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

body.sr-site .sr-ultra-metric:hover {
  transform: translateY(-2px);
  border-color: rgba(186, 230, 253, 0.22) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

body.sr-site .sr-ultra-metric:hover::before {
  transform: translateX(120%);
}

body.sr-site .sr-ultra-metric .text-3xl {
  font-family: "Roboto Mono", ui-monospace, monospace !important;
  letter-spacing: -0.04em;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.15);
}

/* ── Harmonic cards ── */
body.sr-site .sr-ultra-harmonics-wrap .section-orb-divider {
  margin-inline: auto;
}

body.sr-site .sr-ultra-harmonic {
  position: relative;
  border-radius: 1rem !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  background:
    linear-gradient(180deg, rgba(251, 191, 36, 0.04), transparent 35%),
    rgba(6, 12, 22, 0.78) !important;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body.sr-site .sr-ultra-harmonic::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.35), transparent 40%, rgba(56, 189, 248, 0.25));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

body.sr-site .sr-ultra-harmonic:hover {
  transform: translateY(-3px);
  border-color: rgba(251, 191, 36, 0.28) !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
}

body.sr-site .sr-ultra-harmonic:hover::after {
  opacity: 1;
}

body.sr-site .sr-ultra-harmonic .harmonic-bar {
  background: linear-gradient(90deg, #38bdf8, #fde68a) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

body.sr-site .sr-ultra-harmonic .harmonic-freq {
  background: linear-gradient(135deg, #f8fafc, #bae6fd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Viz suite polish ── */
body.sr-site .sr-ultra-viz-suite .sr-viz-panel {
  position: relative;
}

body.sr-site .sr-ultra-viz-suite .sr-viz-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.2rem;
  right: 1.2rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(186, 230, 253, 0.25), transparent);
}

body.sr-site .sr-ultra-viz-suite .sr-viz-canvas-wrap {
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
}

body.sr-site .sr-dash-ultra #spectrogram.sr-dash-pro-spectro {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 0 0 1px rgba(56, 189, 248, 0.08),
    0 28px 72px rgba(0, 0, 0, 0.45) !important;
}

body.sr-site .sr-dash-ultra .sr-dash-pro-chart,
body.sr-site .sr-dash-ultra .sr-dash-pro-trend {
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.06),
    0 22px 56px rgba(0, 0, 0, 0.34) !important;
}

/* Fullscreen spectro mode */
body.sr-site.sr-spectro-fullscreen {
  overflow: hidden;
}

body.sr-site.sr-spectro-fullscreen #spectrogram.sr-dash-pro-spectro {
  position: fixed;
  inset: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0) 0;
  z-index: 10060;
  margin: 0 !important;
  border-radius: 0 !important;
  max-width: none !important;
  width: 100% !important;
  height: 100dvh !important;
  display: flex;
  flex-direction: column;
}

body.sr-site.sr-spectro-fullscreen .sr-dash-pro-spectro-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.sr-site.sr-spectro-fullscreen .sr-dash-pro-spectro-viewport {
  flex: 1;
  min-height: 0;
}

body.sr-site.sr-spectro-fullscreen .sr-dash-pro-spectro-viewport #main-spectro {
  height: 100% !important;
  min-height: 0 !important;
  object-fit: contain !important;
}

@media (prefers-reduced-motion: reduce) {
  body.sr-site .sr-ultra-tab-panel.active {
    animation: none;
  }

  body.sr-site .sr-ultra-metric:hover,
  body.sr-site .sr-ultra-harmonic:hover {
    transform: none;
  }
}
