/*
Flows Supported: global UI styling, sidebar animations
Inputs: CSS classes and variables
Outputs: themed components with interactive sidebar effects
*/
:root {
  color-scheme: dark;
  --primary-bg: #1d2733;
  --sidebar-bg: #273646;
  --card-bg: #232f3e;
  --text-color: #f1f5f9;
  --command-accent: #00b5d8;
  --command-accent-hover: #0091b2;
  --border-color: #33424e;
  --muted-surface: rgba(15, 23, 42, 0.7);
  --nav-bg: rgba(9, 14, 25, 0.82);
  --tray-bg: rgba(15, 23, 42, 0.82);
  --tray-border: rgba(148, 163, 184, 0.25);
  --sidebar-width: 19.5rem;
  --sidebar-rail-width: 4.75rem;
  --sidebar-gap: clamp(1rem, 2vw, 2rem);
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

body {
  background: var(--primary-bg);
  color: var(--text-color);
  margin: 0;
  width: 100%;
}

body[data-sidebar-enabled="1"] {
  padding-left: calc(var(--sidebar-width) + var(--sidebar-gap));
}

body[data-sidebar-enabled="1"][data-sidebar-rail-collapsed="1"] {
  padding-left: calc(var(--sidebar-rail-width) + var(--sidebar-gap));
}

#sidebar-container {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100%;
  pointer-events: none;
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.3s ease;
  z-index: 49;
}

#sidebar-container .sidebar {
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.3s ease;
  pointer-events: auto;
}

body[data-sidebar-enabled="0"] #sidebar-container {
  pointer-events: none;
}

body[data-sidebar-enabled="0"] #sidebar-container .sidebar {
  transform: translateX(calc(-100% - var(--sidebar-gap)));
  opacity: 0;
}

body[data-sidebar-enabled="1"] #sidebar-container,
body[data-sidebar-enabled="1"] .sidebar {
  width: var(--sidebar-width);
}

body[data-sidebar-enabled="1"][data-sidebar-rail-collapsed="1"] .sidebar {
  width: var(--sidebar-rail-width);
}

body[data-sidebar-enabled="1"] #content {
  padding-inline: clamp(1.25rem, 4vw, 2.5rem) clamp(1.5rem, 5vw, 3rem);
}

body[data-sidebar-enabled="1"] #content > .ml-48,
body[data-sidebar-enabled="1"] > .ml-48 {
  margin-left: 0 !important;
}

#content {
  width: 100%;
  box-sizing: border-box;
  margin-inline: auto;
  padding-inline: clamp(1.5rem, 5vw, 4rem);
  transition: padding 0.32s ease, margin 0.32s ease;
}

body[data-page-full-width="0"] #content {
  max-width: min(108rem, 100%);
  padding-inline: clamp(1.25rem, 4vw, 3rem);
}

body[data-page-full-width="1"] #content > :where(:not(style):not(script)) {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  margin-inline: auto;
}

body[data-page-full-width="1"] #content
  > :where(:not(style):not(script))
  :where(.mx-auto[class*="max-w-"], .w-full[class*="max-w-"]) {
  max-width: 100%;
  margin-inline: auto;
}

#analysisQueue {
  position: fixed;
  top: calc(1.25rem + 3.5rem);
  right: clamp(1.25rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 80;
  max-width: min(24rem, calc(100vw - 2.5rem));
}

body[data-sidebar-enabled="1"] #analysisQueue {
  left: calc(var(--sidebar-width) + var(--sidebar-gap) + clamp(1rem, 3vw, 2.75rem));
  right: clamp(1.25rem, 4vw, 3rem);
  max-width: min(
    24rem,
    calc(100vw - (var(--sidebar-width) + var(--sidebar-gap)) - clamp(2.25rem, 8vw, 5rem))
  );
}

body[data-sidebar-enabled="1"][data-sidebar-rail-collapsed="1"] #analysisQueue {
  left: calc(var(--sidebar-rail-width) + var(--sidebar-gap) + clamp(1rem, 3vw, 2.75rem));
  max-width: min(
    24rem,
    calc(100vw - (var(--sidebar-rail-width) + var(--sidebar-gap)) - clamp(2.25rem, 8vw, 5rem))
  );
}

