:root {
  --bg: #050b1f;
  --bg-2: #0a1230;
  --surface: rgba(16, 26, 62, 0.72);
  --border: rgba(80, 130, 255, 0.22);
  --text: #eaf0ff;
  --muted: #8b9bc7;
  --gold: #f5a623;
  --gold-2: #ffc94d;
  --blue: #1e7bff;
  --cyan: #29b6ff;
  --green: #22e58b;
  --red: #ff5c7a;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 Inter, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(30, 123, 255, 0.22), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(245, 166, 35, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-color: var(--bg);
  background-attachment: fixed;
}

h1, h2, strong { font-family: Outfit, Inter, sans-serif; }
h1 { font-size: 1.5rem; margin: .5rem 0 0; }
h2 { margin: 0; font-size: 1.2rem; }
.muted { color: var(--muted); font-size: .85rem; }
.error { color: var(--red); min-height: 1.2em; margin: 0; font-size: .9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 40px rgba(30, 123, 255, 0.08);
}

/* Botones */
.btn {
  font: 600 .9rem Inter, sans-serif;
  border: 1px solid var(--border);
  background: rgba(30, 123, 255, 0.12);
  color: var(--text);
  padding: .55rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:hover { background: rgba(30, 123, 255, 0.24); }
.btn:focus-visible, input:focus-visible, select:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn.primary {
  border: none;
  color: #1a1000;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  box-shadow: 0 0 18px rgba(245, 166, 35, 0.35);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 0 26px rgba(245, 166, 35, 0.55); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255, 92, 122, .4); color: var(--red); background: rgba(255, 92, 122, .08); }
.btn.sm { padding: .3rem .65rem; font-size: .8rem; }

/* Formularios */
label { display: block; text-align: left; font-size: .82rem; color: var(--muted); margin-bottom: .8rem; }
input, select {
  display: block; width: 100%; margin-top: .3rem;
  padding: .6rem .8rem; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(5, 11, 31, .7);
  color: var(--text); font: inherit;
}
input:focus, select:focus { border-color: var(--cyan); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 2rem 1.8rem; text-align: center; }
.login-logo { width: 120px; height: 120px; filter: drop-shadow(0 0 22px rgba(41, 182, 255, .45)); }
.login-card .muted { margin: 0 0 1.4rem; }
.login-card .btn { width: 100%; margin-top: .4rem; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .8rem 1.5rem; border-bottom: 1px solid var(--border);
  background: rgba(5, 11, 31, .75); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: .8rem; }
.brand > div { display: flex; flex-direction: column; line-height: 1.2; }
.brand-logo { width: 42px; height: 42px; }
.tabs { display: flex; gap: .3rem; flex: 1; }
.tabs button {
  background: none; border: none; color: var(--muted); font: 600 .9rem Inter, sans-serif;
  padding: .5rem .9rem; border-radius: 9px; cursor: pointer;
}
.tabs button.active { color: var(--gold-2); background: rgba(245, 166, 35, .12); }
.user { display: flex; align-items: center; gap: .8rem; color: var(--muted); }

.content { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1rem 0; }
.toolbar input { max-width: 320px; margin: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat { padding: 1rem 1.2rem; }
.stat b { display: block; font: 700 1.8rem Outfit, sans-serif; }
.stat.gold b { color: var(--gold-2); }
.stat.green b { color: var(--green); }
.stat.blue b { color: var(--cyan); }
.stat.red b { color: var(--red); }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem 1rem; text-align: left; white-space: nowrap; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border); }
tr + tr td { border-top: 1px solid rgba(80, 130, 255, .1); }
td.actions { display: flex; flex-wrap: wrap; gap: .4rem; white-space: normal; min-width: 280px; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.badge { padding: .15rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge.ok { background: rgba(34, 229, 139, .14); color: var(--green); }
.badge.warn { background: rgba(245, 166, 35, .16); color: var(--gold-2); }
.badge.bad { background: rgba(255, 92, 122, .14); color: var(--red); }
.badge.forever { background: rgba(41, 182, 255, .16); color: var(--cyan); }

/* Diálogo */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); color: var(--text); padding: 1.5rem; width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(2, 5, 15, .75); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translate(-50%, 20px);
  background: var(--bg-2); border: 1px solid var(--border); padding: .7rem 1.2rem; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--red); color: var(--red); }

@media (max-width: 640px) {
  .topbar { padding: .8rem 16px; }
  .content { padding: 16px; }
  .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
