/* fenrir-panel — maquetación común. Móvil primero, sin scripts ni recursos de fuera.
   Los colores, las tipografías y el logo son del cliente: los pone estaticos/temas/<slug>/tema.css
   con las mismas variables que su web (--bg, --surface, --c1..--c5, --red, --grad). Lo de aquí
   abajo es solo el aspecto neutro para un cliente sin tema. */
:root {
  color-scheme: light dark;
  --bg: #f6f5f2; --bg-2: #eceae5; --surface: #ffffff; --surface-2: #f1efea;
  --line: #d8d6d0; --campo: #767069; --text: #1f2328; --muted: #565e66;
  --c1: #2f6f5e; --c2: #2f6f5e; --c3: #2f6f5e; --c4: #2f6f5e; --c5: #2f6f5e;
  --red: #a4291f; --red-soft: #a4291f; --ok: #1f6b3a; --error: #a4291f;
  --grad: linear-gradient(110deg, #2f6f5e, #2f6f5e);
  --grad-boton: var(--grad); --texto-boton: #ffffff;
  --peligro-fondo: #a4291f; --peligro-texto: #ffffff;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: var(--sans);
  --cabecera: rgba(255, 255, 255, .9);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181b; --bg-2: #101315; --surface: #1d2125; --surface-2: #252a2f; --line: #343a40;
          --campo: #7d868e; --text: #e7e9ea; --muted: #a4acb3; --c1: #8fd3bf; --c2: #5fb49c; --red-soft: #ff8a7a;
          --ok: #7fd49a; --error: #ff8a7a; --grad: linear-gradient(110deg, #5fb49c, #5fb49c);
          --texto-boton: #0f1412; --cabecera: rgba(21, 24, 27, .9); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px); }
img { max-width: 100%; }
a { color: var(--c1); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--c1); outline-offset: 3px; }
.saltar { position: absolute; left: -9999px; }
.saltar:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 30; border-radius: 12px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- cabecera: logo, salir y pestañas ---------- */
.cabecera { position: sticky; top: 0; z-index: 20; background: var(--cabecera);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); }
.cabecera-in { max-width: 64rem; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; }
.marca { display: inline-flex; align-items: center; min-width: 0; color: var(--text); text-decoration: none;
  font-weight: 600; }
.marca img { display: block; height: 38px; width: auto; }
.salir { margin: 0; flex-shrink: 0; }
.boton-salir { margin: 0; min-height: 40px; padding: 8px 16px; border-radius: 50px; background: transparent;
  border: 1.5px solid var(--line); color: var(--text); font-family: var(--sans); font-size: .8rem; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; cursor: pointer; }
.boton-salir:hover { border-color: var(--c2); }

.pestanas { max-width: 64rem; margin: 0 auto; padding: 0 16px 10px; }
.pestanas ul { list-style: none; margin: 0; padding: 4px; display: flex; gap: 4px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 50px; }
.pestanas li { flex: 1 1 0; min-width: 0; }
.pestanas a { display: block; text-align: center; padding: 9px 10px; border-radius: 50px; color: var(--muted);
  font-size: .86rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pestanas a:hover { color: var(--text); }
.pestanas a[aria-current="page"] { background: var(--grad-boton); color: var(--texto-boton); }

/* ---------- contenido ---------- */
main { position: relative; z-index: 2; max-width: 64rem; margin: 0 auto; padding: 22px 16px 64px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.12; }
h1 { font-size: clamp(1.75rem, 6vw, 2.5rem); font-weight: 800; margin: 0 0 16px; }
h2 label { display: inline; margin: 0; font: inherit; }
h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 12px; }
h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin: 18px 0 8px; }
.hola { color: var(--muted); font-weight: 300; margin: -8px 0 20px; }
.volver { margin: 0 0 12px; font-size: .9rem; }
.volver a { text-decoration: none; font-weight: 600; }
.volver a, .estrecha p > a, .nota a { display: inline-block; padding: 4px 0; }
p { margin: 0 0 12px; }

