html { font-size: clamp(13px, 0.84vw, 22px); }

.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding: 1rem 1.5rem .8rem;
}

.hide-cursor, .hide-cursor * { cursor: none !important; }

/* ---------- status tokens */
.st-up          { --st: var(--good); }
.st-degraded    { --st: var(--warn); }
.st-down        { --st: var(--crit); }
.st-maintenance { --st: var(--maint); }
.st-pending,
.st-unconfigured { --st: var(--idle); }

/* ---------- header */
.top { display: flex; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: .8rem; min-width: 16rem; }
.logo { width: 2.6rem; height: 2.6rem; flex: none; }
.logo rect { fill: var(--good); }
.logo path { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.brand h1 { margin: 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
.brand p { margin: .1rem 0 0; color: var(--text-2); font-size: .95rem; }

.overall { flex: 1; display: flex; justify-content: center; min-width: 0; }
.pill {
  display: inline-flex; align-items: center; gap: .7rem;
  padding: .6rem 1.3rem; border-radius: 999px;
  background: color-mix(in srgb, var(--st) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--st) 45%, transparent);
  font-size: 1.15rem; font-weight: 600;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--st); flex: none; }
.st-down .dot { animation: pulse 1.2s ease-in-out infinite; }

.clock { text-align: right; min-width: 12rem; }
#clock { font-size: 2.1rem; font-weight: 700; line-height: 1; }
#date { color: var(--text-2); font-size: .9rem; margin-top: .3rem; text-transform: capitalize; }

.conn {
  background: color-mix(in srgb, var(--warn) 18%, var(--surface));
  border: 1px solid var(--warn); border-radius: var(--radius);
  padding: .6rem 1rem; font-weight: 600;
}

.section-title {
  margin: 0 0 .6rem; font-size: .8rem; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .08em;
}
.section-title span { color: var(--text-3); }

/* ---------- services */
.services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
  gap: .75rem;
}
.svc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--st);
  border-radius: var(--radius);
  padding: .8rem .9rem .75rem;
  display: flex; flex-direction: column; gap: .6rem;
  min-width: 0;
}
.svc.st-down { background: color-mix(in srgb, var(--crit) 12%, var(--surface)); animation: alarm 2s ease-in-out infinite; }
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.svc h3 { margin: 0; font-size: 1.15rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--st); white-space: nowrap;
}
.badge .ico {
  display: inline-grid; place-items: center;
  width: 1.2rem; height: 1.2rem; border-radius: 50%;
  background: var(--st); color: #fff; font-size: .72rem; line-height: 1;
}
.st-pending .badge, .st-unconfigured .badge { color: var(--text-3); }

.svc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.svc-kpis b { display: block; font-size: 1.15rem; font-weight: 650; }
.svc-kpis small { color: var(--text-3); font-size: .72rem; }

.strip { display: flex; gap: 2px; height: 1.25rem; }
.strip i { flex: 1; border-radius: 2px; background: var(--idle); opacity: .55; }
.strip .b-up { background: var(--good); opacity: 1; }
.strip .b-partial { background: var(--warn); opacity: 1; }
.strip .b-down { background: var(--crit); opacity: 1; }

