:root {
  color-scheme: dark;
  --bg: #0e1116;
  --panel: #161b22;
  --panel2: #1c232d;
  --line: #2a3038;
  --text: #dfe4ea;
  --muted: #8b97a6;
  --accent: #4f9dff;
  --ok: #3fb950;
  --warn: #d29922;
  --high: #f0883e;
  --crit: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.error { color: var(--crit); margin-top: 10px; min-height: 20px; }

/* ------------------------------------------------------------------ вход */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  width: 340px;
}

.login-box h1 { margin: 0 0 4px; font-size: 20px; }
.login-box label { display: block; margin: 18px 0 0; font-size: 13px; color: var(--muted); }

input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}

input:focus, select:focus { outline: 1px solid var(--accent); }

button {
  margin-top: 20px;
  padding: 10px 16px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #06121f;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 400;
  margin: 0;
  padding: 6px 12px;
}

button.ghost:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }

/* ---------------------------------------------------------------- панель */

header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

header h1 { margin: 0; font-size: 16px; font-weight: 600; }
header nav { display: flex; gap: 6px; margin-left: 12px; }

header nav button {
  margin: 0;
  padding: 6px 14px;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  font-weight: 500;
}

header nav button.active { background: var(--panel2); color: var(--text); }
header .spacer { flex: 1; }
header .stat { color: var(--muted); font-size: 12px; }

main { padding: 20px 24px 60px; max-width: 1500px; }

section { display: none; }
section.active { display: block; }

.toolbar { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.toolbar label { font-size: 12px; color: var(--muted); }
.toolbar input { width: 220px; }
.toolbar button { margin-top: 0; }

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

th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.clickable:hover { background: var(--panel); cursor: pointer; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--panel2);
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok { background: #10331c; color: var(--ok); }
.badge.warn { background: #3a2c0c; color: var(--warn); }
.badge.high { background: #3d2410; color: var(--high); }
.badge.crit { background: #40191a; color: var(--crit); }
.badge.live { background: #0e2b45; color: var(--accent); }

.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card h2 { margin: 0 0 12px; font-size: 15px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  min-width: 420px;
}

dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin: 0 0 14px; font-size: 16px; }

.link-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.link-box input { font-family: ui-monospace, monospace; font-size: 12px; }
.link-box button { margin: 0; white-space: nowrap; }

.progress {
  height: 4px;
  background: var(--panel2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.progress i { display: block; height: 100%; background: var(--accent); }
.empty { color: var(--muted); padding: 40px; text-align: center; }
