:root {
  --bg: #1a1a1a;
  --panel: #232323;
  --panel-2: #2a2a2a;
  --border: #383838;
  --purple: #4b0082;
  --purple-bright: #8a3ffc;
  --purple-soft: #9b6dd6;
  --good: #3ec46d;
  --warn: #e0a93b;
  --bad: #e0504f;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.5);
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- Navbar ---- */
.navbar {
  background-color: var(--purple);
  border-bottom: 1px solid #2c004e;
}
.navbar-brand {
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 1.05rem;
}
.brand-slash {
  color: var(--purple-soft);
}

/* ---- Status pill ---- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}
.status-online .status-dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.status-offline .status-dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.status-online .status-text::after { content: "online"; }
.status-offline .status-text::after { content: "offline"; }

/* ---- Session bar ---- */
.session-bar {
  background: linear-gradient(135deg, #2a0a40 0%, var(--panel) 70%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.3rem;
}
.daynight { font-size: 1.4rem; font-weight: 700; }

/* ---- Section titles ---- */
.section-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--purple-soft);
  margin: 0 0 0.75rem;
  font-weight: 700;
}

/* ---- Cards / panels ---- */
.card,
.panel {
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.panel { overflow: hidden; }

.stat-card {
  padding: 1rem 1.1rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.stat-card:hover {
  border-color: var(--purple-bright);
  transform: translateY(-2px);
}
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-value .unit { font-size: 0.95rem; color: var(--muted); font-weight: 500; }
.stat-foot { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }
.stat-foot.fuse-bad { color: var(--bad); font-weight: 700; }

/* ---- Per-circuit cards ---- */
.circuit-card {
  padding: 0.85rem 1rem;
  height: 100%;
}
.circuit-card.tripped { border-color: var(--bad); }
.circuit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.circuit-id { font-weight: 700; }
.badge-soft {
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(138, 63, 252, 0.18);
  color: var(--purple-soft);
  font-weight: 600;
}
.badge-bad { background: rgba(224, 80, 79, 0.18); color: var(--bad); }

/* ---- Progress bars ---- */
.bar-track {
  height: 7px;
  border-radius: 4px;
  background: #141414;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple) 0%, var(--purple-bright) 100%);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.bar-fill.over { background: linear-gradient(90deg, var(--warn) 0%, var(--bad) 100%); }

/* ---- Production table ---- */
.prod-table { --bs-table-bg: transparent; }
.prod-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  border-color: var(--border);
}
.prod-table td { border-color: #2f2f2f; }
.prod-table tbody tr:hover { --bs-table-hover-bg: rgba(138, 63, 252, 0.08); }
.prod-num { font-variant-numeric: tabular-nums; }
.prod-prod { color: var(--good); }
.prod-cons { color: var(--purple-soft); }
.util-col { width: 180px; }
.type-pill {
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  margin-left: 0.45rem;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  vertical-align: middle;
}

/* ---- Trains ---- */
.train-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid #2f2f2f;
}
.train-row:last-child { border-bottom: none; }
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

/* ---- Offline banner ---- */
.offline-banner {
  background: rgba(224, 80, 79, 0.12);
  border: 1px solid var(--bad);
  color: #ffd9d8;
  border-radius: 12px;
}

.footer-rule { border-color: var(--border); }

/* ---- Navbar inline links ---- */
.nav-link-inline {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.85;
}
.nav-link-inline:hover { opacity: 1; text-decoration: underline; color: #fff; }

/* ---- Buttons ---- */
.btn-purple {
  background: var(--purple);
  border: 1px solid var(--purple-bright);
  color: #fff;
  font-weight: 600;
}
.btn-purple:hover { background: var(--purple-bright); color: #fff; }

/* ---- Join steps ---- */
.join-steps { list-style: none; padding: 0; margin: 0; }
.join-steps li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1rem;
}
.step-n {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--purple);
  border: 1px solid var(--purple-bright);
}
.server-addr {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: #141414;
  border: 1px solid var(--border);
  color: var(--purple-soft);
  font-size: 0.95rem;
}