.svc-foot {
  display: flex; justify-content: space-between; gap: .5rem;
  font-size: .78rem; color: var(--text-3); min-height: 1em;
}
.svc-foot .err { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssl { white-space: nowrap; }
.ssl.warn { color: var(--warn); font-weight: 700; }
.ssl.crit { color: var(--crit); font-weight: 700; }

/* ---------- servers */
.servers-section { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.servers { display: grid; gap: .9rem; flex: 1; }
.server {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .8rem; min-width: 0;
}
.server.offline { border-color: var(--crit); }
.server.offline .kpis, .server.offline .panels { opacity: .5; }
.server-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.server-head h3 { margin: 0; font-size: 1.3rem; }
.muted { color: var(--text-3); margin: .2rem 0 0; font-size: .85rem; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; }
.kpi {
  background: var(--surface-2); border-radius: 10px; padding: .75rem .9rem;
  display: flex; flex-direction: column; gap: .2rem; min-width: 0;
}
.kpi .k { color: var(--text-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-size: 2.3rem; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.kpi .v-sm { font-size: 1.6rem; line-height: 1.45; }
.kpi .v small { font-size: .8rem; color: var(--text-3); font-weight: 500; }
.kpi .s { color: var(--text-3); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 19rem; gap: .75rem; flex: 1; }
.panel {
  background: var(--surface-2); border-radius: 10px; padding: .7rem .8rem .5rem;
  display: flex; flex-direction: column; min-width: 0; min-height: 13rem;
}
.panel-head {
  display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
  font-size: .82rem; color: var(--text-2); margin-bottom: .3rem;
}
.legend { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-2); }
.legend i { width: .75rem; height: 3px; border-radius: 2px; display: inline-block; margin-left: .4rem; }

.chart { position: relative; flex: 1; min-height: 10rem; }
.chart svg { position: absolute; inset: 0; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .grid.base { stroke: var(--text-3); }
.chart .tick { fill: var(--text-3); font-size: 12px; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .16; }
.chart .cross { stroke: var(--text-3); stroke-dasharray: 3 3; }
.chart .dot { stroke: var(--surface-2); stroke-width: 2; }
.chart .nodata { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.tip {
  position: absolute; z-index: 2; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: .45rem .6rem; font-size: .8rem; box-shadow: 0 6px 20px rgb(0 0 0 / .35); min-width: 10rem;
}
.tip-t { color: var(--text-3); margin-bottom: .2rem; }
.tip-r { display: flex; align-items: center; gap: .4rem; }
.tip-r i { width: .6rem; height: .6rem; border-radius: 2px; }
.tip-r b { margin-left: auto; font-variant-numeric: tabular-nums; }

.disks { gap: 1rem; }
.disk-top { display: flex; justify-content: space-between; align-items: baseline; }
.disk-label { font-weight: 600; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.disk-top b { font-size: 1.6rem; }
.meter { height: .7rem; background: var(--bg); border-radius: 999px; overflow: hidden; margin: .35rem 0; }
.meter span { display: block; height: 100%; background: var(--s1); border-radius: 999px; }
.meter.warn span { background: var(--warn); }
.meter.crit span { background: var(--crit); }
.disk-sub { color: var(--text-3); font-size: .82rem; }
.disk-sub b { color: var(--text); }

/* multiple servers: two per row on wide screens */
@media (min-width: 1500px) {
  .servers.multi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .servers.multi .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .servers.multi .panels { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .servers.multi .disks { grid-column: 1 / -1; min-height: 0; }
}

/* ---------- footer */
.bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.events-wrap { min-width: 0; flex: 1; }
.events-wrap .section-title { display: block; margin-bottom: .35rem; }
.events { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem .6rem; font-size: .85rem; }
.ev {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--idle);
  border-radius: 6px; padding: .25rem .55rem; color: var(--text-2);
}
.ev span { color: var(--text-3); margin-right: .2rem; }
.ev em { color: var(--text-3); font-style: normal; }
.ev-down { border-left-color: var(--crit); }
.ev-up { border-left-color: var(--good); }
.ev-warn { border-left-color: var(--warn); }
.ev-info { border-left-color: var(--maint); }
.updated { color: var(--text-3); font-size: .8rem; white-space: nowrap; }
.stale .updated { color: var(--warn); font-weight: 700; }
.empty { color: var(--text-3); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes alarm { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 55%, transparent); } }

@media (prefers-reduced-motion: reduce) {
  .st-down .dot, .svc.st-down { animation: none; }
}

/* ---------- smaller screens */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panels { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; }
  .overall { order: 3; flex-basis: 100%; justify-content: flex-start; }
}
@media (max-width: 640px) {
  html { font-size: 14px; }
  .wrap { padding: 1rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 1.8rem; }
  .pill { white-space: normal; font-size: 1rem; }
  .clock { min-width: 0; }
  .brand { min-width: 0; }
  .bottom { flex-direction: column; align-items: stretch; }
}
