/* The server panel (HUB-15). Light and dark follow the system; no web fonts (no external resource). */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #1c2129;
  --muted: #5d6673;
  --accent: #2f6fe4;
  --accent-text: #ffffff;
  --row-hover: #eef3fd;
  --row-selected: #dfe9fc;
  --ok: #1f8a4c;
  --ok-bg: #e2f4ea;
  --warn: #9a6400;
  --warn-bg: #fdf1d8;
  --bad: #c0352b;
  --bad-bg: #fbe5e3;
  --info: #2459c2;
  --info-bg: #e3ecfc;
  --muted-bg: #e9ecf0;
  --log-bg: #12161c;
  --log-text: #d6dde6;
  --log-muted: #7d8794;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%);
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1d222a;
    --border: #2a313b;
    --text: #e3e7ec;
    --muted: #949daa;
    --accent: #5b8ff0;
    --accent-text: #0b1220;
    --row-hover: #1e2633;
    --row-selected: #23314a;
    --ok: #5fd08f;
    --ok-bg: #173324;
    --warn: #f0bd5a;
    --warn-bg: #3a2c10;
    --bad: #ff8278;
    --bad-bg: #3d1a17;
    --info: #8db3ff;
    --info-bg: #1b2a47;
    --muted-bg: #252b34;
    --log-bg: #0a0d11;
    --log-text: #cfd6df;
    --log-muted: #6c7581;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  padding: 0 20px 24px;
}

h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; letter-spacing: 0.2px; }
h2 { font-size: 14px; }

.mono { font-family: var(--mono); font-size: 12.5px; }

/* Header strip */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}
.top-title { display: flex; align-items: center; gap: 10px; }
.top-updated { color: var(--muted); font-size: 12.5px; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.fact { background: var(--surface); padding: 9px 12px; min-width: 0; }
.fact-wide { grid-column: span 2; }
.fact-label { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; }
.fact-value { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.fact-value.bad { color: var(--bad); }

/* Banner and notices */
.banner {
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid currentcolor;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-weight: 600;
}
.notice {
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0 0 10px;
  background: var(--bad-bg);
  color: var(--bad);
}
.notice.ok { background: var(--ok-bg); color: var(--ok); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card > h2 { margin-bottom: 10px; }
.card-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.count { color: var(--muted); font-weight: 400; }

.auth { border-color: var(--warn); }
.auth p { margin: 6px 0 10px; color: var(--muted); }

.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
@media (max-width: 1100px) { .columns { grid-template-columns: minmax(0, 1fr); } }

/* Forms */
.row-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; gap: 6px; }
input, select, button { font: inherit; font-size: 13.5px; color: var(--text); }
input, select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  min-width: 0;
}
#create-name { width: 200px; }
#auth-key { width: 280px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.quiet { background: transparent; }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button.small { padding: 2px 9px; font-size: 12.5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid th { color: var(--muted); font-weight: 500; font-size: 12px; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: var(--row-hover); }
.grid tbody tr.selected { background: var(--row-selected); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.grid td.dim { color: var(--muted); }
.grid td.actions { text-align: right; }
.grid td.actions button + button { margin-left: 6px; }
.actions-col { width: 1%; }
.empty { color: var(--muted); margin: 8px 0 2px; }

/* Status pills */
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-muted { background: var(--muted-bg); color: var(--muted); }

/* Log viewer */
.log-tools { display: flex; align-items: center; gap: 10px; }
.log {
  background: var(--log-bg);
  color: var(--log-text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0;
  height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-hint { color: var(--log-muted); }
.log .log-error { color: #ff8a80; }
.log .log-warn { color: #ffd479; }

/* Settings */
details summary { cursor: pointer; list-style-position: outside; }
details summary h2 { display: inline; }
.settings { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 12px 0 0; }
.settings dt { color: var(--muted); font-size: 12.5px; }
.settings dd { margin: 0; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
