:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --online: #07865f;
  --online-soft: #e4f7ef;
  --offline: #c73b3b;
  --offline-soft: #fdecec;
  --checking: #876400;
  --checking-soft: #fff7d6;
  --accent: #1c5d99;
  --accent-dark: #164b7c;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

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

.eyebrow,
.subtext {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 6px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

.clock {
  display: grid;
  align-content: center;
  min-width: 240px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.clock span,
.metric span,
.search span,
.toolbar-actions span {
  color: var(--muted);
  font-size: 0.85rem;
}

.clock strong {
  margin-top: 4px;
  font-size: 1.25rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 2.35rem;
  line-height: 1;
}

.metric-online {
  border-top: 4px solid var(--online);
}

.metric-offline {
  border-top: 4px solid var(--offline);
}

.metric-checking {
  border-top: 4px solid var(--checking);
}

.metric-total {
  border-top: 4px solid var(--accent);
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search {
  display: grid;
  gap: 7px;
  width: min(460px, 100%);
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 13px;
  color: var(--text);
  font: inherit;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(28, 93, 153, 0.14);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: end;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
}

.button-link.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.button-link.secondary:hover {
  background: #edf2f7;
}

button.danger {
  background: var(--offline);
}

button.danger:hover {
  background: #a72d2d;
}

.admin-form {
  display: block;
}

.admin-form form {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(180px, 0.8fr) auto;
  gap: 14px;
  align-items: end;
}

.admin-form label {
  display: grid;
  gap: 7px;
}

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

.actions form {
  margin: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf2f7;
  color: #344054;
  font-size: 0.82rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8fafc;
}

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

.name {
  font-weight: 700;
}

.ip {
  color: var(--muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge.online {
  background: var(--online-soft);
  color: var(--online);
}

.badge.offline {
  background: var(--offline-soft);
  color: var(--offline);
}

.badge.checking {
  background: var(--checking-soft);
  color: var(--checking);
}

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .clock {
    min-width: 0;
  }

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

  .admin-form form {
    grid-template-columns: 1fr;
  }
}

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

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

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