@media (max-width: 900px) {
  #analysisQueue {
    top: calc(1.25rem + 4.5rem);
    left: clamp(1rem, 4vw, 2rem);
    right: clamp(1rem, 4vw, 2rem);
    max-width: min(20rem, calc(100vw - 2.5rem));
  }

  body[data-sidebar-enabled="1"] #analysisQueue {
    left: clamp(1rem, 4vw, 2rem);
    right: clamp(1rem, 4vw, 2rem);
  }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 20px;
}

.accent {
  color: var(--command-accent);
}

.neon-border {
  box-shadow: 0 0 10px var(--command-accent), 0 0 20px var(--command-accent);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: grid;
  grid-template-columns:
    var(--sidebar-rail-width)
    minmax(0, calc(var(--sidebar-width) - var(--sidebar-rail-width)));
  width: var(--sidebar-width);
  height: 100vh;
  overflow: visible;
  border-right: 1px solid rgba(51, 65, 85, 0.48);
  background: rgba(7, 12, 24, 0.96);
  color: #f8fafc;
  box-shadow: 0 35px 60px -44px rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(24px);
}

.sidebar[data-collapsed="1"] {
  grid-template-columns: var(--sidebar-rail-width) 0;
  width: var(--sidebar-rail-width);
  border-right: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar__rail {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 0.65rem;
  border-right: 1px solid rgba(51, 65, 85, 0.48);
  background: rgba(15, 23, 42, 0.98);
}

.sidebar__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.38);
  background: rgba(14, 165, 233, 0.16);
  color: #e0f2fe;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.sidebar__sections,
.sidebar__footer {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 0.55rem;
}

.sidebar__footer {
  margin-top: auto;
}

.sidebar__rail-button,
.sidebar__utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(71, 85, 105, 0.55);
  background: rgba(30, 41, 59, 0.82);
  color: #94a3b8;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar__rail-button {
  width: 100%;
  min-height: 3.75rem;
  padding: 0.45rem 0.25rem;
  flex-direction: column;
  gap: 0.28rem;
}

.sidebar__collapse {
  min-height: 3.25rem;
}

.sidebar__utility {
  width: 100%;
  height: 2.35rem;
}

.sidebar__rail-button span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.sidebar__rail-button:hover,
.sidebar__rail-button:focus-visible,
.sidebar__utility:hover,
.sidebar__utility:focus-visible {
  border-color: rgba(125, 211, 252, 0.56);
  background: rgba(8, 47, 73, 0.82);
  color: #e0f2fe;
  outline: none;
}

.sidebar__rail-button.is-active[data-accent="sky"],
.sidebar__item.is-active[data-accent="sky"] {
  border-color: rgba(56, 189, 248, 0.62);
  background: rgba(14, 116, 144, 0.74);
  color: #f0f9ff;
}

.sidebar__rail-button.is-active[data-accent="emerald"],
.sidebar__item.is-active[data-accent="emerald"] {
  border-color: rgba(52, 211, 153, 0.58);
  background: rgba(6, 95, 70, 0.68);
  color: #ecfdf5;
}

.sidebar__rail-button.is-active[data-accent="amber"],
.sidebar__item.is-active[data-accent="amber"] {
  border-color: rgba(245, 158, 11, 0.62);
  background: rgba(146, 64, 14, 0.72);
  color: #fffbeb;
}

.sidebar__panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid rgba(71, 85, 105, 0.34);
  background: rgba(3, 7, 18, 0.94);
  backdrop-filter: blur(18px);
  transition: opacity 0.2s ease, transform 0.22s ease;
}

.sidebar[data-collapsed="1"] .sidebar__panel {
  pointer-events: none;
  opacity: 0;
  transform: translateX(-0.6rem);
}

.sidebar[data-collapsed="1"][data-peek-open="1"] .sidebar__panel {
  position: absolute;
  inset: 0 auto 0 var(--sidebar-rail-width);
  width: calc(var(--sidebar-width) - var(--sidebar-rail-width));
  pointer-events: auto;
  opacity: 1;
  transform: none;
  box-shadow: 24px 0 44px -34px rgba(2, 6, 23, 0.8);
}

.sidebar__panel-section {
  display: none;
  height: 100%;
  min-width: 0;
  padding: 1.05rem 0.95rem 1rem;
}

.sidebar__panel-section.is-active {
  display: flex;
  flex-direction: column;
}

.sidebar__panel-heading {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(71, 85, 105, 0.36);
}

.sidebar__eyebrow {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.9);
}

.sidebar__panel-section[data-accent="emerald"] .sidebar__eyebrow {
  color: rgba(110, 231, 183, 0.9);
}

