:root {
  --bg: #f4f6f9; --card: #fff; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --primary: #0f766e; --primary-2: #115e59; --side: #0b2b2a;
  --green: #15803d; --amber: #b45309; --red: #b91c1c; --blue: #1d4ed8; --purple: #7c3aed;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--side); color: #cde7e4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { font-weight: 700; font-size: 18px; color: #fff; padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; }
.logo { background: var(--primary); width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; }
.sidebar nav { flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; gap: 10px; padding: 9px 18px; color: #cde7e4; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); }
.sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: #2dd4bf; }
.ico { width: 18px; text-align: center; opacity: .8; }
.me { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.me a { color: #5eead4; }

.content { flex: 1; padding: 0 28px 40px; min-width: 0; }
.topbar { padding: 20px 0 8px; }
.topbar h1 { margin: 0; font-size: 22px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 14px 0; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafafa; }
tr:hover td { background: #fafcfc; }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

form.row, .filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 7px; background: #fff; color: var(--text); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #99f6e4; border-color: var(--primary); }
.checks { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--text); }
.checks label { flex-direction: row; align-items: center; color: var(--text); }

.btn { display: inline-block; border: 0; border-radius: 7px; padding: 8px 14px; background: var(--primary); color: #fff; font: inherit; cursor: pointer; }
.btn:hover { background: var(--primary-2); }
.btn.secondary { background: #e5e7eb; color: var(--text); }
.btn.danger { background: #fee2e2; color: var(--red); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
form.inline { display: inline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.alert.ok { background: #dcfce7; color: #14532d; }
.alert.err { background: #fee2e2; color: #7f1d1d; }
.alert.info { background: #e0f2fe; color: #0c4a6e; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.green { background: #dcfce7; color: var(--green); }
.badge.amber { background: #fef3c7; color: var(--amber); }
.badge.red { background: #fee2e2; color: var(--red); }
.badge.grey { background: #f3f4f6; color: var(--muted); }
.badge.blue { background: #dbeafe; color: var(--blue); }
.badge.purple { background: #ede9fe; color: var(--purple); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.dot.off { background: #d1d5db; }

pre.payload { background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 7px; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; margin: 0; }
.tabs { display: flex; gap: 6px; margin: 10px 0; }
.tabs a { padding: 6px 12px; border-radius: 7px; background: #e5e7eb; color: var(--text); }
.tabs a.active { background: var(--primary); color: #fff; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--side); }
.login { background: #fff; padding: 28px; border-radius: 12px; width: 340px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar nav a { border-left: 0; padding: 8px 12px; }
  .content { padding: 0 14px 30px; }
}
