:root {
  --bg: #f4f6f9; --panel: #fff; --text: #1d2433; --muted: #6b7385; --line: #e3e7ee;
  --accent: #0f7b6c; --accent-soft: #e3f3f0; --danger: #c0392b; --warn: #b9770e; --side: #14213d;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.hidden { display: none !important; }
#app { display: flex; min-height: 100vh; }
aside { width: 220px; background: var(--side); color: #cfd6e4; flex-shrink: 0; }
.brand { font-weight: 700; font-size: 17px; color: #fff; padding: 20px 18px; }
nav a { display: block; padding: 9px 18px; cursor: pointer; color: inherit; text-decoration: none; }
nav a:hover { background: rgba(255,255,255,.06); }
nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left: 3px solid #4fd1b5; padding-left: 15px; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 16px 18px 6px; }
main { flex: 1; padding: 24px 28px; min-width: 0; }
h2 { margin: 0 0 16px; font-size: 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { min-width: 0; overflow-x: auto; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } aside { width: 170px; } }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; }
.card table th { background: none; }
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; cursor: pointer; color: var(--text); text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: #c4cad6; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.danger { color: var(--danger); }
button.small { padding: 3px 8px; font-size: 12px; }
input, select { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #eef0f4; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.bad { background: #fbe9e7; color: var(--danger); }
.badge.warn { background: #fdf2e0; color: var(--warn); }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1em; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login form { width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0; font-size: 22px; }
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog form { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog h3 { grid-column: 1 / -1; margin: 0 0 4px; }
dialog .full { grid-column: 1 / -1; }
dialog .buttons { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text); font-size: 13px; }
.checks label { flex-direction: row; align-items: center; color: var(--text); font-size: 13px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--side); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 420px; }
.toast.show { opacity: 1; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #bbb; margin-right: 6px; }
.dot.on { background: #27ae60; }
