:root {
  --bg: #05070b;
  --bg-2: #0c1220;
  --card: #121a2b;
  --card-2: #182338;
  --line: rgba(27, 184, 255, 0.18);
  --text: #f3f6fb;
  --muted: #9aadc8;
  --brand: #004aad;
  --blue: #1e5397;
  --cyan: #1bb8ff;
  --bright: #2f7bff;
  --ok: #3ddc97;
  --warn: #ffc857;
  --bad: #ff6b8a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(47, 123, 255, 0.22), transparent 55%),
    radial-gradient(700px 380px at -10% 20%, rgba(0, 74, 173, 0.45), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Liberation Sans", "Noto Sans", "Segoe UI", sans-serif;
  line-height: 1.45;
}
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  left: 0;
  top: 0;
}
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(5, 7, 11, 0.72);
  position: sticky;
  top: 0;
  height: 100vh;
}
.marca { display: block; margin-bottom: 22px; }
.marca svg { width: 100%; height: auto; display: block; }
body.auth .marca { margin-bottom: 12px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side a, .bottom-nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px; border-radius: 12px; color: var(--muted); font-weight: 600;
}
.side a.activo, .bottom-nav a.activo { background: rgba(27, 184, 255, 0.12); color: white; }
.side .salir { margin-top: 24px; }
.main { padding: 22px 22px 48px; max-width: 1080px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.nav-btn, .bottom-nav { display: none; }
h1 { font-size: 1.7rem; line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.03em; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 1.02rem; max-width: 62ch; }
.tarjeta, .lista a.item, form.panel, .aviso, .vacio {
  background: linear-gradient(180deg, rgba(24, 35, 56, 0.92), rgba(18, 26, 43, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tarjeta { padding: 18px; }
.rejilla { display: grid; gap: 14px; }
.rejilla.tres { grid-template-columns: repeat(3, 1fr); }
.rejilla.dos { grid-template-columns: 1.4fr 0.8fr; }
.accion {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 148px;
  background: linear-gradient(160deg, #1e5397, #004aad 55%, #07224d);
  border: none; color: white;
}
.accion strong { font-size: 1.35rem; letter-spacing: -0.03em; }
.cifra { font-size: 1.8rem; font-weight: 750; letter-spacing: -0.04em; color: white; }
.cifra.ok { color: var(--ok); }
.cifra.bad { color: var(--bad); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; color: var(--cyan); font-weight: 700; margin-bottom: 6px; }
.boton, button.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 14px; border: 0; cursor: pointer;
  background: linear-gradient(90deg, var(--bright), var(--cyan)); color: #041018; font-weight: 750;
}
.boton.secundario { background: transparent; color: white; border: 1px solid var(--line); }
.boton.peligro { background: transparent; color: var(--bad); border: 1px solid rgba(255, 107, 138, 0.4); }
.boton.ancho { width: 100%; }
.fila-botones { display: flex; flex-wrap: wrap; gap: 8px; }
label.campo { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; font-weight: 650; }
label.campo span { color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%; background: #0b1220; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 12px; min-height: 48px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); border-color: transparent; }
.campos { display: grid; gap: 12px; }
.campos.dos { grid-template-columns: 1fr 1fr; }
.campos.tres { grid-template-columns: repeat(3, 1fr); }
.campos.seis { grid-template-columns: repeat(6, 1fr); }
form.panel { padding: 16px; display: grid; gap: 14px; }
.aviso { padding: 12px 14px; margin-bottom: 12px; }
.aviso.ok { border-color: rgba(61, 220, 151, 0.45); }
.aviso.error { border-color: rgba(255, 107, 138, 0.5); }
.aviso.warn { border-color: rgba(255, 200, 87, 0.55); }
.lista { display: grid; gap: 8px; }
.lista a.item, .fila {
  display: grid; gap: 4px 12px; padding: 14px; color: inherit;
}
.lista a.item { grid-template-columns: 1fr auto; align-items: center; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 0.75rem; font-weight: 750; }
.badge.pendiente { background: rgba(255, 200, 87, 0.16); color: var(--warn); }
.badge.en_tramite { background: rgba(27, 184, 255, 0.16); color: var(--cyan); }
.badge.activo { background: rgba(61, 220, 151, 0.16); color: var(--ok); }
.badge.ko { background: rgba(255, 107, 138, 0.16); color: var(--bad); }
.badge.baja { background: rgba(154, 173, 200, 0.16); color: var(--muted); }
.badge.recomendada { background: rgba(61, 220, 151, 0.16); color: var(--ok); }
.badge.max { background: rgba(27, 184, 255, 0.16); color: var(--cyan); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
td.num, th.num { text-align: right; white-space: nowrap; }
.opcion { padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); display: grid; gap: 8px; }
.opcion.destacada { border-color: rgba(61, 220, 151, 0.7); box-shadow: 0 0 0 1px rgba(61, 220, 151, 0.25); }
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
body.auth .shell { display: block; width: min(460px, 100%); }
body.auth .main { padding: 0; max-width: none; }
.auth-card { width: 100%; padding: 22px; }
.vacio { padding: 22px; color: var(--muted); }
.historial { display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
.margen { border-color: rgba(255, 200, 87, 0.45); }
details { border-top: 1px solid var(--line); padding-top: 8px; }
summary { cursor: pointer; color: var(--muted); }
@media (max-width: 860px) {
  .shell { display: block; }
  .side {
    position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(84vw, 300px);
    transform: translateX(-105%); transition: transform 0.2s ease; height: 100vh;
  }
  .nav-toggle:checked ~ .shell .side { transform: none; }
  .nav-btn { display: inline-flex; }
  .bottom-nav {
    display: flex; position: fixed; z-index: 25; left: 0; right: 0; bottom: 0;
    background: rgba(5, 7, 11, 0.94); border-top: 1px solid var(--line);
    justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; justify-content: center; font-size: 0.78rem; padding: 8px 4px; }
  .main { padding: 16px 14px 128px; min-width: 0; }
  .opcion.destacada .rejilla.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opcion .cifra { font-size: 1.2rem; }
  .bottom-nav { box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35); }
  .rejilla.tres, .rejilla.dos, .campos.dos, .campos.tres, .campos.seis { grid-template-columns: 1fr 1fr; }
  .campos.seis { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 1.45rem; }
  .tabla-scroll { overflow-x: auto; max-width: 100%; }
details:not([open]) > :not(summary) { display: none; }
.opcion, .main, .shell { min-width: 0; }
}
@media (max-width: 520px) {
  .campos.dos { grid-template-columns: 1fr; }
}
