:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --danger: #ef4444;
  --ok: #22c55e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav a { color: var(--text); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.15rem;
  margin-right: 1rem;
}
.nav .brand-logo {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}
.nav .brand:hover { color: var(--text); }
.nav .brand:hover .brand-logo { opacity: 0.9; }
.nav .right { margin-left: auto; }
.container { max-width: min(100%, 1680px); margin: 0 auto; padding: 1.5rem 1.25rem; }
.table-nowrap { width: 100%; margin-top: 0; }
.table-scroll { overflow-x: auto; margin-top: 1rem; -webkit-overflow-scrolling: touch; }
.table-scroll .table-nowrap { margin-top: 0; }
.table-nowrap th,
.table-nowrap td {
  white-space: nowrap;
  padding: 0.55rem 0.65rem;
}
.table-nowrap .actions {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.table-nowrap .event-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}
.traffic-light {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.traffic-light.traffic-ok {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.55);
}
.traffic-light.traffic-bad {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.45);
}
.traffic-light.traffic-disabled {
  background: #4b5563;
  box-shadow: none;
}
.stream-traffic {
  text-align: center;
}
.gateway-traffic {
  text-align: center;
}
h1, h2 { margin-top: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.card.narrow { max-width: 420px; margin: 3rem auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; align-items: end; }
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; color: var(--muted); }
input, select, button {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
}
button {
  background: var(--accent);
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}
button.danger { background: var(--danger); border-color: var(--danger); }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
.actions { display: flex; gap: 0.5rem; }
.alert { background: #3f1d1d; border: 1px solid var(--danger); padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; }
.alert.info { background: #1e293b; border-color: var(--accent); }
.muted { color: var(--muted); }
.badge { padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.8rem; }
.badge.ok { background: #14532d; color: #bbf7d0; }
.badge.warn { background: #713f12; color: #fde68a; }
.badge.error { background: #7f1d1d; color: #fecaca; }
.badge.off { background: #374151; color: #d1d5db; }
.badge.info { background: #1e3a5f; color: #bfdbfe; }
code { background: #111827; padding: 0.1rem 0.35rem; border-radius: 4px; }
.log-summary .log-stat { font-size: 2rem; font-weight: 700; margin: 0.25rem 0; }
.log-summary .log-stat.stat-ok { color: var(--ok); }
.log-summary .log-stat.stat-warn { color: #f59e0b; }
.log-stat-small { font-size: 0.85rem; margin: 0.25rem 0; word-break: break-all; }
.log-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.log-toolbar h2 { margin: 0; }
.inline-label { flex-direction: row; align-items: center; gap: 0.5rem; }
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-list li { padding: 0.5rem 0.75rem; border-radius: 6px; margin-bottom: 0.35rem; }
.alert-list li.warn { background: #422006; border: 1px solid #92400e; }
.alert-list li.error { background: #450a0a; border: 1px solid #991b1b; }
.alert-list li.muted { background: transparent; border: none; }
tr.level-error td { background: rgba(127, 29, 29, 0.15); }
tr.level-warn td { background: rgba(113, 63, 18, 0.12); }
