:root {
  --bg: #f3f5f8; --card: #fff; --text: #1f2933; --muted: #6b7785; --line: #e2e7ee;
  --primary: #1d5fd1; --primary-d: #164aa5; --ok: #1e8e4e; --warn: #c77700; --err: #c62b2b; --info: #2a7bbd;
  --top: #14233a;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 12px; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; }

.topbar { background: var(--top); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 54px; }
.topbar .brand { font-weight: 600; font-size: 17px; white-space: nowrap; }
.topbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topbar nav a { color: #c9d4e3; padding: 8px 12px; border-radius: 6px; white-space: nowrap; }
.topbar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.topbar nav a.active { background: rgba(255,255,255,.15); color: #fff; }
.topbar .user { display: flex; align-items: center; gap: 10px; color: #c9d4e3; white-space: nowrap; }
.topbar .user .link { color: #fff; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; border-left: 4px solid var(--primary); }
.stat.ok { border-left-color: var(--ok); } .stat.warn { border-left-color: var(--warn); }
.stat .num { font-size: 28px; font-weight: 600; }
.stat .lbl { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.disabled td { opacity: .55; }
tr.selected td { background: #eef4ff; }
tr.row-pending td { background: #fff8ec; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e8ecf1; color: #44505c; white-space: nowrap; }
.badge-confirmed { background: #dff3e7; color: var(--ok); }
.badge-pending { background: #fff0d6; color: var(--warn); }
.badge-offline { background: #eceff3; color: #6b7785; }
.badge-no_user { background: #e6f0fa; color: var(--info); }
.sev-info { background: #e6f0fa; color: var(--info); }
.sev-warning { background: #fff0d6; color: var(--warn); }
.sev-critical { background: #fde4e4; color: var(--err); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.dot.on { background: var(--ok); } .dot.off { background: #b8c1cc; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert.big { font-size: 16px; font-weight: 500; }
.alert-success { background: #e8f6ee; border-color: #b9e2c9; color: #155f35; }
.alert-error { background: #fdecec; border-color: #f3c0c0; color: #8a1c1c; }
.alert-warning { background: #fff5e3; border-color: #f2d49b; color: #7a4a00; }
.alert-info { background: #e9f2fb; border-color: #bcd6ef; color: #1b4f7c; }

.btn { display: inline-block; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f4f6f9; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { color: var(--err); border-color: #f0c4c4; }
.btn.danger:hover { background: #fdecec; }
.btn.wide { width: 100%; padding: 10px; }
button.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

.form label, .login-box label { display: block; margin-bottom: 12px; font-weight: 500; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cdd5df; border-radius: 7px; background: #fff; color: var(--text); }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .login-box input { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
input.narrow { width: 150px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8cff5; border-color: var(--primary); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.row3 .span2 { grid-column: span 2; }
@media (max-width: 800px) { .row3 { grid-template-columns: 1fr; } .row3 .span2 { grid-column: auto; } }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; }
.group-list { margin: 6px 0 0 24px; max-height: 220px; overflow-y: auto; }
.group-list.tall { max-height: 360px; margin-left: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 220px; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tabs a { padding: 6px 14px; border-radius: 7px; color: var(--muted); }
.tabs a.active { background: #fff; border: 1px solid var(--line); color: var(--text); }

progress { width: 140px; height: 10px; vertical-align: middle; accent-color: var(--ok); }
.details { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.message-preview { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; white-space: normal; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.login-box { max-width: 380px; margin: 80px auto; padding: 30px; }
.login-box h1 { justify-content: center; margin-bottom: 4px; }
.login-box p { text-align: center; margin-top: 0; }