.sidebar__panel-section[data-accent="amber"] .sidebar__eyebrow {
  color: rgba(251, 191, 36, 0.92);
}

.sidebar__panel-heading h2 {
  margin: 0.3rem 0 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
  color: #f8fafc;
}

.sidebar__panel-heading p:last-child {
  margin: 0.45rem 0 0;
  color: rgba(203, 213, 225, 0.78);
  font-size: 0.78rem;
  line-height: 1.4;
}

.sidebar__items {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.55rem;
  overflow-y: auto;
  padding: 0.85rem 0.1rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(71, 85, 105, 0.7) transparent;
}

.sidebar__items::-webkit-scrollbar {
  width: 0.35rem;
}

.sidebar__items::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.72);
}

.sidebar__item {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  align-items: center;
  gap: 0.62rem;
  min-height: 4rem;
  padding: 0.65rem 0.68rem;
  border-radius: 8px;
  border: 1px solid rgba(71, 85, 105, 0.44);
  background: rgba(15, 23, 42, 0.56);
  color: rgba(226, 232, 240, 0.9);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar__item:hover,
.sidebar__item:focus-visible {
  border-color: rgba(125, 211, 252, 0.56);
  background: rgba(15, 23, 42, 0.84);
  color: #f8fafc;
  outline: none;
}

.sidebar__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  border: 1px solid rgba(71, 85, 105, 0.52);
  background: rgba(30, 41, 59, 0.82);
  color: #94a3b8;
}

.sidebar__item-copy {
  min-width: 0;
}

.sidebar__item-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.sidebar__item-label,
.sidebar__item-description {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__item-label {
  color: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

.sidebar__item-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.7);
  padding: 0.12rem 0.42rem;
  color: rgba(203, 213, 225, 0.82);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar__item-description {
  margin-top: 0.25rem;
  color: rgba(203, 213, 225, 0.72);
  font-size: 0.72rem;
}

.sidebar [data-lucide] {
  width: 1rem;
  height: 1rem;
}

@media (max-width: 900px) {
  :root {
    --sidebar-rail-width: 4.4rem;
  }

  .sidebar {
    grid-template-columns:
      var(--sidebar-rail-width)
      minmax(0, calc(var(--sidebar-width) - var(--sidebar-rail-width)));
  }

  .sidebar__rail {
    padding-inline: 0.5rem;
  }

  .sidebar[data-collapsed="1"][data-peek-open="1"] .sidebar__panel {
    left: var(--sidebar-rail-width);
    width: calc(var(--sidebar-width) - var(--sidebar-rail-width));
  }
}

.command-sidebar__analysis {
  pointer-events: none;
}

.command-sidebar__analysis > * {
  pointer-events: auto;
}

.command-sidebar__toast {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 1rem;
  padding: 0.85rem;
  box-shadow: 0 25px 55px -35px rgba(56, 189, 248, 0.45);
  color: rgba(226, 232, 240, 0.88);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.command-sidebar__toast button {
  color: rgba(125, 211, 252, 0.95);
}

.command-sidebar__toast button:hover {
  text-decoration: underline;
}

@keyframes sidebarPulse {
  0%, 100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* Neon score buttons for the Briefing table */
.score-btn {
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-weight: 600;
  transition: transform 0.2s;
  display: inline-block;
}
.score-btn:hover {
  transform: scale(1.05);
}
.score-btn.pulse {
  animation: neonPulse 2s infinite;
}
.score-great {
  color: #39ff14;
  background: rgba(57, 255, 20, 0.1);
  box-shadow: 0 0 6px #39ff14, 0 0 12px #39ff14;
}
.score-okay {
  color: #ffea00;
  background: rgba(255, 234, 0, 0.1);
  box-shadow: 0 0 6px #ffea00, 0 0 12px #ffea00;
}
.score-poor {
  color: #ff3131;
  background: rgba(255, 49, 49, 0.1);
  box-shadow: 0 0 6px #ff3131, 0 0 12px #ff3131;
}
@keyframes neonPulse {
  0%, 100% { box-shadow: 0 0 6px currentColor, 0 0 12px currentColor; }
  50% { box-shadow: 0 0 12px currentColor, 0 0 24px currentColor; }
}

/* Limit graph canvas dimensions on the Briefing page */
#overview-canvas {
  max-width: 900px;
  max-height: 320px;
}
#pie-canvas {
  max-width: 460px;
  max-height: 320px;
}
#promise-pie {
  max-width: 460px;
  max-height: 320px;
}
#store-hour-canvas,
#mini-chart {
  max-width: 480px;
  max-height: 200px;
}
#detail-canvas {
  max-width: 480px;
  max-height: 200px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Fallback login sphere when Three.js fails to load */
