:root {
  --bg: #040714;
  --bg-gradient: radial-gradient(circle at 18% 10%, rgba(0, 245, 196, 0.09) 0%, transparent 45%),
                 radial-gradient(circle at 82% 15%, rgba(179, 102, 255, 0.10) 0%, transparent 48%),
                 radial-gradient(circle at 50% 80%, rgba(0, 210, 255, 0.06) 0%, transparent 60%);
  --panel: rgba(10, 16, 38, 0.78);
  --panel2: rgba(16, 26, 58, 0.85);
  --panel-hover: rgba(22, 36, 78, 0.9);
  --text: #f0f7ff;
  --muted: #8fa6cb;
  --cyan: #00e5ff;
  --aurora-teal: #00f5c4;
  --aurora-purple: #b366ff;
  --green: #00f59b;
  --yellow: #ffc83b;
  --orange: #ff9233;
  --red: #ff3366;
  --line: rgba(70, 140, 230, 0.18);
  --line-glow: rgba(0, 245, 196, 0.35);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

/* Remove default browser disclosure marker triangles */
details > summary {
  list-style: none !important;
  outline: none;
}
details > summary::-webkit-details-marker {
  display: none !important;
}
details > summary::marker {
  display: none !important;
}

.aurora-ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 400px;
  background: radial-gradient(50% 100% at 50% 0%, rgba(0, 245, 196, 0.14) 0%, rgba(179, 102, 255, 0.07) 50%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Topbar Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(4, 7, 20, 0.85);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.brand:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 18px rgba(0, 245, 196, 0.45));
}

.brand-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
}

nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

nav a:hover {
  color: var(--cyan);
}

.nav-cta {
  background: linear-gradient(135deg, rgba(0, 245, 196, 0.16), rgba(179, 102, 255, 0.22));
  border: 1px solid rgba(0, 245, 196, 0.45);
  color: #00f5c4 !important;
  padding: 7px 16px;
  border-radius: 99px;
  font-weight: 600;
  box-shadow: 0 0 18px rgba(0, 245, 196, 0.18);
  transition: all 0.2s ease;
}

.nav-cta:hover {
  background: linear-gradient(135deg, rgba(0, 245, 196, 0.28), rgba(179, 102, 255, 0.38));
  border-color: #00f5c4;
  box-shadow: 0 0 24px rgba(0, 245, 196, 0.4);
  transform: translateY(-1px);
}

main {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 60px;
}

.hero {
  padding: 56px 0 24px;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--aurora-teal);
  text-shadow: 0 0 12px rgba(0, 245, 196, 0.4);
  margin-bottom: 12px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--aurora-teal);
  box-shadow: 0 0 8px var(--aurora-teal);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  background: linear-gradient(135deg, #ffffff 40%, #00f5c4 85%, #b366ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 68ch;
  margin: 0;
}

/* Overall Status Banner */
.overall-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.overall {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  border-radius: 18px;
  backdrop-filter: blur(14px);
  margin: 24px 0 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.status-operational {
  background: linear-gradient(135deg, rgba(0, 245, 155, 0.12) 0%, rgba(10, 20, 48, 0.85) 60%);
  border: 1px solid rgba(0, 245, 155, 0.35);
  box-shadow: 0 10px 40px rgba(0, 245, 155, 0.08);
}

.status-operational .pulse {
  background: #00f59b;
  box-shadow: 0 0 20px #00f59b, 0 0 40px rgba(0, 245, 155, 0.5);
}

.pulse {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  animation: auroraPulse 2.2s infinite ease-in-out;
}

@keyframes auroraPulse {
  0% { transform: scale(0.95); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.85; }
}

.overall h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.overall p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Toolbar & Filters */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.ranges {
  display: flex;
  background: rgba(10, 16, 38, 0.8);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 12px;
}

.ranges button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ranges button.active, .ranges button:hover {
  color: #fff;
  background: rgba(0, 245, 196, 0.16);
  box-shadow: inset 0 0 0 1px rgba(0, 245, 196, 0.35);
}

.json-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 16, 38, 0.8);
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.json-btn:hover {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.45);
}

/* Group Containers */
.group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 24px;
  overflow: hidden;
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.38);
  transition: border-color 0.2s ease;
}

.group:hover {
  border-color: rgba(0, 245, 196, 0.35);
}

.group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  cursor: pointer;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.025), transparent);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.group-title > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.group-description {
  display: block !important;
  color: var(--muted) !important;
  font-size: 0.84rem !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
}

.group-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(0, 245, 196, 0.12);
  border: 1px solid rgba(0, 245, 196, 0.28);
  color: var(--aurora-teal);
  flex: 0 0 auto;
}

