:root {
  --yellow: #f7ff8a;
  --blue: #a4cbea;
  --ink: #121212;
  --graphite: #4f4f4f;
  --gray: #c9c9c9;
  --page: #f3f4f1;
  --up: #5dc490;
  --warn: #f5943e;
  --down: #f44a4a;
  --radius: 18px;
  --font: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(243, 244, 241, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(18, 18, 18, 0.06);
}
.logo {
  display: flex;
  align-items: center;
  line-height: 0;
}
.logo img {
  display: block;
  height: 36px;
  width: auto;
}
.top-meta {
  display: flex;
  align-items: baseline;
  gap: 18px;
}
.kicker, .clock, .logout, .nav {
  color: var(--graphite);
  font-size: 18px;
  font-weight: 650;
}
.logout, .nav { text-decoration: none; }
.logout:hover, .nav:hover { color: var(--ink); }
.nav.has-open { color: var(--down); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(100%, 380px);
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px 22px;
}
.login-card .logo { margin-bottom: 18px; }
.login-card h1 {
  font-size: 28px;
  margin-bottom: 6px;
}
.login-card .lead { margin-bottom: 18px; }
.login-card label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 650;
  color: var(--graphite);
}
.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  padding: 12px 12px;
}
.login-card button {
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 12px 14px;
  cursor: pointer;
}
.login-error {
  margin: 0 0 12px;
  color: var(--down);
  font-size: 13px;
  font-weight: 650;
}
.login-error:empty { display: none; }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 28px 64px;
}

