:root {
  --bg: #070b14; --panel: #0d1422; --panel-2: #111a2b; --line: #1c2740; --line-2: #26344f;
  --text: #e6ecf5; --muted: #8592a8; --accent: #2ee6c4; --accent-2: #4f8dff;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --r: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .2px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

.btn { border: 1px solid var(--line-2); background: var(--panel-2); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.btn:hover { border-color: #3a4c70; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04211c; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { opacity: .45; cursor: default; filter: none; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: #4a2330; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

input:not([type]), input[type=password], select {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; outline: none; width: 100%;
}
input:focus, select:focus { border-color: var(--accent-2); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(900px 500px at 70% 10%, #0f2a33 0%, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.login-card .brand { font-size: 18px; }
.login-card p { margin: -6px 0 4px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.err { color: var(--bad); margin: 0; font-size: 13px; }

/* shell */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: rgba(7, 11, 20, .92); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 0; padding: 7px 12px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--panel-2); color: var(--text); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
main { padding: 22px 24px 40px; max-width: 1280px; margin: 0 auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi b { display: block; font-size: 24px; font-weight: 650; }
.kpi span { color: var(--muted); font-size: 12.5px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 0 4px; }
.card-h { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.card-h h2 { font-size: 15px; margin: 0; font-weight: 600; }
.card-h .search, .card-h .inline { margin-left: auto; max-width: 280px; }
.inline { display: flex; gap: 8px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
#dev-tbl tbody tr { cursor: pointer; }
#dev-tbl tbody tr:hover td { background: #0f1828; }
.empty { color: var(--muted); padding: 18px 16px; margin: 0; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3b4760; margin-right: 8px; vertical-align: 1px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .15); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line-2); }
.badge.active { color: var(--ok); border-color: #1f4d3d; }
.badge.pending { color: var(--warn); border-color: #4d3f1a; }
.badge.blocked { color: var(--bad); border-color: #4a2330; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 11.5px; padding: 1px 7px; border-radius: 5px; background: #142036; color: #50607c; }
.chip.on { background: rgba(46, 230, 196, .12); color: var(--accent); }
.sync { font-size: 12px; color: var(--muted); }
.sync.lag { color: var(--warn); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 9; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--panel); border-left: 1px solid var(--line);
  z-index: 10; display: flex; flex-direction: column; }
.drawer-h { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 17px; font-family: var(--mono); }
.drawer-h p { margin: 4px 0 0; }
.drawer-b { overflow-y: auto; padding: 6px 20px 30px; }
.sec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.sec:last-child { border-bottom: 0; }
.sec h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.svc-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; }
.svc-row small { display: block; color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 99px; background: #22304a; border: 0; cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #cbd5e1; transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); background: #04211c; }
.switch:disabled { opacity: .4; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.field { display: grid; gap: 6px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.list li { display: grid; grid-template-columns: 148px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.list li:last-child { border-bottom: 0; }
.list li.muted { display: block; }
.list .t { color: var(--muted); white-space: nowrap; font-size: 12px; padding-top: 1px; }

.toasts { position: fixed; bottom: 20px; left: 20px; display: grid; gap: 8px; z-index: 20; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; min-width: 240px;
  animation: in .2s ease-out; }
.toast.bad { border-left-color: var(--bad); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  main { padding: 16px; }
  .tbl th:nth-child(5), .tbl td:nth-child(5), .tbl th:nth-child(6), .tbl td:nth-child(6) { display: none; }
}