.tarjeta { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  padding: 20px; margin: 0 0 14px; }
.tarjeta > :last-child { margin-bottom: 0; }

/* pantallas de entrada (entrar, clave, segundo factor, borrar): tarjeta centrada con la franja de color */
.estrecha { max-width: 28rem; margin: 18px auto 24px; padding: 30px 22px 26px; border-radius: 26px; overflow: hidden;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .6); }
.estrecha::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 5px; background: var(--grad); }
.estrecha h1 { font-size: clamp(1.7rem, 7vw, 2.2rem); margin-bottom: 12px; }
.antetitulo { display: inline-flex; align-items: center; gap: 9px; font-size: .72rem; font-weight: 600;
  letter-spacing: 2.5px; text-transform: uppercase; color: var(--red-soft); margin: 0 0 12px; }
.antetitulo::before, .antetitulo::after { content: ""; width: 22px; height: 1.5px; background: var(--red-soft); }

/* ---------- formularios ---------- */
label { display: block; font-size: .88rem; font-weight: 600; margin: 14px 0 6px; }
label.casilla { display: flex; gap: 10px; align-items: center; font-weight: 400; }
input, select, textarea { width: 100%; min-height: 48px; margin: 0; padding: 12px 16px; background: var(--bg);
  color: var(--text); border: 1.5px solid var(--campo); border-radius: 14px; font-family: var(--sans); font-size: 1rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c1); box-shadow: 0 0 0 3px var(--c1); }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; padding: 0; accent-color: var(--c2); }
input[type="date"] { min-width: 0; }
textarea { resize: vertical; line-height: 1.5; }

p > .boton { margin: 0 0 6px; }
button, .boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  margin-top: 18px; padding: 12px 26px; border: 0; border-radius: 50px; background: var(--grad-boton);
  color: var(--texto-boton); font-family: var(--sans); font-size: .96rem; font-weight: 700; text-decoration: none;
  cursor: pointer; transition: transform .2s, box-shadow .2s; }
button:hover, .boton:hover { transform: translateY(-1px); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .55); }
.estrecha button[type="submit"] { width: 100%; }
button.peligro { background: var(--peligro-fondo); color: var(--peligro-texto); }
.boton-claro { background: transparent; border: 1.5px solid var(--c2); color: var(--c1); }
a.peligro { color: var(--red-soft); }
.en-fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.en-fila select { flex: 1 1 12rem; width: auto; }
.en-fila button { margin-top: 0; }

.error { color: var(--error); background: rgba(127, 127, 127, .06); border-left: 3px solid var(--error);
  border-radius: 0 12px 12px 0; padding: 8px 14px; margin: 10px 0; }
.error p { margin: 0; }
.error ul { margin: 6px 0 0; padding-left: 1.2rem; }
.ok { color: var(--ok); border-left: 3px solid var(--ok); border-radius: 0 12px 12px 0; padding: 8px 14px; margin: 0 0 14px; }
.nota { color: var(--muted); font-size: .9rem; font-weight: 300; }
ul.nota { padding-left: 1.2rem; }
.vacio { color: var(--muted); text-align: center; padding: 34px 12px; background: var(--surface);
  border: 1px dashed var(--line); border-radius: 20px; }

/* ---------- leads: contadores ---------- */
.recuento { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.recuento li:first-child { grid-column: 1 / -1; }
.recuento a { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; color: var(--text); text-decoration: none; transition: border-color .2s; }
.recuento a:hover { border-color: var(--c2); }
.recuento a[aria-current="page"] { border: 1.5px solid var(--c2); background: var(--surface-2); }
.recuento strong { order: -1; font-family: var(--serif); font-size: 2.3rem; font-weight: 800; line-height: 1.05; }
.recuento span { color: var(--muted); font-size: .86rem; font-weight: 600; }
.recuento a[aria-current="page"] span { color: var(--c1); }

/* ---------- leads: filtros ---------- */
.filtros { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; margin: 0 0 16px; }
.filtros > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; display: flex;
  justify-content: space-between; align-items: center; gap: 12px; border-radius: 18px; }
