:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #737373;
  --line: #e4e4e7;
  --line-strong: #c8c8cf;
  --good: #12805c;
  --good-soft: #e8f6ef;
  --warn: #b27600;
  --warn-soft: #fff4d6;
  --bad: #c93d3d;
  --bad-soft: #fff0f0;
  --unknown: #69707d;
  --unknown-soft: #f1f3f5;
  --accent: #2f6fed;
  --shadow: 0 12px 28px rgba(18, 18, 18, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

input {
  font: inherit;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(246, 247, 248, 0.86);
  backdrop-filter: blur(10px);
  padding: 18px;
}

.login-overlay.hidden {
  display: none;
}

.login-modal {
  width: min(390px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(20, 20, 20, 0.16);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.login-modal label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-modal input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--ink);
  outline: none;
}

.login-modal input:focus {
  border-color: #7c8aa1;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--bad);
  font-size: 13px;
}

.primary-btn {
  height: 42px;
  border: 0;
  border-radius: 7px;
  background: #171717;
  color: #ffffff;
  cursor: pointer;
  font-weight: 750;
}

.shell {
  min-height: 100vh;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timestamp {
  min-width: 156px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 11px;
}

.timestamp span,
.timestamp strong {
  display: block;
}

.timestamp span {
  color: var(--muted);
  font-size: 11px;
}

.timestamp strong {
  font-size: 13px;
  margin-top: 2px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 12px;
}

.metric.good strong {
  color: var(--good);
}

.metric.warn strong {
  color: var(--warn);
}

.metric.bad strong {
  color: var(--bad);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.main-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.main-panel {
  padding: 18px;
}

.detail-panel {
  position: sticky;
  top: 18px;
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.online,
.status.online {
  background: var(--good);
}

.dot.warning,
.status.warning {
  background: var(--warn);
}

.dot.down,
.status.down {
  background: var(--bad);
}

.dot.unknown,
.status.unknown {
  background: var(--unknown);
}

.group-stack {
  display: grid;
  gap: 18px;
}

.group-title {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
}

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

.server-card {
  min-height: 178px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 13px;
  cursor: pointer;
  transition: border-color 0.14s ease, transform 0.14s ease;
}

.server-card:hover,
.server-card.selected {
  border-color: #7c8aa1;
  transform: translateY(-1px);
}

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

.server-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.server-title strong {
  font-size: 15px;
  font-weight: 750;
  word-break: break-word;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.online {
  background: var(--good-soft);
  color: var(--good);
}

.status-pill.warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill.down {
  background: var(--bad-soft);
  color: var(--bad);
}

.status-pill.unknown {
  background: var(--unknown-soft);
  color: var(--unknown);
}

.load-progress {
  position: sticky;
  bottom: 18px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 13px;
}

.load-progress.hidden {
  display: none;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.progress-copy span {
  color: var(--muted);
  text-align: right;
}

.progress-track {
  height: 7px;
  border-radius: 99px;
  background: #eceef1;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #171717;
  transition: width 0.2s ease;
}

.bar-row {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.bar {
  height: 6px;
  border-radius: 99px;
  background: #eceef1;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2d2f36;
}

.server-meta {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  margin-top: 13px;
  padding-top: 11px;
}

.detail-empty {
  min-height: 90px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
  font-size: 14px;
}

.detail-card {
  display: grid;
  gap: 12px;
}

.detail-ip {
  color: var(--muted);
  font-size: 13px;
}

.detail-role {
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.detail-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.detail-section {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.detail-section h3 {
  margin: 0;
  font-size: 13px;
}

.kv-grid {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 7px 10px;
  font-size: 12px;
}

.kv-grid span {
  color: var(--muted);
}

.kv-grid strong {
  min-width: 0;
  font-weight: 650;
  word-break: break-word;
}

.mini-list {
  display: grid;
  gap: 6px;
}

.mini-list div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  color: #303236;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.detail-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.mini-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-kpi strong {
  display: block;
  font-size: 18px;
  margin-top: 6px;
}

.service-list,
.events-list {
  display: grid;
  gap: 8px;
}

.service-row,
.event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
}

.service-row strong,
.event-row strong {
  font-size: 13px;
}

.service-row span,
.event-row span {
  color: var(--muted);
  font-size: 12px;
}

.events {
  margin-top: 22px;
}

.level {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.level.info {
  background: var(--accent);
}

.level.warning {
  background: var(--warn);
}

.level.critical {
  background: var(--bad);
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 25px;
  }
}
