:root {
  --bg:        #0d1117;
  --panel:     #161b22;
  --panel-2:   #1c2129;
  --border:    #2a313b;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --green:     #2ea043;
  --yellow:    #d29922;
  --red:       #f85149;
  --grey:      #57606a;
  --blue:      #388bfd;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

header.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
header.topbar h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}
header.topbar .meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
header.topbar nav a {
  color: var(--blue);
  text-decoration: none;
  margin-left: 12px;
}
header.topbar nav a:hover { text-decoration: underline; }

main { padding: 16px; }

.zone {
  margin-bottom: 22px;
}
.zone h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.zone h2 .count {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card.up        { border-left: 3px solid var(--green); }
.card.fresh     { border-left: 3px solid var(--yellow); }
.card.crit      { border-left: 3px solid var(--red); box-shadow: 0 0 0 1px rgba(248,81,73,.15); }
.card.degraded  { border-left: 3px solid var(--blue); }
.card.inactive  { border-left: 3px solid var(--grey); opacity: .7; }

.card .title {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card .target {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.card .err {
  color: var(--red);
  font-size: 12px;
  word-break: break-word;
  background: rgba(248,81,73,.08);
  border-radius: 4px;
  padding: 4px 6px;
}
.card .meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

/* 1440-bar tape */
.tape {
  display: flex;
  align-items: stretch;
  gap: 1px;
  height: 22px;
  background: var(--panel-2);
  border-radius: 3px;
  padding: 2px;
  overflow: hidden;
}
.tape .bar {
  flex: 1 1 0;
  min-width: 1px;
  background: var(--grey);
}
.tape .bar.up        { background: var(--green); }
.tape .bar.down      { background: var(--red); }
.tape .bar.degraded  { background: var(--blue); }
.tape .bar.unknown   { background: var(--panel-2); }

/* Admin */
.admin form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.admin label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.admin input, .admin select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}
.admin button {
  background: var(--blue);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  align-self: end;
}
.admin button:hover { filter: brightness(1.1); }

table.monitors {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
table.monitors th, table.monitors td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
table.monitors th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.toggle {
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.toggle.on  { background: rgba(46,160,67,.18); color: var(--green); border-color: var(--green); }
.toggle.off { background: rgba(135,142,153,.18); color: var(--muted); }

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 12px 0;
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  header.topbar h1 { font-size: 14px; }
}
