:root {
  --bg: #0e0f13;
  --bg-elev: #181a21;
  --bg-elev-2: #21242e;
  --border: #2b2f3a;
  --text: #e7e9ee;
  --muted: #8b90a0;
  --accent: #ff3d71;
  --accent-2: #6c5ce7;
  --green: #2ecc71;
  --red: #ff5252;
  --yellow: #ffb020;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--red);
  font-size: 13px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  transition: filter 0.15s;
}
button:hover {
  filter: brightness(1.1);
}
button.ghost {
  background: var(--bg-elev-2);
  color: var(--text);
}
button.danger {
  background: var(--red);
}
button.warn {
  background: var(--yellow);
  color: #1a1a1a;
}
button.small {
  padding: 5px 10px;
  font-size: 12px;
}

input,
select {
  font-family: inherit;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent-2);
}

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: var(--radius);
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 {
  margin: 0;
  font-size: 24px;
}
.login-card h1 span {
  color: var(--accent);
}
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.login-card button {
  margin-top: 8px;
  padding: 11px;
}

/* ── Layout ────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  font-size: 20px;
  font-weight: 700;
  padding: 6px 10px 18px;
}
.sidebar .brand span {
  color: var(--accent);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
}
.nav-item:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--bg-elev-2);
  color: var(--text);
}
.nav-badge {
  display: inline-block;
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 999px;
}
.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
  padding: 10px;
}
.main {
  padding: 26px 30px;
  overflow: auto;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}
.page-header h2 {
  margin: 0;
  font-size: 22px;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}
.toolbar input {
  width: 260px;
}

/* ── Cards / stats ─────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card .label {
  color: var(--muted);
  font-size: 13px;
  text-transform: capitalize;
}
.card .value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
}
.card .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.card.alert {
  border-color: var(--accent);
  background: rgba(255, 61, 113, 0.08);
}
.card.alert .value {
  color: var(--accent);
}
button.linklike {
  background: none;
  color: var(--accent);
  padding: 0;
  font-weight: 600;
  font-size: 13px;
}
button.linklike:hover {
  text-decoration: underline;
  filter: none;
}
button.ok {
  background: var(--green);
}
code {
  font-family: monospace;
  font-size: 12px;
  color: var(--muted);
}

/* ── Tabla ─────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
th,
td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-weight: 600;
  background: var(--bg-elev-2);
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elev-2);
  vertical-align: middle;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge.ok {
  background: rgba(46, 204, 113, 0.15);
  color: var(--green);
}
.badge.bad {
  background: rgba(255, 82, 82, 0.15);
  color: var(--red);
}
.badge.warn {
  background: rgba(255, 176, 32, 0.15);
  color: var(--yellow);
}
.badge.neutral {
  background: var(--bg-elev-2);
  color: var(--muted);
}
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(720px, 92vw);
  max-height: 86vh;
  overflow: auto;
  padding: 24px;
}
.modal h3 {
  margin: 0 0 14px;
}
.modal .close {
  float: right;
  background: var(--bg-elev-2);
  color: var(--muted);
}
.detail-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.detail-grid .k {
  color: var(--muted);
}
pre.json {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  font-size: 12px;
  max-height: 320px;
}
.section-title {
  margin: 20px 0 10px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.empty {
  color: var(--muted);
  padding: 40px;
  text-align: center;
}
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 8px;
  z-index: 100;
  font-size: 13px;
}
.toast.ok {
  border-color: var(--green);
}
.toast.err {
  border-color: var(--red);
}
