:root{
  --bg:#070b14;
  --text:#e7eefc;
  --muted:#9fb0d2;
  --line:rgba(255,255,255,.08);
  --good:#2dd4bf;
  --bad:#fb7185;
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --radius: 18px;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(59,130,246,.20), transparent 60%),
    radial-gradient(800px 600px at 90% 10%, rgba(45,212,191,.12), transparent 55%),
    var(--bg);
  color:var(--text);
  -webkit-text-size-adjust: 100%;
}

.wrap{
  max-width:1050px;
  margin:0 auto;
  padding:18px 14px 28px;
  padding-bottom:calc(28px + env(safe-area-inset-bottom));
}

header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.brand h1{ font-size:20px; margin:0; font-weight:850; }
.brand .sub{ font-size:13px; color:var(--muted); margin-top:6px; }

.pills{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:12px;
  color:var(--muted);
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  border-radius:999px;
  padding:7px 10px;
  backdrop-filter: blur(6px);
}

.dot{
  width:8px;height:8px;border-radius:999px;
  background:rgba(255,255,255,.25);
  box-shadow:0 0 0 4px rgba(255,255,255,.06);
}
.dot.good{ background:var(--good); box-shadow:0 0 0 4px rgba(45,212,191,.14); }
.dot.bad { background:var(--bad);  box-shadow:0 0 0 4px rgba(251,113,133,.12); }

.grid{ display:grid; grid-template-columns:minmax(0,1fr); gap:12px; }
@media(min-width: 860px){
  .grid{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
}

details.panel{
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  min-width:0;
}

details.panel > summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
}
details.panel > summary::-webkit-details-marker{ display:none; }

.panel-h{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 14px 10px;
  border-bottom:1px solid var(--line);
}
.panel-h h2{ margin:0; font-size:14px; }
.panel-h .hint{ font-size:12px; color:var(--muted); }
.chev{ color:var(--muted); font-weight:900; display:inline-block; transition:transform .15s ease; }
details[open] .chev{ transform:rotate(180deg); }

.cards{
  padding:12px;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:10px;
  min-width:0;
}
@media(min-width: 520px){
  .cards{ grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
}

.card{
  background:rgba(255,255,255,.03);
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  min-height:108px;
  display:flex;
  flex-direction:column;
  gap:8px;
  cursor:pointer;
  transition: transform .08s ease;
  min-width:0;
}
.card:active{ transform:scale(.99); }

.card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.card-title{ font-size:13px; color:var(--muted); margin:0; }
.tag{
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  background:rgba(59,130,246,.12);
  border:1px solid rgba(59,130,246,.22);
  color:#bcd6ff;
  white-space:nowrap;
}
.value{ font-size:28px; font-weight:900; line-height:1.1; }
.unit{ font-size:14px; color:var(--muted); font-weight:700; margin-left:6px; }
.meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size:12px;
  color:var(--muted);
}
.muted{ color:var(--muted); }

/* mini chart box */
.spark{
  height:140px;
  min-width:0;
  padding:0;
  border-radius:10px;
  background:rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.08);
  overflow:hidden;
  opacity:.95;
  pointer-events:none; /* taps go to the card */
}
.spark .uplot{ width:100% !important; height:100% !important; }

.actions{
  padding:12px 14px 14px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  border-top:1px solid var(--line);
}

button, a.btn{
  appearance:none;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  font-weight:800;
  font-size:13px;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.primary{ background:rgba(59,130,246,.16); border-color:rgba(59,130,246,.28); }
button:disabled{ opacity:.55; cursor:not-allowed; }

.alerts{ padding:10px 0 2px; }
.alert-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border-top:1px solid var(--line);
}
.alert-title{
  margin:0;
  font-size:13px;
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:70vw;
}
.alert-sub{
  margin:4px 0 0;
  font-size:12px;
  color:var(--muted);
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.badge{
  font-size:11px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--muted);
}
.badge.critical{ border-color:rgba(251,113,133,.35); background:rgba(251,113,133,.10); color:#ffd2da; }
.badge.firing{ border-color:rgba(251,191,36,.35); background:rgba(251,191,36,.10); color:#ffe6b1; }
.badge.resolved{ border-color:rgba(45,212,191,.30); background:rgba(45,212,191,.10); color:#c9fff5; }
.ts{ font-size:12px; color:var(--muted); white-space:nowrap; margin-top:2px; }

.trend-wrap{ padding:12px 14px 14px; }
.trend-head{ display:flex; justify-content:space-between; align-items:flex-end; gap:10px; margin-bottom:10px; }
.trend-title{ font-weight:950; }
.trend-sub{ font-size:12px; color:var(--muted); margin-top:4px; }
#trend-chart{ width:100%; }
.trend-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }

.spacer{ height:12px; }

/* === iOS selection/callout suppression ONLY where desired === */
.no-select, .no-select *{
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Scrub zone: JS owns touch here */
.scrub-zone{
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