.fallback-sphere {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--command-accent), var(--card-bg));
  animation: spinFallback 8s linear infinite;
}

@keyframes spinFallback {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Floating login text */
.float-text {
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(-5%); }
  50% { transform: translateY(5%); }
}

/* Polished action buttons used on the Unresolved Promises page */
.action-btn {
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: transform 0.2s, opacity 0.2s;
}
.action-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.action-sms { background: linear-gradient(90deg,#3b82f6,#2563eb); }
.action-alert { background: linear-gradient(90deg,#facc15,#eab308); }
.action-callback { background: linear-gradient(90deg,#10b981,#059669); }

/* Highlight target column when dragging */
.drop-highlight {
  background: rgba(59, 130, 246, 0.3);
}

/* Data bus visuals on dashboard */
.bus-line {
  position: relative;
  flex: 1;
  height: 4px;
  background: linear-gradient(to right, var(--command-accent) 0%, transparent 100%);
  overflow: hidden;
  border-radius: 2px;
}

.bit {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--command-accent);
  opacity: 0;
  animation: bit-move 1s linear infinite;
}

.chip {
  background: var(--card-bg);
  border: 1px solid var(--command-accent);
  box-shadow: 0 0 10px var(--command-accent);
}

.token-pill {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(71, 85, 105, 0.55);
  color: rgba(226, 232, 240, 0.9);
  box-shadow: 0 14px 34px -26px rgba(15, 23, 42, 0.4);
}

.site-stack {
  display: grid;
  grid-template-columns: repeat(auto-fill, 8px);
  grid-auto-rows: 6px;
  gap: 2px;
  margin-right: 8px;
}

.site-box {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  position: relative;
}

.site-box::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: 16px;
  height: 1px;
  background: currentColor;
}

.site-box.active {
  background: #22c55e;
  z-index: 1;
}

.site-box.inactive {
  background: #dc2626;
  opacity: 0.4;
}

@keyframes bit-move {
  0% { transform: translateX(0); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

/* Funnel DataBus styles */
.data-funnel {
  position: relative;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.ai-chip {
  position: absolute;
  width: 150px;
  height: 150px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #111;
  color: #fff;
  border: 2px solid #00ffe1;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px #00ffe1;
  animation: ai-pulse 4s ease-in-out infinite, scanline 1.5s linear infinite;
  overflow: hidden;
}

.ai-chip .contact-pulse {
  position: absolute;
  left: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
  background: #00ffe1;
  border-radius: 50%;
  box-shadow: 0 0 6px #00ffe1;
  animation: contactPulse 3s ease-in-out infinite;
}

.ai-chip .wire {
  position: absolute;
  background: #00ffe1;
  box-shadow: 0 0 4px #00ffe1;
}
.ai-chip .wire-top,
.ai-chip .wire-bottom {
  width: 40px;
  height: 2px;
  left: 50%;
  transform: translateX(-50%);
}
.ai-chip .wire-top {
  top: -22px;
  box-shadow: 6px 0 #00ffe1, -6px 0 #00ffe1;
}
.ai-chip .wire-bottom {
  bottom: -22px;
  box-shadow: 6px 0 #00ffe1, -6px 0 #00ffe1;
}
.ai-chip .wire-left,
.ai-chip .wire-right {
  width: 2px;
  height: 40px;
  top: 50%;
  transform: translateY(-50%);
}
.ai-chip .wire-left {
  left: -22px;
  box-shadow: 0 6px #00ffe1, 0 -6px #00ffe1;
}
.ai-chip .wire-right {
  right: -22px;
  box-shadow: 0 6px #00ffe1, 0 -6px #00ffe1;
}

/* Collection channel entry nodes on the left edge of the AI chip */
.port {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ffe1;
  box-shadow: 0 0 4px #00ffe1;
}

.ai-chip::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(0,255,225,0.2) 50%, transparent 100%);
  animation: shimmer 3s linear infinite;
}

@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 0 20px #00ffe1; }
  50% { box-shadow: 0 0 30px #00ffe1; }
}

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

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes contactPulse {
  0%, 100% { box-shadow: 0 0 6px #00ffe1; opacity: 1; }
  50% { box-shadow: 0 0 12px #00ffe1; opacity: 0.6; }
}

.funnel-path {
  filter: drop-shadow(0 0 4px #00ffe1);
  stroke-linecap: round;
  opacity: 0.4;
}
.funnel-path.animate {
  stroke-dasharray: 5 5;
  animation: line-move 6s linear infinite;
}

@keyframes line-move { to { stroke-dashoffset: -100; } }

@keyframes dot-breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.8; }
}

.site-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  box-shadow: 0 0 4px currentColor;
  animation: dot-breathe 3.5s ease-in-out infinite;
}
.site-dot.active { background: #22c55e; }
.site-dot.offline { background: #dc2626; opacity: 0.7; }

.output-panels {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.output-card {
  width: 120px;
  padding: 10px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateX(-20px);
  animation: card-in 0.6s ease forwards, card-pulse 10s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.output-card:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0,255,225,0.4);
}

@keyframes card-in {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes card-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(0,255,225,0.3); }
  50% { box-shadow: 0 0 12px rgba(0,255,225,0.6); }
}

.flash-highlight { animation: flash-highlight 2s ease; }
@keyframes flash-highlight { from { background: rgba(0,181,216,0.3); } to { background: transparent; } }

.viewer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.875rem;
  line-height: 1;
  border-radius: 9999px;
  margin-right: 0.25rem;
}

.floating-viewers {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  transform: scale(1.5);
  transform-origin: top right;
}

.floating-clock {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  padding: 0.25rem 0.75rem;
  z-index: 60;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.floating-actions {
  position: fixed;
  top: 6rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 60;
}

.alert-arrow {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  animation: arrow-bounce 1s infinite;
}

@keyframes arrow-bounce {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(4px); }
}

.pulse-ring {
  position: relative;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    outline: 2px solid rgba(255, 0, 0, 0.6);
    outline-offset: 0;
  }
  70% {
    outline: 2px solid rgba(255, 0, 0, 0);
    outline-offset: 6px;
  }
  100% {
    outline: 2px solid rgba(255, 0, 0, 0);
    outline-offset: 0;
  }
}

.score-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #e2e8f0;
  box-shadow: 0 20px 45px -20px rgba(15, 23, 42, 0.8);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.score-card:hover {
  border-color: rgba(14, 165, 233, 0.8);
  transform: translateY(-1px);
}

.champion-card {
  position: relative;
  border: 1px solid rgba(14, 165, 233, 0.7);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.3), 0 16px 40px -18px rgba(14, 165, 233, 0.5);
}
.champion-card::after {
  content: "\1F3C6";
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
}

.urgent-stat {
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.35);
}

/* Compact button used for call detail links */
.view-detail-btn {
  display: inline-block;
  border-radius: 9999px;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: transform 0.2s, opacity 0.2s;
}
.view-detail-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.outcome-form {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 60;
}

.outcome-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.outcome-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

[data-outcome-form]:not(.hidden) {
  position: relative;
  z-index: 50;
}

.call-detail-controls {
  z-index: 70;
}

/*
Flows Supported: SI sphere launcher & global chat overlay
Inputs: sidebar layout, body[data-si-chat-open]
Outputs: immersive, animated launcher with slide-out iframe workspace
*/

.si-sphere-card {
  position: relative;
  padding: 1.5rem;
  border-radius: 1.75rem;
  border: 1px solid rgba(71, 85, 105, 0.55);
  background: linear-gradient(165deg, rgba(7, 12, 24, 0.92), rgba(12, 20, 34, 0.82));
  box-shadow: 0 24px 55px -35px rgba(15, 23, 42, 0.85), inset 0 0 0 1px rgba(56, 189, 248, 0.08);
  backdrop-filter: blur(24px);
}

.si-sphere-card__visual {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: radial-gradient(circle at 30% 25%, rgba(56, 189, 248, 0.2), transparent 65%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(8, 15, 35, 0.9));
  box-shadow: inset 0 0 25px -18px rgba(56, 189, 248, 0.5);
}

.si-sphere-card__cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 0 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.si-sphere-card__cta:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 4px;
}

.si-sphere-card__copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.si-sphere-card__label {
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(224, 242, 254, 0.88);
}

.si-sphere-card__subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.85);
}