.hero { margin-bottom: 18px; }
.eyebrow { display: none; }
h1 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.1;
}
h1.down { color: var(--down); }
h1.degraded { color: #a45d12; }
.lead {
  margin: 8px 0 0;
  color: var(--graphite);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 500;
  max-width: 42em;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.stat {
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
}
.stat .n {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat .l {
  margin-top: 6px;
  font-size: 12px;
  color: var(--graphite);
  font-weight: 600;
}
.stat.up { background: color-mix(in srgb, var(--up) 24%, white); }
.stat.warn { background: color-mix(in srgb, var(--yellow) 72%, white); }
.stat.down { background: color-mix(in srgb, var(--down) 16%, white); }

.alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.alert {
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--down);
}
.alert.warn { border-left-color: var(--warn); }
.alert strong { display: block; font-size: 14px; letter-spacing: -0.02em; }
.alert span { color: var(--graphite); font-size: 13px; }

.incidents-sheet { margin-bottom: 16px; }
.incident {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid rgba(18, 18, 18, 0.08);
}
.incident:first-child { border-top: 0; padding-top: 0; }
.incident time { color: var(--graphite); font-size: 12px; }
.incident strong { display: block; font-size: 14px; }
.incident .reason { color: var(--graphite); font-size: 13px; margin-top: 2px; }

.infra {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
  align-items: start;
}
.sheet {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 18px 12px;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
details.sheet > .sheet-head {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}
details.sheet[open] > .sheet-head { margin-bottom: 10px; }
details.sheet > .sheet-head::-webkit-details-marker { display: none; }
h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.sheet-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tag {
  font-size: 12px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.06);
}
.tag.up { background: color-mix(in srgb, var(--up) 28%, white); }
.tag.down { background: color-mix(in srgb, var(--down) 18%, white); }
.tag.warn { background: color-mix(in srgb, var(--yellow) 75%, white); }
.tag.muted { color: var(--graphite); }
.muted { color: var(--graphite); font-size: 14px; margin: 0; }

.kpi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.kpi-item {
  background: color-mix(in srgb, var(--blue) 22%, white);
  border-radius: 12px;
  padding: 8px 10px;
}
.kpi-item .v { font-size: 16px; font-weight: 700; letter-spacing: -0.03em; }
.kpi-item .t { margin-top: 2px; font-size: 12px; color: var(--graphite); }

.list { display: grid; }
.item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid rgba(18, 18, 18, 0.06);
}
.item:last-child { border-bottom: 0; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
}
.dot.up { background: var(--up); }
.dot.down { background: var(--down); }
.dot.warn { background: var(--warn); }
.dot.unknown { background: var(--gray); }
.item-title { font-size: 14px; font-weight: 650; letter-spacing: -0.02em; }
.item-sub { margin-top: 2px; font-size: 12px; color: var(--graphite); line-height: 1.35; }
.item-right {
  text-align: right;
  font-size: 12px;
  font-weight: 650;
  color: var(--graphite);
  white-space: nowrap;
}
.item-right.up { color: #1a7a4c; }
.item-right.down { color: var(--down); }
.item-right.warn { color: #a45d12; }

.fold {
  margin-top: 6px;
  border-top: 1px dashed rgba(18, 18, 18, 0.12);
  padding-top: 4px;
}
.fold summary {
  cursor: pointer;
  color: var(--graphite);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  padding: 6px 0;
}
.fold summary::-webkit-details-marker { display: none; }

.group { margin-bottom: 22px; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.group h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.group-count { color: var(--graphite); font-size: 13px; font-weight: 600; }

.group.stand {
  background: #fff;
  border-radius: var(--radius);
  padding: 4px 16px 14px;
}
.group.stand .group-head {
  cursor: pointer;
  list-style: none;
  margin: 0;
  padding: 12px 0;
}
.group.stand .group-head::-webkit-details-marker { display: none; }
.group.stand[open] .group-head { margin-bottom: 10px; }
.group.stand .cards { opacity: 0.92; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card.up { background: color-mix(in srgb, var(--blue) 28%, white); }
.card.warn, .card.degraded { background: color-mix(in srgb, var(--yellow) 62%, white); }
.card.down { background: color-mix(in srgb, var(--down) 14%, white); }
.card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.name { font-weight: 700; font-size: 15px; letter-spacing: -0.03em; }
.meta { font-size: 12px; color: var(--graphite); margin-top: 2px; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  white-space: nowrap;
}
.badge.up { background: var(--up); color: var(--ink); }
.badge.down { background: var(--down); }
.badge.warn, .badge.degraded { background: var(--warn); color: var(--ink); }
.metrics { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.metric {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.06);
}
.metric.ok { background: color-mix(in srgb, var(--up) 28%, white); }
.metric.bad { background: color-mix(in srgb, var(--down) 18%, white); }
.err { font-size: 12px; color: var(--down); font-weight: 600; line-height: 1.3; }

.map-page {
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  padding-bottom: 28px;
}
.map-page .hero { margin: 0 0 10px; }
.map-page h1 { font-size: 32px; }
.map-page h1.up { color: #14944a; }
.map-page h1.degraded { color: #c47d00; }
.map-page h1.down { color: var(--down); }
.map-page .summary { margin-top: 8px; }
.map-page .summary .stat { min-height: 0; padding: 8px 12px; }
.map-page .summary .n { font-size: 20px; }
.map-page .alerts { margin-bottom: 8px; }
.cpu {
  background-color: #141414;
  background-image:
    repeating-linear-gradient(90deg, #c9cbc2 0 6px, transparent 6px 13px),
    repeating-linear-gradient(90deg, #c9cbc2 0 6px, transparent 6px 13px),
    repeating-linear-gradient(#c9cbc2 0 6px, transparent 6px 13px),
    repeating-linear-gradient(#c9cbc2 0 6px, transparent 6px 13px);
  background-repeat: no-repeat;
  background-size: calc(100% - 36px) 7px, calc(100% - 36px) 7px, 7px calc(100% - 36px), 7px calc(100% - 36px);
  background-position: center top 8px, center bottom 8px, left 8px center, right 8px center;
  border-radius: 10px;
  padding: 26px 22px;
  box-shadow: 0 16px 40px rgba(18, 18, 18, 0.16);
}
.die {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 28%),
    #1e211d;
  border: 1px solid #3e453c;
  border-radius: 4px;
  padding: 12px;
  display: grid;
  gap: 12px;
}
.floor {
  display: grid;
  grid-template-columns: 1.25fr 1.25fr 1fr 0.9fr;
  gap: 8px;
  align-items: start;
}
.floor-io { grid-template-columns: 1.3fr 1fr; }
.block h3 {
  margin: 0 0 6px;
  color: #b7beae;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.block h3 span { color: #d5dccb; letter-spacing: 0; text-transform: none; font-weight: 650; }
.block h3 .bad { color: #ff8d8d; }
.block.stand { opacity: 0.72; }
.cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 4px;
}
.tile {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 4px 6px;
  border-radius: 2px;
  background: #3ddc78;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.28), inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.tile.up { background: #3ddc78; }
.tile.warn { background: #ffe14a; }
.tile.down { background: #ff5d5d; }
.tile.wait { background: #c5c8be; }
.tile-dot {
  grid-row: 1 / span 2;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: #0d5c30;
}
.tile.warn .tile-dot { background: #8a5a00; }
.tile.down .tile-dot { background: #8d1010; }
.tile.wait .tile-dot { background: #5c5e58; }
.tile.down .tile-name,
.tile.down .tile-ms { color: #3a0d0d; }
.tile-name {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #10210f;
}
.tile-ms {
  font-size: 10px;
  font-weight: 650;
  color: #243222;
}

@media (max-width: 1100px) {
  .floor, .floor-io { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .top, .page { padding-left: 16px; padding-right: 16px; }
  .summary, .infra { grid-template-columns: 1fr; }
  .summary { grid-template-columns: 1fr 1fr; }
  .top-meta { flex-direction: column; align-items: flex-end; gap: 2px; }
  .incident { grid-template-columns: 1fr auto; }
  .incident time { grid-column: 1 / -1; }
  .kpi { grid-template-columns: 1fr 1fr 1fr; }
}
