:root {
  --bg: #131417;
  --side: #16171b;
  --panel: #1b1c20;
  --card: #1d1e23;
  --card-hover: #23242a;
  --border: #2a2b31;
  --border-soft: #232429;
  --text: #e9eaee;
  --muted: #8d8f98;
  --dim: #6a6c74;
  --ok: #3ecf68;
  --warn: #e0a83a;
  --down: #f0564a;
  --idle: #565861;
  --radius: 16px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  height: 100vh;
}

/* ---------------------------------------------------------------- sidebar */

.side {
  background: var(--side);
  border-right: 1px solid var(--border-soft);
  padding: 20px 16px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 12px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: radial-gradient(120% 120% at 30% 20%, #34363d 0%, #1f2025 70%);
  border: 1px solid #33353c;
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px rgba(62, 207, 104, .55);
}

.brand-name { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 13px 13px 11px;
}

.panel-title {
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
}

.rows { display: flex; flex-direction: column; gap: 8px; }

.row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.row .k { color: var(--muted); }
.row .v { font-family: var(--mono); font-size: 11.5px; color: var(--text); text-align: right; white-space: nowrap; }
.row.plain { grid-template-columns: 76px minmax(0, 1fr); }
.row.plain .v { text-align: left; }

.bar {
  height: 4px;
  border-radius: 99px;
  background: #2b2c33;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #2fa257, var(--ok));
  transition: width .5s ease;
}
.bar.warn > i { background: linear-gradient(90deg, #b9822a, var(--warn)); }
.bar.down > i { background: linear-gradient(90deg, #b83a30, var(--down)); }

.cores { display: flex; flex-direction: column; gap: 6px; }
.core {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
}
.core .v { text-align: right; color: var(--muted); }

/* ------------------------------------------------------------------- main */

.main {
  overflow-y: auto;
  padding: 22px 26px 40px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.015em; }
.topbar-right { font-family: var(--mono); font-size: 11px; color: var(--dim); }

.pill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: #202127;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 13px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 15px 15px 12px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card:hover { background: var(--card-hover); border-color: #363840; transform: translateY(-1px); }
.card:focus-visible { outline: 2px solid #4c5bd4; outline-offset: 2px; }
.card.no-link { cursor: default; }

.card-head { display: flex; gap: 11px; align-items: flex-start; }

.icon {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #26272d;
  border: 1px solid #31333a;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.icon img { width: 20px; height: 20px; object-fit: contain; opacity: .95; }
.icon .mono {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.titles { min-width: 0; padding-top: 1px; }
.name-row { display: flex; align-items: center; gap: 7px; }
.name-row h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.desc {
  margin: 3px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--idle);
  box-shadow: 0 0 0 3px rgba(86, 88, 97, .12);
}
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(62, 207, 104, .14), 0 0 10px rgba(62, 207, 104, .45); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(224, 168, 58, .14); }
.dot.down { background: var(--down); box-shadow: 0 0 0 3px rgba(240, 86, 74, .14); }

.card-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chip {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  background: #202127;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 6px;
}
.chip.state-ok { color: #7fdc9c; border-color: #265335; background: #16261c; }
.chip.state-warn { color: #e7c27a; border-color: #4a3c1e; background: #241f14; }
.chip.state-down { color: #f3938a; border-color: #4d2622; background: #241716; }

.more {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #35373e;
  background: #23242a;
  color: var(--muted);
  font: 600 11px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.more:hover { background: #2c2e36; color: var(--text); border-color: #454852; }

/* ------------------------------------------------------------ detail panel */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 9, .45);
  backdrop-filter: blur(1px);
  z-index: 40;
}

.detail {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(440px, 94vw);
  background: #17181c;
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 48px rgba(0, 0, 0, .45);
  transform: translateX(102%);
  transition: transform .24s cubic-bezier(.22, .61, .36, 1);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.detail.open { transform: translateX(0); }

.detail-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.detail-icon {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #26272d;
  border: 1px solid #31333a;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.detail-icon img { width: 22px; height: 22px; object-fit: contain; }
.detail-icon .mono { font-family: var(--mono); font-size: 14px; font-weight: 600; }

.detail-titles { min-width: 0; flex: 1; }
.detail-name-row { display: flex; align-items: center; gap: 8px; }
.detail-name-row h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 640;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-desc { margin-top: 3px; font-size: 12px; color: var(--muted); }

.close {
  border: 1px solid #33353c;
  background: #22232a;
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.close:hover { color: var(--text); background: #2b2d35; }

.detail-body { padding: 18px 20px 28px; overflow-y: auto; }

.section-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 9px;
}

.kv { display: flex; flex-direction: column; gap: 7px; margin-bottom: 20px; }
.kv-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  font-size: 12px;
  align-items: baseline;
}
.kv-row .k { color: var(--muted); }
.kv-row .v { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.kv-row .v a { color: #8ab4ff; text-decoration: none; }
.kv-row .v a:hover { text-decoration: underline; }

.state-line {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 18px;
  font-size: 12.5px;
}
.state-line b { font-weight: 600; }
.state-line span.sub { color: var(--muted); font-family: var(--mono); font-size: 11px; }

.log {
  background: #101114;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
  color: #9fa3ad;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 18px;
}

.open-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #262933;
  border: 1px solid #383c48;
  color: #dfe3ec;
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 12.5px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
}
.open-btn:hover { background: #2e323e; }
.hint { margin-top: 12px; font-size: 11.5px; color: var(--dim); }

/* ------------------------------------------------------------------ mobile */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .main { padding: 18px 16px 32px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .detail { width: 100vw; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c2e35; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
