:root {
  --bg: #0b0d10;
  --bg2: #12151a;
  --card: #15191f;
  --line: #232a33;
  --text: #e8edf3;
  --muted: #8b97a6;
  --accent: #9ae66e;
  --accent-d: #6fbf49;
  --ok: #59d18c;
  --warn: #f2c14e;
  --bad: #f0685f;
  --radius: 12px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

code, .mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
}

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 0; letter-spacing: 0.01em; }
h3 { margin: 0 0 4px; font-size: 17px; }

.muted { color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.inline { display: inline; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 13, 16, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; color: var(--text); letter-spacing: -0.01em;
}
.brand b { font-weight: 650; }
.brand:hover { text-decoration: none; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(154, 230, 110, 0.7);
}
.dot.big { width: 14px; height: 14px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: var(--muted); padding: 7px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
}
.nav-link:hover { color: var(--text); background: var(--bg2); text-decoration: none; }
.nav-link.on { color: var(--text); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.who { display: flex; align-items: center; gap: 10px; }
.user { color: var(--muted); font-size: 13px; }

/* layout */
main.wrap { padding-top: 28px; padding-bottom: 40px; min-height: calc(100vh - 110px); }
.foot { color: #4e5867; font-size: 12px; padding-bottom: 24px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.head-actions { display: flex; gap: 8px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stat { padding: 14px 16px; margin: 0; }
.stat-k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-v { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; }
.stat.ok .stat-v { color: var(--ok); }
.stat.warn .stat-v { color: var(--warn); }
.stat.bad .stat-v { color: var(--bad); }

/* tablas */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); font-weight: 600;
  padding: 0 10px 8px 0; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid rgba(35, 42, 51, 0.6);
  vertical-align: middle;
  font-size: 13.5px;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(255, 255, 255, 0.015); }
.tbl-scroll { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 24px 0 !important; }
.note { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b9c4d1; }
.keycell { color: var(--accent); }
.keys-out {
  width: 100%; background: var(--bg); color: var(--accent);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  margin: 12px 0; resize: vertical;
}

/* badges */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.b-unused { color: #a7b3c2; background: #1d232c; border-color: #2c3540; }
.b-active { color: #9ff0b9; background: rgba(89, 209, 140, 0.12); border-color: rgba(89, 209, 140, 0.35); }
.b-expired { color: #ffd98a; background: rgba(242, 193, 78, 0.12); border-color: rgba(242, 193, 78, 0.35); }
.b-banned { color: #ff9d96; background: rgba(240, 104, 95, 0.12); border-color: rgba(240, 104, 95, 0.35); }

/* botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  font-family: inherit;
}
.btn:hover { background: #1a1f26; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #0d1607;
}
.btn-primary:hover { background: #a8ee81; }
.btn-ghost { background: transparent; }
.btn-ok { color: var(--ok); }
.btn-bad { color: var(--bad); }
.btn.off { opacity: 0.35; pointer-events: none; }
.acts { display: flex; gap: 4px; align-items: center; }

/* formularios */
label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%; margin-top: 6px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-d);
  box-shadow: 0 0 0 3px rgba(154, 230, 110, 0.12);
}
.stack { display: grid; gap: 12px; }
.gen { padding: 14px 18px; }
.gen-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.gen-form label { flex: 1 1 130px; }
.gen-form label:last-of-type { flex: 2 1 220px; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; }
.filters .grow { flex: 1; }
.filters select { width: auto; min-width: 150px; margin-top: 0; }
.filters input { margin-top: 0; }
.filters .btn { height: 40px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; }

/* flash */
.flash {
  border: 1px solid rgba(154, 230, 110, 0.35);
  background: rgba(154, 230, 110, 0.09);
  color: #c7f3ae; padding: 11px 14px; border-radius: 9px;
  margin-bottom: 16px; font-size: 14px;
}
.flash-err {
  border-color: rgba(240, 104, 95, 0.4);
  background: rgba(240, 104, 95, 0.1);
  color: #ffb4ae;
}

/* login */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(700px 420px at 50% -10%, rgba(154, 230, 110, 0.09), transparent 70%),
    var(--bg);
}
.login {
  width: 100%; max-width: 380px; padding: 26px;
  display: grid; gap: 14px;
}
.login-head { text-align: center; margin-bottom: 4px; }
.login-head .dot { margin: 0 auto 10px; }
.login-head h1 { font-size: 21px; }
.login-head p { font-size: 13px; }
.login .btn { width: 100%; height: 42px; margin-top: 4px; }

/* ajustes */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }

/* dialogo */
.dlg {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--text); padding: 22px;
  width: min(420px, 92vw);
}
.dlg::backdrop { background: rgba(0, 0, 0, 0.6); }
.dlg h3 { margin-bottom: 2px; }
.dlg p { font-size: 13px; margin: 0 0 14px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--accent); color: #0d1607; font-weight: 650; font-size: 13.5px;
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s; z-index: 50;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .grid.stats { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .top-in { gap: 12px; }
  .user { display: none; }
  .nav-link { padding: 6px 9px; }
}
@media (max-width: 560px) {
  .nav { overflow-x: auto; }
  .gen-form label { flex: 1 1 100%; }
  .filters { flex-wrap: wrap; }
}
