
body { font-family: system-ui, Arial, sans-serif; margin: 0; background: #0b0f14; color: #e7eef7; }
header { display:flex; justify-content:space-between; align-items:center; padding: 12px 16px; background: #111a22; border-bottom: 1px solid #1e2a36; }
header h1 { display:flex; align-items:center; gap:8px; font-size:1.6rem; margin:0; }
.site-count { font-size:0.95rem; font-weight:500; color:#9fb3c8; }
.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap:12px; padding:16px; }
.card { background:#0f1720; border:1px solid #1e2a36; border-radius:12px; padding:12px; transition: box-shadow .2s ease; }
.card.up { box-shadow: inset 0 0 0 2px #164d2b; }
.card.impaired { box-shadow: inset 0 0 0 2px #7a5a00; }
.card.down { box-shadow: inset 0 0 0 2px #7a1a1a; }
.row { display:flex; gap:16px; align-items:center; justify-content:space-between; margin:8px 0; }
.head .name { font-weight:700; }
.head .sub { color:#98a6b6; font-size:12px; }
.status { font-weight:700; text-transform: uppercase; }
.login { display:grid; place-items:center; height:100vh; }
.btn { background:#2a72e5; color:white; text-decoration:none; padding:10px 14px; border-radius:8px; border:none; cursor:pointer; }
.btn.small { padding:6px 10px; font-size: 14px; }
.controls { display:flex; justify-content:space-between; gap:16px; padding: 8px 16px; align-items:center; flex-wrap:wrap; }
.controls .left,
.controls .center,
.controls .right { display:flex; align-items:center; gap:12px; }
.controls .center { flex:1 1 auto; justify-content:center; flex-wrap:wrap; }
.controls label { display:flex; align-items:center; gap:6px; font-size:0.95rem; color:#e7eef7; }
.controls input[type="checkbox"] { width:16px; height:16px; }
.controls .muted { color:#98a6b6; font-size:12px; }
.foot { font-size: 12px; color:#98a6b6; }

.aggregate { padding: 0 16px; margin: 8px 0; }

/* Horizontal cards */
.grid.hcards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card.hcard {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr 0.8fr;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Color codes remain driven by .up/.impaired/.down on .card */
.card.hcard.up    { border-left: 6px solid #1f9d55; }
.card.hcard.impaired { border-left: 6px solid #d9822b; }
.card.hcard.down  { border-left: 6px solid #e53e3e; }

.hcard .left .name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  margin-bottom: 2px;
}
.hcard .left .addr {
  font-size: 0.9rem;
  color: #666;
}

.hcard .mid {
  display: flex;
  gap: 18px;
  white-space: nowrap;
  font-size: 0.95rem;
}
.hcard .mid .metric span {
  font-weight: 600;
}

.hcard .mid .metric .apratio-warn {
  font-weight: 700;
  color: #facc15;
}

.hcard .mid .metric .apratio-alert {
  font-weight: 700;
  color: #f87171;
}

.hcard .right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.hcard .bar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.statusbar {
  display: flex;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
  background: #e2e8f0;
}

.statusbar .status-window {
  flex: 1;
  display: flex;
  min-width: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.18);
}

.statusbar .status-window:last-child {
  border-right: none;
}

.statusbar .status-window .seg {
  flex-grow: 1;
  flex-basis: 0;
  min-width: 0;
  background: transparent;
}

.statusbar .status-window.today .seg {
  min-width: 1px;
}

.statusbar .seg.none {
  background: rgba(0, 0, 0, 0.12);
}

.statusbar .seg.up { background: #1f9d55; }
.statusbar .seg.impaired { background: #d9822b; }
.statusbar .seg.down { background: #e53e3e; }

.hcard .status {
  font-weight: 700;
  letter-spacing: .02em;
}
.hcard .status.up { color: #1f9d55; }
.hcard .status.impaired { color: #d9822b; }
.hcard .status.down { color: #e53e3e; }

.hcard .last {
  font-size: 0.9rem;
  color: #666;
}

/* Responsive: stack metrics under title on small screens */
@media (max-width: 720px) {
  .card.hcard {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .hcard .right {
    justify-content: space-between;
  }
  .hcard .mid {
    gap: 12px;
    flex-wrap: wrap;
  }
}

/* Tooltip for segment timestamps */
#tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  display: none;
  white-space: nowrap;
  text-align: center;
}

