:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --panel: rgba(247, 247, 247, 0.9);
  --panel-border: rgba(109, 90, 167, 0.22);
  --ink: #1b0f2b;
  --muted: #614099;
  --accent: #6d5aa7;
  --accent-soft: rgba(109, 90, 167, 0.16);
  --shadow: 0 24px 60px rgba(27, 15, 43, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(97, 64, 153, 0.2), transparent 30%),
    radial-gradient(circle at top right, rgba(109, 90, 167, 0.18), transparent 24%),
    linear-gradient(180deg, #f7f7f7 0%, #ebe7f6 100%);
}

.page-shell {
  flex: 1;
  width: min(1100px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
}

.site-footer {
  margin-top: 1.5rem;
  border-top: 1px solid rgba(109, 90, 167, 0.22);
  background: linear-gradient(135deg, rgba(27, 15, 43, 0.98), rgba(97, 64, 153, 0.95));
  box-shadow: 0 -10px 40px rgba(27, 15, 43, 0.12);
}

.footer-shell {
  width: min(1100px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 0.95rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-copy {
  margin: 0;
  color: rgba(247, 247, 247, 0.88);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.footer-logo {
  height: 34px;
  width: auto;
  max-width: min(180px, 40vw);
  filter: drop-shadow(0 6px 12px rgba(27, 15, 43, 0.22));
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.75rem;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(27, 15, 43, 0.96), rgba(97, 64, 153, 0.92));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: #f7f7f7;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 0.96;
  color: #f7f7f7;
}

.subtitle {
  max-width: 40rem;
  margin: 0.8rem 0 0;
  color: rgba(247, 247, 247, 0.82);
  font-size: 1rem;
}

.hero-mark {
  width: min(220px, 32vw);
  max-width: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.panel-payload {
  margin-top: 1.25rem;
  animation: rise-in 500ms ease 40ms both;
}

.panel {
  min-width: 0;
  padding: 1.25rem;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}

.payload-stack {
  display: grid;
  gap: 0.9rem;
}

.payload-entry {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(109, 90, 167, 0.16);
  background: rgba(247, 247, 247, 0.96);
}

.payload-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.payload-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.payload-pid {
  flex-shrink: 0;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.payload-text,
.payload-empty {
  margin: 0;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ink);
  word-break: break-word;
}

pre {
  margin: 0;
  padding: 1rem;
  min-height: 20rem;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(109, 90, 167, 0.16);
  background: rgba(247, 247, 247, 0.96);
  color: var(--ink);
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.88rem;
  line-height: 1.45;
}

.panel-stats {
  animation: rise-in 500ms ease both;
}

.panel-connections {
  animation: rise-in 500ms ease 90ms both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 800px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-mark {
    width: min(180px, 50vw);
    align-self: center;
  }

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

  pre {
    min-height: 14rem;
  }

  .footer-shell {
    flex-direction: column-reverse;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .payload-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }
}

/* ── Badge modifiers ─────────────────────────────────────── */
.badge--ok {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.badge--err {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

/* ── Generic data panel (replaces <pre> in connections/stats) */
.data-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.empty-notice {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ── Status + alert chips ───────────────────────────────── */
.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-active {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.status-idle {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-error {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

.alert-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Connection cards ───────────────────────────────────── */
.conn-card {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(109, 90, 167, 0.16);
  background: rgba(247, 247, 247, 0.96);
}

.conn-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.conn-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.conn-type {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.conn-mode {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: capitalize;
}

.conn-endpoint {
  margin: 0 0 0.75rem;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 1rem;
  color: var(--ink);
  word-break: break-all;
}

.conn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.4rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.meta-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-value {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.86rem;
  color: var(--ink);
}

.meta-dim {
  color: var(--muted);
  font-size: 0.82em;
}

/* ── Stats: metric cards row ───────────────────────────── */
.metric-row {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.metric-card {
  flex: 1;
  min-width: 9rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(109, 90, 167, 0.16);
  background: rgba(247, 247, 247, 0.96);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ── Stats: transport connection card ──────────────────── */
.tc-card {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(109, 90, 167, 0.16);
  background: rgba(247, 247, 247, 0.96);
}

.tc-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

/* ── Stats: sources table ──────────────────────────────── */
.sources-wrap {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(109, 90, 167, 0.16);
  background: rgba(247, 247, 247, 0.96);
}

.section-label {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.sources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sources-table th {
  padding: 0.3rem 0.5rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid rgba(109, 90, 167, 0.18);
}

.sources-table td {
  padding: 0.38rem 0.5rem;
  color: var(--ink);
  border-bottom: 1px solid rgba(109, 90, 167, 0.07);
}

.sources-table tr:last-child td {
  border-bottom: none;
}

.sources-table .mono {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.82rem;
}
