:root {
  color-scheme: dark;
  --bg: #08111f;
  --surface: #0f1a2b;
  --surface-2: #132238;
  --line: #26374f;
  --text: #f8fafc;
  --muted: #94a3b8;
  --quiet: #64748b;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #38bdf8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  overflow-x: hidden;
}

.shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

[hidden] { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 2px 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:disabled {
  cursor: wait;
  opacity: .55;
}

.summary-band {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 18px;
  align-items: center;
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #0f1a2b, #0b1728);
}

.status-orb {
  position: relative;
  width: 132px;
  height: 132px;
}

.status-orb svg {
  width: 132px;
  height: 132px;
  transform: rotate(-90deg);
}

.donut-track, .donut-pass {
  fill: none;
  stroke-width: 14;
}

.donut-track { stroke: #1e293b; }
.donut-pass {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 301.59;
  stroke-dashoffset: 301.59;
  transition: stroke-dashoffset .25s ease, stroke .25s ease;
}

.orb-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.orb-text strong {
  font-size: 28px;
}

.orb-text span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.badge, .count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}

.badge.pass { color: #86efac; border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.12); }
.badge.fail { color: #fca5a5; border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.12); }
.badge.unknown, .badge.muted { color: var(--muted); background: rgba(148,163,184,.09); }

.summary-copy h2 {
  font-size: 24px;
  line-height: 1.2;
}

.summary-copy p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.metric {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 16px;
}

.server-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.server-chart {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.server-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #1e293b;
}

.bar-pass {
  height: 100%;
  min-width: 0;
  background: var(--green);
  transition: width .25s ease;
}

.chart-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.failure-list, .details {
  display: grid;
  gap: 8px;
}

.failure-item, .detail-server {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.failure-item {
  padding: 12px;
}

.failure-item strong {
  display: block;
  margin-bottom: 4px;
  color: #fecaca;
  font-size: 13px;
}

.failure-item span {
  color: var(--muted);
  font-size: 12px;
}

.detail-server summary {
  min-height: 48px;
  padding: 13px;
  cursor: pointer;
  font-weight: 800;
}

.section-list {
  padding: 0 13px 13px;
  display: grid;
  gap: 10px;
}

.section-block h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid rgba(148,163,184,.12);
  font-size: 13px;
  line-height: 1.35;
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--quiet);
}

.dot.pass { background: var(--green); }
.dot.fail { background: var(--red); }

.refresh-wrap {
  position: relative;
}

.refresh-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 100;
  min-width: 180px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item:disabled {
  opacity: .5;
  cursor: wait;
}

.menu-item strong {
  font-size: 13px;
}

.menu-item small {
  color: var(--muted);
  font-size: 11px;
}

.failure-guidance {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(239,68,68,.07);
  border: 1px solid rgba(239,68,68,.2);
}

.cmd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.cmd-text {
  flex: 1;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(0,0,0,.35);
  color: var(--blue);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 12px;
}

.copy-btn {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.copy-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.failure-guidance dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  font-size: 12px;
}

.failure-guidance dt {
  color: var(--amber);
  font-weight: 700;
}

.failure-guidance dd {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 680px) {
  .shell { padding: 14px 10px 28px; }
  h1 { font-size: 24px; }
  .summary-band {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 16px 12px;
  }
  .status-line { justify-content: center; }
  .summary-copy h2 { font-size: 21px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:last-child { grid-column: 1 / -1; }
  .metric { padding: 11px 9px; }
  .metric strong { font-size: 22px; }
  .server-charts { grid-template-columns: 1fr; }
  .panel { padding: 12px; }
}
