:root {
  --bg: #f5f7fb; --panel: #ffffff; --panel-2: #f0f3f9; --line: #e3e8f0; --text: #0f172a; --muted: #64748b;
  --brand: #7449e9; --brand-2: #5f36d6; --brand-soft: #efe9fe; --ok: #16a34a; --ok-soft: #dcfce7;
  --off: #94a3b8; --off-soft: #eef2f7; --warn: #d97706; --warn-soft: #fef3c7; --bad: #dc2626; --bad-soft: #fee2e2;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 24px rgba(15,23,42,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --panel: #121933; --panel-2: #0f1630; --line: #1f2a4a; --text: #e6ebf5; --muted: #8b98b8;
    --brand: #b68cff; --brand-2: #c9a6ff; --brand-soft: #2a1d52; --ok: #34d399; --ok-soft: #0f2e26;
    --off: #64748b; --off-soft: #172036; --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1414;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Poppins, Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(225deg, #d255f5, #7449e9); display: grid; place-items: center; color: #fff; font-size: 13px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.side-foot b { color: var(--text); display: block; }
.main { padding: 28px 34px; max-width: 1400px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.head p { margin: 4px 0 0; color: var(--muted); }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card h2 { margin: 0 0 14px; font-size: 15px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.stat { padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 500; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--panel-2); }
td .sub { color: var(--muted); font-size: 12px; }
th:first-child { border-top-left-radius: var(--radius); }
th:last-child { border-top-right-radius: var(--radius); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-on { color: var(--ok); background: var(--ok-soft); }
.b-off { color: var(--off); background: var(--off-soft); }
.b-warn { color: var(--warn); background: var(--warn-soft); }
.b-bad { color: var(--bad); background: var(--bad-soft); }
.b-plain::before { display: none; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; }

/* forms */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; font-weight: 500; }
input, select, textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { font-family: var(--mono); font-size: 13px; min-height: 90px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 13.5px; }
.check input { width: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-danger { background: var(--bad); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.inline { display: inline; }

/* alerts */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px; }
.alert-err { background: var(--bad-soft); color: var(--bad); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

/* key/value */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
pre.out { background: #0b1020; color: #d7e0f5; padding: 14px 16px; border-radius: 10px; overflow: auto; max-height: 420px; font-family: var(--mono); font-size: 12.5px; margin: 0; white-space: pre-wrap; }
.secret { font-family: var(--mono); background: var(--panel-2); border: 1px dashed var(--line); padding: 10px 12px; border-radius: 10px; overflow-wrap: anywhere; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent), radial-gradient(900px 500px at 110% 110%, var(--brand-soft), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 390px; padding: 30px; }
.auth .logo { padding: 0 0 18px; justify-content: center; }
.auth h1 { font-size: 19px; margin: 0 0 4px; text-align: center; }
.auth p.lead { color: var(--muted); text-align: center; margin: 0 0 22px; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 8px; margin: 6px auto 14px; width: fit-content; }
.otp { text-align: center; font-size: 22px; letter-spacing: .4em; font-family: var(--mono); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar select, .toolbar input { width: auto; min-width: 190px; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.right { text-align: right; }
.live { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .logo { padding: 0 10px 0 0; }
  .nav { display: flex; gap: 2px; flex-wrap: wrap; }
  .side-foot { display: none; }
  .main { padding: 18px 16px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
.center { text-align: center; }
td pre.out { max-width: 640px; max-height: 220px; font-size: 12px; padding: 10px 12px; }
.toolbar input[type=radio], .toolbar input[type=checkbox], .check input { min-width: 0; width: auto; }
.toolbar .check { white-space: nowrap; }
details.card > summary { cursor: pointer; list-style: none; font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "Abrir"; font-size: 12.5px; color: var(--brand); font-weight: 600; }
details.card[open] > summary::after { content: "Cerrar"; }
details.card[open] > summary { margin-bottom: 14px; }
.auth .btn { width: 100%; padding: 12px; }

/* logos */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand img.icon { width: 34px; height: 34px; border-radius: 9px; }
.brand .wm { height: 15px; width: auto; }
.brand .wm-light { display: none; }
.brand small { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-left: 2px; }
.auth .brand { flex-direction: column; gap: 14px; padding: 0 0 18px; }
.auth .brand img.icon { width: 64px; height: 64px; border-radius: 16px; }
.auth .brand .wm { height: 22px; }
@media (prefers-color-scheme: dark) { .brand .wm-dark { display: none; } .brand .wm-light { display: inline; } }
.card-pad table td { white-space: normal; overflow-wrap: anywhere; }
.card-pad table td.sub { white-space: nowrap; }
