:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #20242a;
  --muted: #697280;
  --line: #dfe3e8;
  --accent: #176b5c;
  --accent-strong: #0e4f43;
  --danger: #b42318;
  --soft: #f8fafb;
  --shadow: 0 18px 48px rgba(19, 31, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
}

.topbar {
  min-height: 88px;
  padding: 18px clamp(16px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

h1, h2, p {
  margin: 0;
}

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

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.topbar p,
.peer-head p,
.empty {
  color: var(--muted);
}

.layout {
  width: min(1320px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.toolbar {
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.toolbar-meta span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.peer-list,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-card {
  padding: 18px;
}

.status {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status.on {
  color: #0e5f36;
  background: #dcf8e8;
}

.status.off {
  color: #6b4b00;
  background: #fff1bf;
}

.status.online {
  color: #064e3b;
  background: #ccfbf1;
}

.status.online::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.hidden {
  display: none !important;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

form {
  margin: 0;
}

.stack {
  display: grid;
  gap: 14px;
}

.inline-form {
  display: flex;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus {
  border-color: rgba(23, 107, 92, 0.55);
  box-shadow: 0 0 0 3px rgba(23, 107, 92, 0.12);
  outline: none;
}

button,
.button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

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

.secondary,
.ghost {
  background: #eef2f5;
  color: var(--ink);
}

.secondary:hover,
.ghost:hover {
  background: #dfe6eb;
}

.danger {
  background: #fff0ed;
  color: var(--danger);
}

.danger:hover {
  background: #ffd8d1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

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

th {
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  transition: background 160ms ease, box-shadow 160ms ease;
}

tbody tr:hover {
  background: #fbfdfc;
}

tbody tr.is-online {
  box-shadow: inset 3px 0 0 #1f9d75;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric {
  color: #30404f;
  font-weight: 650;
  min-width: 82px;
}

.rename-form,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rename-form input {
  min-width: 160px;
  max-width: 220px;
  min-height: 36px;
  background: var(--soft);
}

.row-actions {
  flex-wrap: wrap;
  min-width: 280px;
}

.row-actions button,
.row-actions .button,
.rename-form button {
  min-height: 36px;
  padding: 8px 10px;
}

.compact-danger {
  min-width: auto;
}

.alert {
  margin-bottom: 16px;
  border-radius: 6px;
  padding: 10px 12px;
}

.alert.error {
  color: #7a271a;
  background: #ffebe7;
}

.alert.ok {
  color: #075234;
  background: #dff7eb;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-card h1 {
  margin-bottom: 20px;
}

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

  .toolbar-meta {
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-form,
  .row-actions,
  .rename-form {
    grid-template-columns: 1fr;
    display: grid;
  }
}