.si-sphere-card__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.3), rgba(129, 140, 248, 0.28));
  color: rgba(226, 232, 240, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 18px 32px -24px rgba(56, 189, 248, 0.55);
}

.si-sphere-card__chevron svg {
  width: 20px;
  height: 20px;
}

.si-sphere-card__cta:hover .si-sphere-card__chevron,
.si-sphere-card__cta:focus-visible .si-sphere-card__chevron {
  transform: translateX(4px);
  box-shadow: 0 24px 40px -20px rgba(56, 189, 248, 0.75);
}

.si-sphere-caption {
  margin-top: 1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.72);
}

.si-chat-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 120;
}

.si-chat-overlay[data-state='open'] {
  pointer-events: auto;
  opacity: 1;
}

.si-chat-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.35), rgba(15, 23, 42, 0.92));
  opacity: 0;
  transition: opacity 0.35s ease;
}

.si-chat-overlay[data-state='open'] .si-chat-overlay__backdrop {
  opacity: 0.85;
}

.si-chat-overlay__panel {
  position: relative;
  width: min(1040px, 92vw);
  height: min(760px, 92vh);
  margin-right: clamp(1.5rem, 4vw, 3rem);
  border-radius: 2rem;
  border: 1px solid rgba(94, 234, 212, 0.25);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 45px 90px -50px rgba(14, 116, 144, 0.75);
  backdrop-filter: blur(24px);
  overflow: hidden;
  transform: translate3d(32px, 0, 0);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.45s ease;
  display: flex;
  flex-direction: column;
}

