/* warna ngikutin tema Clean & Dark di mcp-web-revamp */
:root {
  --bg: #f2f5fa;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --border: #e6ebf2;
  --border-soft: #eef1f6;
  --text: #101828;
  --text-2: #5c6b82;
  --muted: #94a3b8;
  --brand: #2f6fed;
  --brand-soft: #e8f0fe;
  --ok: #16a34a;
  --ok-soft: #e7f6ec;
  --warn: #f59e0b;
  --bad: #e0334c;
  --bad-soft: #fdecef;
  --none: #dfe5ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --tip-bg: #101828;
  --tip-text: #ffffff;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1c;
    --surface: #111827;
    --surface-alt: #161f30;
    --border: #232f45;
    --border-soft: #1b2537;
    --text: #eef2f8;
    --text-2: #94a3b8;
    --muted: #64748b;
    --brand: #4d84ff;
    --brand-soft: rgba(77, 132, 255, 0.14);
    --ok: #22c55e;
    --ok-soft: rgba(34, 197, 94, 0.12);
    --warn: #f5a623;
    --bad: #f43f5e;
    --bad-soft: rgba(244, 63, 94, 0.12);
    --none: #232f45;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --tip-bg: #eef2f8;
    --tip-text: #0a0f1c;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand:hover { text-decoration: none; }
.logo { height: 34px; width: auto; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .logo-light { display: none; }
  .logo-dark { display: block; }
}
.brand-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  font-size: 13px;
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.updated { color: var(--text-2); font-size: 13px; text-align: right; white-space: nowrap; }
.is-offline .updated::after { content: " · koneksi terputus"; color: var(--bad); }

.refresh {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.refresh:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.refresh:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.refresh:disabled { cursor: progress; color: var(--brand); border-color: var(--border); background: var(--surface); }
.refresh-icon { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.refresh.is-loading .refresh-icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .refresh.is-loading .refresh-icon { animation: none; }
}

/* banner status keseluruhan */
.banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0 8px;
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.banner h1 { font-size: 19px; font-weight: 700; }
.banner p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.banner-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--none);
}
.banner-icon::before { font-weight: 700; font-size: 20px; color: #fff; }
.banner-up { background: var(--ok-soft); border-color: transparent; }
.banner-up .banner-icon { background: var(--ok); }
.banner-up .banner-icon::before { content: "✓"; }
.banner-down { background: var(--bad-soft); border-color: transparent; }
.banner-down .banner-icon { background: var(--bad); }
.banner-down .banner-icon::before { content: "!"; }
.banner-unknown .banner-icon::before { content: "…"; color: var(--text-2); }

/* grup */
.group { margin-top: 32px; }
.group-head { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 10px; }
.group-head h2 { font-size: 16px; font-weight: 700; }
.group-note { color: var(--muted); font-size: 13px; }

.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.pill-up { color: var(--ok); background: var(--ok-soft); }
.pill-down { color: var(--bad); background: var(--bad-soft); }
.pill-unknown { color: var(--text-2); background: var(--border-soft); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* satu monitor */
.monitor { padding: 18px 20px; }
.monitor + .monitor { border-top: 1px solid var(--border-soft); }
.m-head { display: flex; align-items: center; gap: 12px; }
.m-title { flex: 1; min-width: 0; }
.m-title h3 { font-size: 15px; font-weight: 600; }
.m-title a {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-uptime { text-align: right; }
.m-uptime strong { display: block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-uptime span { font-size: 12px; color: var(--muted); }

.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot-up { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot-down { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }

.bars { display: flex; gap: 2px; height: 32px; margin-top: 14px; }
.bar { position: relative; flex: 1; border-radius: 2px; background: var(--none); }
.bar.lvl-up { background: var(--ok); }
.bar.lvl-minor { background: var(--warn); }
.bar.lvl-major { background: var(--bad); }
.bar:hover { opacity: 0.75; }
.bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--tip-bg);
  color: var(--tip-text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
/* tooltip di ujung kiri/kanan jangan sampe keluar layar */
.bar:nth-child(-n+12):hover::after { left: 0; transform: none; }
.bar:nth-last-child(-n+12):hover::after { left: auto; right: 0; transform: none; }

.axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 12px; }
.axis-30 { display: none; }

.m-stats { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 10px; color: var(--text-2); font-size: 13px; }
.m-stats span:not(:last-child)::after { content: "·"; margin: 0 8px; color: var(--muted); }
.st { font-weight: 600; }
.st-up { color: var(--ok); }
.st-down { color: var(--bad); }

/* riwayat insiden */
.incidents { list-style: none; margin: 0; padding: 0; }
/* grid: titik | isi | penyebab. di HP penyebabnya turun ke bawah isi. */
.incident {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: start;
  padding: 14px 20px;
}
.incident + .incident { border-top: 1px solid var(--border-soft); }
.incident .dot { margin-top: 7px; }
.i-title { font-size: 14px; }
.i-group { color: var(--muted); font-size: 13px; margin-left: 4px; }
.i-meta { color: var(--text-2); font-size: 13px; }
.i-ongoing { color: var(--bad); font-weight: 600; }
.i-cause {
  font-size: 12px;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.empty { padding: 22px 20px; color: var(--text-2); font-size: 14px; }

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 28px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 13px;
}

/* layar HP: cukup 30 hari terakhir biar bar-nya gak kekecilan */
@media (max-width: 600px) {
  .topbar-inner { min-height: 60px; }
  .logo { height: 28px; }
  .brand { gap: 8px; }
  .brand-tag { padding: 2px 8px; font-size: 12px; }
  .top-actions { gap: 8px; }
  .updated { font-size: 12px; }
  .updated-label, .m-uptime-word { display: none; }
  .refresh { width: 40px; height: 40px; }
  .m-title a { font-size: 12px; }
  .banner { margin-top: 20px; padding: 16px; }
  .banner h1 { font-size: 17px; }
  .monitor { padding: 16px; }
  .bar:nth-child(-n+60) { display: none; }
  .bar:nth-child(-n+70):hover::after { left: 0; transform: none; }
  .axis-90 { display: none; }
  .axis-30 { display: inline; }
  /* titik pemisah suka nyangkut di ujung baris pas wrap, di HP pake jarak aja */
  .m-stats { gap: 4px 14px; }
  .m-stats span:not(:last-child)::after { content: none; }
  .incident { grid-template-columns: 10px minmax(0, 1fr); padding: 14px 16px; }
  .i-cause { grid-column: 2; justify-self: start; margin-top: 6px; }
  .footer a { white-space: nowrap; }
}
