:root {
  --bg: #eef6fb;
  --surface: #ffffff;
  --surface-soft: #f5f9fc;
  --ink: #24313f;
  --muted: #7a8794;
  --line: #d7e3eb;
  --accent: #2fc6f6;
  --accent-strong: #12a9df;
  --accent-ink: #ffffff;
  --ok: #2fc06e;
  --warn: #f5a623;
  --bad: #ff5752;
  --unknown: #8794a3;
  --shadow: 0 14px 34px rgba(31, 68, 92, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #d9f1fb 0, #eef6fb 230px, #f6f9fc 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Aptos", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: #168ec1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.12;
}

h2 {
  font-size: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.meta {
  color: #5d7183;
  font-size: 14px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid #c9dce8;
  border-radius: 10px;
  background: var(--surface);
  color: #229dcc;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-button svg,
.action-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  border-color: var(--accent);
  background: #f2fbff;
  transform: translateY(-1px);
}

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

.spinning span {
  animation: spin 0.8s linear infinite;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.summary-item {
  padding: 17px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.summary-item:last-child {
  border-right: 0;
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.summary-item strong {
  font-size: 29px;
  font-weight: 600;
}

.summary-item.ok strong {
  color: var(--ok);
}

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

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

.summary-item.muted strong {
  color: var(--unknown);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 24px rgba(31, 68, 92, 0.08);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(420px, 100%);
  color: var(--muted);
  font-size: 14px;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafdff;
  color: var(--ink);
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
}

.segments {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #f7fbfe;
  padding: 3px;
}

.segment {
  border: 0;
  border-right: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 13px;
  cursor: pointer;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--accent-strong);
  color: var(--accent-ink);
  box-shadow: 0 5px 14px rgba(18, 169, 223, 0.25);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  background: #f5f9fc;
  color: #718496;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #f2f9fd;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.server-cell {
  display: grid;
  gap: 4px;
}

.server-cell strong {
  word-break: break-word;
}

.row-error {
  color: var(--warn);
  font-size: 12px;
}

.status-pill,
.probe {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.online,
.probe.ok {
  background: #e8f9ef;
  color: var(--ok);
}

.status-pill.degraded {
  background: #fff4dc;
  color: var(--warn);
}

.status-pill.offline,
.probe.bad {
  background: #ffeceb;
  color: var(--bad);
}

.status-pill.unknown,
.probe.muted {
  background: #eef3f7;
  color: var(--unknown);
}

.actions-column {
  text-align: right;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.action-button,
.primary-button,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.action-button:hover,
.primary-button:hover,
.secondary-button:hover {
  border-color: var(--accent);
  background: #f1fbff;
  transform: translateY(-1px);
}

.action-button {
  width: 36px;
  height: 36px;
  padding: 0;
  color: #38a9d0;
}

.action-button.copied {
  background: #e8f9ef;
  border-color: #bceccb;
  color: var(--ok);
}

.primary-button {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

.empty,
.config-error {
  color: var(--muted);
  text-align: center;
}

.config-error {
  margin: 16px 0 0;
  color: var(--bad);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 54, 70, 0.42);
  animation: fadeIn 140ms ease;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.22);
  animation: riseIn 170ms ease;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.qr-frame {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 18px;
}

.qr-frame img {
  width: min(280px, 100%);
  aspect-ratio: 1;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: space-between;
  }

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

  .summary-item {
    border-bottom: 1px solid var(--line);
  }

  .segments {
    width: 100%;
    overflow-x: auto;
  }

  .segment {
    flex: 1 0 auto;
  }
}