.si-chat-overlay[data-state='open'] .si-chat-overlay__panel {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.si-chat-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid rgba(71, 85, 105, 0.35);
}

.si-chat-overlay__heading {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.si-chat-overlay__glyph {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.75), rgba(168, 85, 247, 0.55));
  box-shadow: 0 20px 35px -22px rgba(56, 189, 248, 0.55);
  overflow: hidden;
}

.si-chat-overlay__glyph-core {
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  background: #fff;
  opacity: 0.85;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.75);
  animation: si-sphere-pulse 2.6s ease-in-out infinite;
}

.si-chat-overlay__glyph-ring {
  position: absolute;
  inset: 8px;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  animation: si-sphere-rotate 14s linear infinite;
}

.si-chat-overlay__glyph-ring--two {
  inset: 4px;
  animation-duration: 9s;
  animation-direction: reverse;
}

.si-chat-overlay__text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.si-chat-overlay__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f8fafc;
}

.si-chat-overlay__subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(203, 213, 225, 0.85);
}

.si-chat-overlay__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: rgba(226, 232, 240, 0.85);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.si-chat-overlay__close:hover,
.si-chat-overlay__close:focus-visible {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  transform: scale(1.05);
}

.si-chat-overlay__close:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 3px;
}

.si-chat-overlay__body {
  position: relative;
  flex: 1;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
}

.si-chat-overlay__body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  border-top: 1px solid rgba(71, 85, 105, 0.35);
}

.si-chat-overlay__loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.8);
  background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.92));
  transition: opacity 0.35s ease;
  z-index: 2;
  pointer-events: none;
}

.si-chat-overlay__loading[data-state='ready'] {
  opacity: 0;
  pointer-events: none;
}

.si-chat-hub__list,
.si-chat-panel__messages {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.si-chat-hub__list::-webkit-scrollbar,
.si-chat-panel__messages::-webkit-scrollbar {
  display: none;
}

.si-chat-overlay__spinner {
  width: 42px;
  height: 42px;
  border-radius: 9999px;
  border: 3px solid rgba(56, 189, 248, 0.3);
  border-top-color: rgba(168, 85, 247, 0.85);
  animation: si-spinner 1s linear infinite;
}

@keyframes si-spinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

body[data-si-chat-open='1'] {
  overflow: hidden;
}

.si-briefing-inspector-overlay {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.si-briefing-inspector-overlay::-webkit-scrollbar {
  display: none;
}

@media (max-width: 1024px) {
  .si-sphere-card {
    padding: 1.25rem;
  }

  .si-sphere-card__visual {
    height: 200px;
  }

  .si-chat-overlay__panel {
    width: min(960px, 96vw);
    margin-right: clamp(1rem, 5vw, 2rem);
    border-radius: 1.5rem;
  }
}

/* Briefing custom range date input overrides */
.briefing-date-input::-webkit-calendar-picker-indicator,
.briefing-date-input::-webkit-clear-button,
.briefing-date-input::-webkit-inner-spin-button {
  opacity: 0;
  display: none;
}

.briefing-date-input::-moz-focus-inner {
  border: 0;
}