.group-icon svg {
  width: 22px;
  height: 22px;
}

.group-chevron {
  color: var(--group-accent, var(--cyan));
  font-size: 1.25rem;
  font-weight: 700;
  transition: transform 0.25s ease;
  display: inline-block;
}

.group:not([open]) .group-chevron {
  transform: rotate(-90deg);
}

/* Individual Components */
.component {
  border-bottom: 1px solid rgba(70, 140, 230, 0.12);
  transition: background 0.2s ease;
}

.component:last-child {
  border-bottom: none;
}

.component[open] {
  background: rgba(14, 22, 54, 0.35);
}

.component > summary {
  padding: 20px 26px;
  cursor: pointer;
  user-select: none;
}

.component-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.component-name {
  min-width: 0;
}

.component-name strong {
  font-size: 1.02rem;
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
  color: #fff;
}

.component-name small {
  color: var(--muted);
  font-size: 0.84rem;
  display: block;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge.operational {
  background: rgba(0, 245, 155, 0.14);
  color: #00f59b;
  border: 1px solid rgba(0, 245, 155, 0.35);
  box-shadow: 0 0 10px rgba(0, 245, 155, 0.15);
}

.badge.degraded {
  background: rgba(255, 200, 59, 0.14);
  color: #ffc83b;
  border: 1px solid rgba(255, 200, 59, 0.35);
}

.badge.outage, .badge.major_outage {
  background: rgba(255, 51, 102, 0.16);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.4);
}

.details-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.28);
  transition: all 0.2s ease;
  cursor: pointer;
}

.component:hover .details-btn {
  background: rgba(0, 229, 255, 0.16);
  border-color: rgba(0, 229, 255, 0.45);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.component[open] .details-btn {
  background: var(--cyan);
  color: #040714;
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.45);
}

.component:not([open]) .details-btn::after {
  content: "▾";
  font-size: 0.85rem;
  line-height: 1;
}

.component[open] .details-btn::after {
  content: "▴";
  font-size: 0.85rem;
  line-height: 1;
}

/* History Bars */
.uptime-row {
  margin-top: 14px;
}

.uptime-mini {
  display: none;
}

.bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  height: 28px;
}

.bar {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  transition: transform 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.bar.good {
  background: #00f59b;
  box-shadow: 0 0 6px rgba(0, 245, 155, 0.25);
}

.bar.good:hover {
  background: #33ffb5;
  transform: scaleY(1.15);
}

.bar.warn {
  background: #ffc83b;
}

.bar.bad {
  background: #ff3366;
}

/* COMPONENT DROPDOWN STATS (The Telemetry Grid) */
.component-details {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)) !important;
  gap: 12px !important;
  padding: 16px 26px 24px !important;
  background: rgba(3, 6, 18, 0.5) !important;
  border-top: 1px solid rgba(70, 140, 230, 0.12) !important;
  box-shadow: inset 0 8px 18px rgba(0, 0, 0, 0.3) !important;
}

.component-details > div {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 13px 15px !important;
  background: linear-gradient(135deg, rgba(16, 26, 62, 0.85), rgba(8, 14, 34, 0.95)) !important;
  border: 1px solid rgba(70, 140, 230, 0.22) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28) !important;
  transition: all 0.2s ease !important;
  min-width: 0 !important;
}

.component-details > div:hover {
  border-color: rgba(0, 245, 196, 0.45) !important;
  box-shadow: 0 6px 20px rgba(0, 245, 196, 0.14) !important;
  transform: translateY(-2px) !important;
}

.component-details small {
  display: block !important;
  font-family: 'Orbitron', monospace !important;
  font-size: 0.66rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--muted) !important;
}

.component-details strong {
  display: block !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  letter-spacing: -0.01em !important;
  overflow-wrap: anywhere !important;
}

/* Tooltip */
.bar-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 245, 196, 0.35);
  background: rgba(6, 10, 26, 0.96);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-line;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 245, 196, 0.15);
  pointer-events: none;
  backdrop-filter: blur(14px);
}

/* Incidents & Maintenance */
.lower {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 36px;
}

.lower h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.incident-card, .maintenance-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
}

footer {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--cyan);
}

.credit a {
  color: var(--aurora-teal);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 800px) {
  .topbar { padding: 12px 18px; flex-wrap: wrap; gap: 12px; }
  .component-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .head-actions { width: 100%; justify-content: space-between; }
  .lower { grid-template-columns: 1fr; }
  footer { flex-direction: column; align-items: flex-start; }
}
