@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap");

:root {
  --bg: #101828;
  --header-bg: #1b2538;
  --panel-bg: #223140;
  --group-head-bg: #303d4e;
  --border: #666666;
  --border-detail: #303d4e;
  --text: #cccccc;
  --text-secondary: #8896a0;
  --text-footer: #a2abb7;
  --accent: #578ebe;
  --up: #5cb85c;
  --degraded: #dfba49;
  --nodata: #c6c6c6;
  --down: #f3565d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Open Sans", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.4286;
}
main { max-width: 1100px; margin: 0 auto; padding: 25px 20px 80px; }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--header-bg); border-radius: 4px; padding: 15px 20px; margin-bottom: 20px;
}
header.top a.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
a { color: var(--text); }
a:hover { color: #eaeaea; }

/* control bar: search | overall banner | paging */
.controlbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 0; flex: 1; min-width: 180px;
}
.search-box input {
  flex: 1; height: 28px; background: transparent; border: 1px solid var(--border);
  border-radius: 4px 0 0 4px; color: #fff; padding: 0 10px; font-size: 14px; font-family: inherit;
  border-right: none; outline: none;
}
.search-box input::placeholder { color: var(--text-secondary); }
.search-box .search-btn {
  height: 28px; width: 32px; background: var(--panel-bg); border: 1px solid var(--border);
  border-radius: 0 4px 4px 0; color: var(--text); cursor: pointer; display: grid; place-items: center;
}

.banner {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  height: 28px; padding: 0 16px; border-radius: 4px;
  border: 1px solid var(--border); background: transparent;
  font-size: 16px; color: var(--text); white-space: nowrap;
}
.banner .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot.operational, .dot.up { background: var(--up); }
.dot.degraded, .dot.maintenance { background: var(--degraded); }
.dot.down { background: var(--down); }
.dot.unknown { background: var(--nodata); }

.paging { display: flex; align-items: center; gap: 6px; }
.paging button {
  height: 28px; padding: 0 12px; background: var(--panel-bg); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); cursor: pointer; font-size: 13px; font-family: inherit;
}
.paging button:hover { background: #28394a; }
.paging button:disabled { opacity: 0.45; cursor: default; }

section.group { margin-bottom: 25px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: var(--panel-bg); }
.group-head {
  display: grid; grid-template-columns: 1fr 1fr 10% repeat(7, minmax(0,1fr));
  gap: 4px; align-items: center;
  padding: 8px; background: var(--group-head-bg);
  font-size: 14px; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.group-head .group-name { display: flex; align-items: center; gap: 6px; }
.group-head .operational-count { color: var(--up); text-align: right; font-size: 14px; font-weight: 700; }
.group-head .col-label { text-align: center; font-size: 13px; }
.group-head .day-label { text-align: center; font-size: 12px; }

.monitor-row {
  display: grid; grid-template-columns: 1fr 1fr 10% repeat(7, minmax(0,1fr));
  gap: 4px; align-items: center;
  padding: 8px; min-height: 55px;
  text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.monitor-row:last-child { border-bottom: none; }
.monitor-row:hover { background: rgba(255,255,255,0.03); }
.monitor-row .state-col { display: flex; justify-content: center; }
.monitor-row .name-col { min-width: 0; }
.monitor-row .name-col strong { font-weight: 600; font-size: 13px; }
.monitor-row .uptime-col { text-align: center; font-size: 13px; }
.monitor-row .uptime-col a { text-decoration: underline; text-decoration-style: dotted; }

/* status badges: colored icon, Hetrix-style (label + fa icon) */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; position: relative;
}
.badge.small { width: 20px; height: 20px; }
.badge svg { width: 100%; height: 100%; }
.badge.up, .badge.success { color: var(--up); }
.badge.degraded, .badge.warning { color: var(--degraded); }
.badge.down, .badge.danger { color: var(--down); }
.badge.nodata, .badge.unknown { color: var(--nodata); }

/* dark tooltip, Hetrix-style */
[data-tooltip] { position: relative; cursor: default; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #000; color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 4px;
  white-space: pre; max-width: 200px; opacity: 0; pointer-events: none;
  transition: opacity 0.1s; z-index: 10; text-align: center;
}
[data-tooltip]:hover::after { opacity: 0.95; }

.incident { padding: 12px 20px 15px; border-radius: 4px; border-left: 5px solid var(--border); border-top: 1px solid var(--border); background: var(--panel-bg); margin-bottom: 10px; }
.incident h3 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }
.incident p { margin: 0; color: var(--text); font-size: 13px; white-space: pre-wrap; }
.incident .meta { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }

h2.section-title { font-size: 18px; font-weight: 400; color: var(--text); margin: 24px 0 10px; }
h2.section-caption { font-size: 14px; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); margin: 24px 0 10px; }

footer { text-align: right; color: var(--text-footer); font-size: 13px; margin-top: 30px; padding: 15px 20px; background: var(--header-bg); border-radius: 4px; }
footer a { color: #fff; }
footer a:hover { color: #ebebeb; }

.loading, .error { color: var(--text-secondary); text-align: center; padding: 40px 0; }

/* monitor detail page */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; font-size: 13px; margin-bottom: 16px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; background: var(--panel-bg); border-radius: 4px; padding: 12px 20px; border: 1px solid var(--border); }
.detail-head h1 { font-size: 18px; font-weight: 400; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 25px; }
.stat-card { border-radius: 4px; padding: 14px 16px; height: 90px; display: flex; flex-direction: column; justify-content: center; background: #3e7d3e; }
.stat-card.neutral { background: var(--accent); }
.stat-card .value { font-size: 28px; font-weight: 300; }
.stat-card .label { font-size: 14px; font-weight: 300; opacity: 0.9; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.info-table { width: 100%; border-collapse: collapse; background: var(--header-bg); border-radius: 4px; overflow: hidden; font-size: 13px; }
.info-table tr { border-top: 1px solid var(--border-detail); }
.info-table tr:first-child { border-top: none; }
.info-table td { padding: 8px; color: var(--text-secondary); }
.info-table td:first-child { width: 55%; }
.info-table td b { color: var(--text); font-weight: 700; }

.calendar { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.calendar .week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar .day { background: var(--header-bg); border-radius: 4px; padding: 8px; text-align: center; min-height: 70px; }
.calendar .day b { font-size: 13px; font-weight: 700; display: block; margin-bottom: 8px; }

.note-box {
  border: 1px dashed var(--border); border-radius: 4px; padding: 10px 14px;
  color: var(--text-secondary); font-size: 12.5px; margin-bottom: 20px;
}

svg.sparkline { width: 100%; height: 160px; display: block; background: var(--panel-bg); border-radius: 4px; padding: 10px; }

@media (max-width: 720px) {
  .group-head, .monitor-row { grid-template-columns: 1fr 1fr 70px; }
  .group-head .day-label, .monitor-row .day-badge { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr; }
}