.filtros > summary::-webkit-details-marker { display: none; }
.filtros > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--c2);
  border-bottom: 2px solid var(--c2); transform: rotate(45deg); margin-top: -4px; transition: transform .2s; }
.filtros[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.rejilla { padding: 0 18px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.rejilla > div:nth-of-type(-n+3) { grid-column: 1 / -1; }
.rejilla > div { min-width: 0; }
.rejilla .acciones { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; }
.rejilla .acciones a { font-weight: 600; margin-top: 18px; }

/* ---------- leads y usuarios: tarjetas ---------- */
.lista li { display: flex; }
.lista li > a { flex: 1; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
.lista a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; align-content: start;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  color: var(--text); text-decoration: none; transition: border-color .2s; }
.lista a:hover { border-color: var(--c2); }
.lista .nombre { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
.lista .detalle { grid-column: 1 / -1; color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.estado { justify-self: end; align-self: start; font-size: .78rem; font-weight: 600; padding: 4px 12px; border-radius: 50px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--c1); }
.paginas { text-align: center; margin-top: 18px; }
.paginas a { font-weight: 600; }

/* ---------- ficha del lead ---------- */
.datos { margin: 0; display: grid; grid-template-columns: 1fr; }
.datos dt { color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; margin-top: 12px; }
.datos dt:first-child { margin-top: 0; }
.datos dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.datos .texto { white-space: pre-wrap; font-weight: 300; }
.historial { margin: 0; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.historial li { margin-bottom: 4px; }
.acciones-lead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.acciones-lead a { font-weight: 600; }
.pasos { padding-left: 1.2rem; }
.pasos li { margin-bottom: 10px; }
.clave-totp code { display: block; margin-top: 8px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; font-size: 1.05rem; letter-spacing: 1px; overflow-wrap: anywhere; }

@media (min-width: 640px) {
  .cabecera-in, .pestanas, main { padding-left: 24px; padding-right: 24px; }
  .marca img { height: 42px; }
  .pestanas ul { display: inline-flex; }
  .pestanas li { flex: 0 0 auto; }
  .pestanas a { padding: 9px 20px; }
  .recuento { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .recuento li:first-child { grid-column: auto; }
  .rejilla { grid-template-columns: repeat(2, 1fr); }
  .rejilla > div:nth-of-type(-n+3) { grid-column: auto; }
  .rejilla > div:first-of-type { grid-column: 1 / -1; }
  .lista { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
  .datos { grid-template-columns: minmax(8rem, 12rem) 1fr; gap: 10px 18px; }
  .datos dt, .datos dt:first-child { margin-top: 0; padding-top: 2px; }
  .datos dd { margin: 0; }
  .tarjeta { padding: 22px 24px; }
  .estrecha { padding: 36px 36px 30px; margin-top: 34px; }
}
@media (min-width: 900px) {
  /* Escritorio: logo, pestañas y Salir en una sola fila. */
  .cabecera { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 24px;
    max-width: 64rem; margin: 0 auto; padding: 12px 24px; position: sticky; }
  .cabecera::before { content: ""; position: absolute; inset: 0 calc(50% - 50vw); z-index: -1; background: var(--cabecera);
    border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .cabecera { background: none; border-bottom: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .cabecera-in { display: contents; }
  .marca { grid-column: 1; justify-self: start; }
  .pestanas { grid-column: 2; grid-row: 1; padding: 0; }
  .salir { grid-column: 3; justify-self: end; }
  .rejilla { grid-template-columns: 2fr 1fr 1fr; }
  .rejilla > div:first-of-type { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
