/* =====================================================================
 * theme.css — Sistema de diseño Territorio360 · propuesta **Lumen**
 * (docs/SPEC_Rediseno_Frontend_Lumen.md, maquetado docs/02_Mockup_Lumen.html).
 *
 * Fondo claro, tipografía de sistema, tarjetas grandes de radio amplio,
 * botones píldora, barra lateral de vidrio y números grandes.
 *
 * Estrategia (SPEC §2): los componentes nuevos llevan prefijo `lm-` y las
 * clases del tema anterior (.panel, .btn, .pill, .table…) quedan como ALIAS
 * del aspecto nuevo, así las 118 pantallas que heredan de base.html toman el
 * diseño sin editarlas una por una.
 *
 * Escrito a mano (NO pasa por el build de Tailwind): un cambio de branding no
 * requiere re-build. El acento (--accent) lo inyecta base.html desde
 * SiteConfig.primary_color en runtime [CONF-12]; TODO el color de marca sale
 * de esa variable — ni un hexadecimal guinda escrito a mano.
 * ===================================================================== */

:root {
  /* ----- Tokens Lumen (SPEC §3 fase 1.1) ----- */
  --bg: #f5f5f7;
  --panel: #fff;
  --ink: #1d1d1f;
  --ink2: #515154;
  --ink3: #86868b;
  --line: rgba(0, 0, 0, .08);

  /* Acento: fallback guinda MORENA. base.html lo pisa con SiteConfig. */
  --accent: #9F2241;
  --accent-dark: color-mix(in srgb, var(--accent) 72%, #000);
  --accent-hi:   color-mix(in srgb, var(--accent) 88%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-grad: linear-gradient(155deg, var(--accent-hi), var(--accent-dark));
  --gold: #d9ab4b;

  /* Semánticos */
  --ok: #2f9e5b;  --ok-ink: #1b6b3d;
  --warn-ink: #7a5608;
  --bad: #c1272d; --bad-ink: #a3202a;
  --info-ink: #2f3f70;

  /* Pila tipográfica: SF en Apple, Inter de respaldo en Android/Windows. */
  --f-ui: "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont,
          "Inter", "Segoe UI", system-ui, sans-serif;

  /* ----- Alias de los nombres anteriores -----
   * Hay 716 usos de var(--muted) y 191 de var(--line-2) en línea dentro de los
   * templates: se conservan apuntando a los tokens nuevos. */
  --text: var(--ink);
  --muted: var(--ink3);
  --panel-2: #f7f7f8;
  --line-2: rgba(0, 0, 0, .16);
  --accent-2: var(--accent-hi);
  --green: var(--ok-ink);     --green-bg: rgba(47, 158, 91, .13);
  --amber: var(--warn-ink);   --amber-bg: rgba(217, 171, 75, .2);
  --red: var(--bad-ink);      --red-bg: rgba(193, 39, 45, .11);
  --blue: var(--info-ink);    --blue-bg: rgba(61, 76, 125, .12);
  --violet: #5b4b8a;          --violet-bg: rgba(91, 75, 138, .12);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -.025em; }

/* Evita el parpadeo de elementos Alpine (x-show/x-cloak) antes de hidratar. */
[x-cloak] { display: none !important; }

/* =====================================================================
 * ACCESO — fondo con manchas difusas animadas (aurora), tarjeta de vidrio y
 * los dos campos fusionados (SPEC §3 fase 3, decisión D7: sustituye la foto).
 * Los colores de la aurora se derivan del acento y del dorado: cambiar
 * primary_color en el admin cambia también esta pantalla.
 * ===================================================================== */
.lm-login { min-height: 100vh; display: grid; place-items: center; position: relative; overflow: hidden; padding: 56px 20px 88px; background: #fbfbfd; }
.lm-aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .6; will-change: transform; }
.lm-aurora i:nth-child(1) { width: 640px; height: 640px; left: -160px; top: -200px; background: color-mix(in srgb, var(--accent) 68%, #fff); animation: lm-d1 26s ease-in-out infinite alternate; }
.lm-aurora i:nth-child(2) { width: 560px; height: 560px; right: -120px; bottom: -180px; background: color-mix(in srgb, var(--gold) 82%, #fff); animation: lm-d2 30s ease-in-out infinite alternate; }
.lm-aurora i:nth-child(3) { width: 420px; height: 420px; left: 46%; top: 38%; background: color-mix(in srgb, var(--accent) 32%, #fff); opacity: .5; animation: lm-d3 22s ease-in-out infinite alternate; }
@keyframes lm-d1 { to { transform: translate(180px, 120px) scale(1.12); } }
@keyframes lm-d2 { to { transform: translate(-220px, -90px) scale(1.1); } }
@keyframes lm-d3 { to { transform: translate(-160px, 70px) scale(.9); } }
.lm-login-in { position: relative; z-index: 1; width: min(780px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.lm-brandname { margin-top: 14px; font-size: 15px; font-weight: 600; color: var(--ink2); letter-spacing: -.01em; }
.lm-login h1 { max-width: 13ch; font-size: clamp(34px, 8vw, 76px); line-height: 1.02; letter-spacing: -.045em; margin: 26px 0 14px; text-wrap: balance; }
.lm-login-sub { font-size: 19px; color: var(--ink2); max-width: 30ch; text-wrap: balance; }
.lm-lcard {
  margin-top: 34px; width: min(440px, 100%); padding: 10px; border-radius: 30px; text-align: left;
  background: rgba(255, 255, 255, .7);
  backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: 0 40px 90px -36px color-mix(in srgb, var(--accent-dark) 45%, transparent),
              0 0 0 1px rgba(255, 255, 255, .9), 0 0 0 2px rgba(0, 0, 0, .03);
}
.lm-fields { border-radius: 20px; background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); overflow: hidden; }
.lm-f { position: relative; display: block; }
.lm-f + .lm-f { border-top: 1px solid rgba(0, 0, 0, .09); }
.lm-f input { width: 100%; height: 62px; border: 0; background: none; padding: 24px 100px 6px 20px; font-size: 17px; outline: 0; box-shadow: none !important; border-radius: 0; }
.lm-f input::placeholder { color: transparent; }
.lm-f > span { position: absolute; left: 20px; top: 21px; font-size: 17px; color: var(--ink3); pointer-events: none; transition: all .16s ease; transform-origin: left; }
.lm-f input:focus + span, .lm-f input:not(:placeholder-shown) + span { top: 10px; font-size: 12px; }
.lm-fields:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.lm-eye { position: absolute; right: 62px; top: 13px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink3); border: 0; background: none; cursor: pointer; }
.lm-eye:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.lm-go { position: absolute; right: 11px; top: 11px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #b9b9bf; border: 0; cursor: pointer; transition: background .2s, transform .2s; }
.lm-lcard.is-ready .lm-go { background: var(--accent); }
.lm-go:hover { transform: scale(1.06); }
.lm-go.is-loading > svg { display: none; }
.lm-go.is-loading::after { content: ""; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: lm-spin .7s linear infinite; }
@keyframes lm-spin { to { transform: rotate(360deg); } }
@keyframes lm-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.lm-lcard form.shake { animation: lm-shake .4s; }
.lm-err { margin: 12px 12px 2px; color: var(--bad); font-size: 14px; font-weight: 500; }
.lm-lrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 12px 6px; font-size: 14px; color: var(--ink2); }
.lm-lrow a { color: var(--accent); font-weight: 600; }
.lm-lfoot { margin-top: 22px; font-size: 14px; color: var(--ink2); text-align: center; }
.lm-lfoot a { color: var(--accent); font-weight: 600; }
.lm-lfoot p + p { margin-top: 6px; color: var(--ink3); font-size: 13px; }

/* =====================================================================
 * SHELL — barra lateral de vidrio, barra superior móvil y contenido
 * (SPEC §3 fase 2; maquetado líneas 96-128 y 283-296)
 * ===================================================================== */
.lm-app { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.lm-side { position: sticky; top: 0; height: 100vh; padding: 16px 0 16px 16px; z-index: 40; }
/* Por encima del botón flotante de instalar la PWA (z-50), que si no se monta
 * sobre el cajón abierto. */
.lm-side.open { z-index: 60; }
.lm-side-in {
  height: 100%; display: flex; flex-direction: column; border-radius: 28px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .05);
  padding: 18px 12px 12px; overflow: hidden;
}
.lm-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; min-width: 0; }
.lm-brand .lm-mark { width: 40px; height: 40px; border-radius: 12px; }
.lm-brand b { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.lm-brand small { display: block; font-size: 12px; color: var(--ink3); }
.lm-mark {
  width: 56px; height: 56px; border-radius: 17px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, var(--accent-hi), var(--accent-dark));
  box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 55%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .35);
  flex: none;
}
.lm-find {
  margin: 16px 4px 8px; height: 38px; border-radius: 12px; background: rgba(0, 0, 0, .055);
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--ink3);
}
.lm-find input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 14px; color: var(--ink); }
.lm-find:focus-within { box-shadow: 0 0 0 3px var(--accent-ring); background: #fff; }
.lm-nav {
  flex: 1; overflow: auto; padding: 6px 2px 8px;
  scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .15) transparent;
}
.lm-nav::-webkit-scrollbar { width: 6px; }
.lm-nav::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .15); border-radius: 3px; }
.lm-ni {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px;
  border-radius: 12px; color: var(--ink2); font-size: 14.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.lm-ni:hover { background: rgba(0, 0, 0, .045); color: var(--ink); }
.lm-ni.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lm-ni svg { flex: none; }
.lm-core { padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.lm-grp > summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between;
  align-items: center; height: 34px; padding: 0 12px; font-size: 12.5px; font-weight: 600;
  color: var(--ink3); border-radius: 10px;
}
.lm-grp > summary::-webkit-details-marker { display: none; }
.lm-grp > summary:hover { color: var(--ink); }
.lm-grp > summary .r { display: flex; align-items: center; gap: 7px; }
.lm-grp > summary .n { font-variant-numeric: tabular-nums; }
.lm-grp > summary svg { transition: transform .2s; }
.lm-grp[open] > summary svg { transform: rotate(180deg); }
.lm-grp .lm-ni { min-height: 36px; font-size: 14px; }
.lm-user {
  display: flex; align-items: center; gap: 10px; padding: 12px 6px 4px;
  border-top: 1px solid var(--line); margin-top: 4px;
}
.lm-av {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--gold)); flex: none;
}
.lm-user > div { flex: 1; min-width: 0; }
.lm-user b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-user small { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink3); }
.lm-user small i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.lm-out { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink2); flex: none; }
.lm-out:hover { background: rgba(0, 0, 0, .06); color: var(--accent); }
.lm-by { padding: 6px 8px 0; font-size: 11.5px; color: var(--ink3); }
.lm-by b { color: var(--ink2); font-weight: 600; }
.lm-topbar { display: none; }
.lm-scrim { display: none; }
/* Botón de cerrar el cajón: solo existe cuando la barra es cajón (< 980 px). */
.lm-closer { display: none; }
.lm-main { padding: 32px clamp(20px, 3.2vw, 56px) 110px; min-width: 0; }

/* Distintivo "nuevo" del menú: módulo recién publicado. El parpadeo es lo que
 * lo hace notar; `prefers-reduced-motion` lo deja fijo (bloque del final). */
.lm-new {
  margin-left: auto; flex: none; height: 20px; padding: 0 9px; border-radius: 99px;
  display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  animation: lm-blink 1.6s ease-in-out infinite;
}
@keyframes lm-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-ring); }
  50%      { opacity: .45; box-shadow: 0 0 0 5px transparent; }
}

/* =====================================================================
 * COMPONENTES Lumen (SPEC §3 fase 1.2; maquetado líneas 130-476)
 * ===================================================================== */

/* ----- Encabezado de pantalla ----- */
.lm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.lm-kicker { font-size: 16px; color: var(--ink3); margin-bottom: 4px; }
.lm-head h1 { font-size: clamp(28px, 4.2vw, 54px); line-height: 1.04; letter-spacing: -.04em; }
/* El título de pantalla es el mismo esté o no dentro de .lm-head: así cada
 * template sólo tiene que escribir <h1>, sin cargar clases de tamaño. Va sin
 * restricción de profundidad porque hay encabezados anidados dos y tres
 * niveles (configuración, fichas), y el <h1> siempre es el título de la
 * pantalla: los títulos de tarjeta son <h2>. */
.lm-main h1 { font-size: clamp(28px, 4.2vw, 54px); line-height: 1.04; letter-spacing: -.04em; font-weight: 600; }
.lm-hsub { font-size: 16px; color: var(--ink2); margin-top: 8px; max-width: 62ch; line-height: 1.45; }
.lm-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ----- Botones ----- */
.lm-btn {
  height: 44px; padding: 0 20px; border-radius: 999px; display: inline-flex; align-items: center;
  gap: 8px; font-weight: 600; font-size: 15px; border: 0; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .12s cubic-bezier(.34, 1.56, .64, 1);
  text-decoration: none; color: var(--ink); background: transparent;
}
.lm-btn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.lm-btn.primary:hover { background: var(--accent-dark); }
.lm-btn.ghost { background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); }
.lm-btn.ghost:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.lm-btn.soft { background: var(--accent-soft); color: var(--accent); }
.lm-btn.soft:hover { background: color-mix(in srgb, var(--accent) 17%, transparent); }
.lm-btn.dark { background: var(--ink); color: #fff; }
.lm-btn.dark:hover { background: #000; }
.lm-btn.wa { background: #1fa855; color: #fff; }
.lm-btn.wa:hover { background: #178a46; }
.lm-btn.bad { background: rgba(193, 39, 45, .1); color: var(--bad-ink); }
.lm-btn.bad:hover { background: rgba(193, 39, 45, .18); }
.lm-btn.sm { height: 36px; padding: 0 15px; font-size: 14px; }
.lm-btn:active { transform: scale(.97); }
.lm-btn[disabled] { opacity: .5; cursor: not-allowed; }
.lm-ib { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--ink2); flex: none; border: 0; background: none; cursor: pointer; }
.lm-ib:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.lm-ib.bad:hover { color: var(--bad); background: rgba(193, 39, 45, .08); }

/* ----- Tarjetas y retículas ----- */
.lm-card { border-radius: 28px; padding: 28px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); position: relative; min-width: 0; }
.lm-card + .lm-card, .lm-stack > * + * { margin-top: 16px; }
.lm-card h2 { font-size: 19px; letter-spacing: -.02em; color: var(--ink); }
.lm-csub { font-size: 14px; color: var(--ink3); margin-top: 4px; line-height: 1.45; }
.lm-ch { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.lm-g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.lm-g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lm-g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.lm-g2 > .lm-card + .lm-card, .lm-g3 > .lm-card + .lm-card, .lm-g4 > .lm-card + .lm-card { margin-top: 0; }
.lm-split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lm-split > .lm-card + .lm-card { margin-top: 0; }

/* ----- Control segmentado / pestañas ----- */
.lm-seg { display: inline-flex; padding: 3px; border-radius: 13px; background: rgba(0, 0, 0, .06); }
.lm-seg button, .lm-seg a {
  height: 36px; padding: 0 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  color: var(--ink2); border: 0; background: none; cursor: pointer; display: inline-flex;
  align-items: center; gap: 8px; transition: background .15s; text-decoration: none;
}
.lm-seg button[aria-pressed="true"], .lm-seg a[aria-pressed="true"], .lm-seg .on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.lm-tabs { display: flex; margin-bottom: 22px; overflow: auto; padding-bottom: 2px; }
.lm-tabs .lm-seg { flex: none; }

/* ----- Avisos ----- */
.lm-note { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; border-radius: 20px; font-size: 14.5px; line-height: 1.45; margin-bottom: 16px; background: rgba(0, 0, 0, .04); color: var(--ink2); }
.lm-note svg { margin-top: 1px; flex: none; }
.lm-note.warn { background: rgba(217, 171, 75, .16); color: #6d4d07; }
.lm-note.info { background: rgba(61, 76, 125, .09); color: #2c3a66; }
.lm-note.ok { background: rgba(47, 158, 91, .12); color: var(--ok-ink); }
.lm-note.bad { background: rgba(193, 39, 45, .1); color: var(--bad-ink); }
.lm-note b { font-weight: 600; }

/* ----- Distintivos ----- */
.lm-bd { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: rgba(0, 0, 0, .06); color: var(--ink2); white-space: nowrap; }
.lm-bd.ok { background: rgba(47, 158, 91, .13); color: var(--ok-ink); }
.lm-bd.warn { background: rgba(217, 171, 75, .2); color: var(--warn-ink); }
.lm-bd.bad { background: rgba(193, 39, 45, .11); color: var(--bad-ink); }
.lm-bd.brand { background: var(--accent-soft); color: var(--accent); }
.lm-bd.blue { background: rgba(61, 76, 125, .12); color: var(--info-ink); }
.lm-bd.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ----- Tablas ----- */
.lm-tw { overflow: auto; margin: 0 -28px; padding: 0 28px; }
.lm-tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.lm-tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink3); padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.lm-tbl td { padding: 14px 14px 14px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lm-tbl tr:last-child td { border-bottom: 0; }
.lm-tbl td.num, .lm-tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.lm-tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.lm-tbl td b { font-weight: 600; }
.lm-tbl td small { display: block; color: var(--ink3); font-size: 12.5px; }

/* ----- Formularios ----- */
.lm-fl { display: block; min-width: 0; }
.lm-fl > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 7px; }
.lm-fl > small { display: block; font-size: 12.5px; color: var(--ink3); margin-top: 6px; line-height: 1.4; }
.lm-in {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 13px; border: 0; background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); font-size: 15px; outline: 0;
  transition: box-shadow .15s; appearance: none; -webkit-appearance: none; color: var(--ink);
}
select.lm-in { padding-right: 38px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
textarea.lm-in { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.45; font-family: inherit; }
.lm-in:focus { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-ring); }
.lm-in::placeholder { color: #a1a1a6; }
.lm-fg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.lm-fg .full { grid-column: 1 / -1; }
.lm-fh { font-size: 15px; font-weight: 600; margin: 26px 0 14px; padding-top: 20px; border-top: 1px solid var(--line); letter-spacing: -.01em; }
.lm-fh:first-child { margin-top: 0; padding-top: 0; border: 0; }
.lm-fa { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.lm-sw { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--line); }
.lm-sw:first-child { border-top: 0; padding-top: 0; }
.lm-sw b { display: block; font-size: 15px; font-weight: 600; }
.lm-sw small { display: block; color: var(--ink3); font-size: 13px; margin-top: 3px; line-height: 1.4; max-width: 60ch; }
.lm-sw input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px;
  border-radius: 99px; background: #d6d6db; position: relative; cursor: pointer;
  transition: background .2s; margin: 0; box-shadow: none;
}
.lm-sw input[type="checkbox"]::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25);
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
.lm-sw input[type="checkbox"]:checked { background: var(--ok); }
.lm-sw input[type="checkbox"]:checked::after { transform: translateX(20px); }
.lm-chk { display: inline-flex; align-items: center; gap: 9px; font-size: 14.5px; cursor: pointer; padding: 9px 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.lm-chk input { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.lm-chk:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* ----- Listas, cifras y piezas sueltas ----- */
.lm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 16px; }
.lm-stat { padding: 20px 22px; border-radius: 24px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); }
.lm-stat small { display: block; font-size: 13px; color: var(--ink3); margin-bottom: 8px; }
.lm-stat b { display: block; font-size: 32px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.lm-stat em { display: block; font-style: normal; font-size: 13px; color: var(--ink3); margin-top: 7px; }
.lm-stat.dark { background: var(--ink); color: #fff; box-shadow: none; }
.lm-stat.dark small, .lm-stat.dark em { color: rgba(255, 255, 255, .6); }
.lm-stat.brand { background: var(--accent-grad); color: #fff; box-shadow: none; }
.lm-stat.brand small, .lm-stat.brand em { color: rgba(255, 255, 255, .75); }
.lm-stat.bad b { color: var(--bad); }
.lm-stat.ok b { color: #1b8a4a; }
.lm-li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.lm-li:first-child { border-top: 0; padding-top: 0; }
.lm-li:last-child { padding-bottom: 0; }
.lm-li strong { display: block; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.lm-li small { display: block; font-size: 13.5px; color: var(--ink3); margin-top: 3px; line-height: 1.4; }
.lm-li .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lm-av2 { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; color: #fff; background: var(--c, var(--accent)); flex: none; }
.lm-sq { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.lm-pb { height: 10px; border-radius: 6px; background: rgba(0, 0, 0, .07); overflow: hidden; min-width: 60px; }
.lm-pb i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .6s cubic-bezier(.16, 1, .3, 1); }
.lm-pb.ok i { background: var(--ok); }
.lm-pb.bad i { background: var(--bad); }
.lm-dz { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; border-radius: 22px; padding: 30px 20px; background: rgba(0, 0, 0, .03); border: 2px dashed rgba(0, 0, 0, .16); color: var(--ink2); }
.lm-dz svg { color: var(--accent); }
.lm-dz b { font-size: 15px; }
.lm-dz small { font-size: 13px; color: var(--ink3); max-width: 34ch; }
.lm-step { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.lm-step > i { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-style: normal; font-weight: 600; font-size: 14px; flex: none; }
.lm-step h3 { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.lm-step p { font-size: 14px; color: var(--ink3); margin-top: 3px; line-height: 1.45; }
.lm-es { text-align: center; padding: 52px 20px; color: var(--ink3); }
.lm-es > i { width: 68px; height: 68px; border-radius: 22px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lm-es h3 { font-size: 19px; color: var(--ink); margin-bottom: 6px; }
.lm-es p { font-size: 14.5px; max-width: 44ch; margin: 0 auto; line-height: 1.5; }
.lm-chip { height: 36px; padding: 0 15px; border-radius: 99px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; color: var(--ink2); }
.lm-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }
.lm-chip:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.lm-chip[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.lm-search { display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 20px; border-radius: 19px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); color: var(--ink3); }
.lm-search:focus-within { box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px var(--accent-ring); }
.lm-search input { flex: 1; border: 0; outline: 0; background: none; font-size: 18px; color: var(--ink); min-width: 0; }
.lm-live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 99px; background: rgba(47, 158, 91, .12); color: #1f7a45; }
.lm-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); color: var(--ok); animation: lm-pulse-dot 2s infinite; }
@keyframes lm-pulse-dot { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.lm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* =====================================================================
 * CENTRO DE MANDO — mosaico "bento" (SPEC §3 fase 4.1; maquetado 141-199)
 * ===================================================================== */
.lm-bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.lm-t { border-radius: 28px; padding: 28px; position: relative; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); min-width: 0; }
.lm-t > h2 { font-size: 15px; font-weight: 600; color: var(--ink2); letter-spacing: -.01em; }
.lm-hero { grid-column: span 8; min-height: 408px; display: flex; flex-direction: column; }
.lm-hero::before { content: ""; position: absolute; right: -140px; top: -180px; width: 560px; height: 560px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--gold) 30%, transparent), transparent 66%); pointer-events: none; }
.lm-big { font-size: clamp(76px, 12vw, 164px); font-weight: 600; letter-spacing: -.065em; line-height: .92; margin-top: 8px; font-variant-numeric: tabular-nums; position: relative; }
.lm-sub { font-size: 18px; color: var(--ink2); margin-top: 8px; position: relative; }
.lm-hero-bot { margin-top: auto; position: relative; }
.lm-strip { display: flex; gap: 4px; height: 24px; position: relative; clip-path: inset(0 0 0 0 round 99px); animation: lm-reveal 1.3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lm-reveal { from { clip-path: inset(0 100% 0 0 round 99px); } to { clip-path: inset(0 0 0 0 round 99px); } }
.lm-strip i { flex: var(--v) 1 0; min-width: 6px; border-radius: 7px; background: var(--c); transition: opacity .2s; }
.lm-strip i:first-child { border-radius: 12px 7px 7px 12px; }
.lm-strip i:last-child { border-radius: 7px 12px 12px 7px; }
.lm-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 22px; margin-top: 20px; list-style: none; padding: 0; }
.lm-legend li { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink2); padding: 4px 0; min-width: 0; }
.lm-legend li i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.lm-legend li span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-legend li b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
/* Al pasar el cursor por la leyenda se atenúa todo lo demás: CSS puro, sin JS. */
.lm-hero-bot:has(.lm-legend li:hover) .lm-strip i { opacity: .2; }
.lm-legend li:hover { color: var(--ink); }
.lm-gauge { grid-column: span 4; color: #fff; background: var(--accent-grad); display: flex; flex-direction: column; }
.lm-gauge h2 { color: rgba(255, 255, 255, .82); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lm-gauge .lm-live { background: rgba(255, 255, 255, .16); color: #fff; }
.lm-gauge .lm-live i { background: #7cf0a8; color: #7cf0a8; }
.lm-ring { position: relative; width: min(100%, 232px); margin: 14px auto 6px; }
.lm-ring svg { width: 100%; height: auto; display: block; }
.lm-ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.lm-ring-c b { font-size: 56px; font-weight: 600; letter-spacing: -.05em; line-height: 1; }
.lm-ring-c small { font-size: 13px; color: rgba(255, 255, 255, .75); }
.lm-gauge > p { font-size: 14.5px; color: rgba(255, 255, 255, .85); text-align: center; }
.lm-link { margin-top: auto; padding-top: 18px; display: inline-flex; gap: 6px; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; color: #fff; width: 100%; }
.lm-link:hover svg { transform: translateX(3px); }
.lm-link svg { transition: transform .2s; }
.lm-ev { grid-column: span 4; }
.lm-ev header, .lm-pipe header, .lm-short header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
.lm-ev h2, .lm-pipe h2, .lm-short h2 { font-size: 19px; color: var(--ink); letter-spacing: -.02em; }
.lm-pill { font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.lm-ev ul { list-style: none; padding: 0; }
.lm-ev li { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 14px; align-items: center; padding: 9px 0; }
.lm-ev li + li { border-top: 1px solid var(--line); }
.lm-date { height: 54px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.lm-date b { font-size: 21px; font-weight: 600; letter-spacing: -.03em; }
.lm-date span { font-size: 12px; font-weight: 600; margin-top: 3px; }
.lm-ev strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-ev small { font-size: 13px; color: var(--ink3); }
.lm-pipe { grid-column: span 4; background: var(--ink); color: #f5f5f7; box-shadow: none; }
.lm-pipe h2 { color: #fff; }
.lm-pipe .lm-pill { background: rgba(255, 255, 255, .12); color: #fff; }
.lm-pipe ul { list-style: none; padding: 0; }
.lm-pipe li { display: grid; grid-template-columns: 16px 98px minmax(0, 1fr) 40px; gap: 10px; align-items: center; height: 32px; font-size: 14px; }
.lm-pipe .n { color: rgba(255, 255, 255, .4); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lm-pipe .l { color: rgba(255, 255, 255, .88); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-pipe .bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.lm-pipe .bar i { display: block; height: 100%; width: var(--w); border-radius: 4px; background: linear-gradient(90deg, var(--accent-hi), var(--gold)); transform-origin: left; animation: lm-grow 1.2s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lm-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.lm-pipe li > b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.lm-short { grid-column: span 4; }
.lm-sgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lm-sc { border-radius: 22px; padding: 16px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); display: flex; flex-direction: column; align-items: flex-start; gap: 26px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; min-height: 116px; min-width: 0; text-align: left; color: var(--ink); transition: transform .18s, box-shadow .18s; }
.lm-sc:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(0, 0, 0, .1), 0 14px 24px -14px rgba(0, 0, 0, .25); }
.lm-sc > i { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--t); color: var(--k); flex: none; }

/* =====================================================================
 * PADRÓN — lista en filas (SPEC §3 fase 4.3; maquetado 227-252)
 * ===================================================================== */
.lm-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.lm-list { border-radius: 28px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); overflow: hidden; }
.lm-row { display: grid; grid-template-columns: 44px minmax(180px, 1.7fr) minmax(110px, 1fr) 150px 190px minmax(110px, .9fr); gap: 16px; align-items: center; padding: 0 24px; min-height: 72px; }
.lm-row + .lm-row { border-top: 1px solid var(--line); }
.lm-row.hd { min-height: 48px; font-size: 12.5px; color: var(--ink3); font-weight: 600; background: rgba(0, 0, 0, .02); }
.lm-row:not(.hd):hover { background: color-mix(in srgb, var(--accent) 3.5%, transparent); }
.lm-pav { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; color: #fff; background: var(--c, var(--accent)); }
.lm-row strong { display: block; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.lm-row small { font-size: 13px; color: var(--ink3); }
.lm-aff { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; padding: 6px 12px 6px 10px; border-radius: 99px; background: color-mix(in srgb, var(--c) 13%, #fff); color: color-mix(in srgb, var(--c) 58%, #000); white-space: nowrap; }
.lm-aff::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.lm-stage small { display: block; margin-bottom: 6px; font-size: 13px; color: var(--ink2); }
.lm-stage div { display: flex; gap: 3px; }
.lm-stage i { width: 18px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .1); }
.lm-stage i.on { background: var(--accent); }
.lm-foot { padding: 16px 24px; font-size: 13.5px; color: var(--ink3); border-top: 1px solid var(--line); }

/* =====================================================================
 * MAPA — sólo el chrome: Leaflet, sus capas y sus escalas no se tocan
 * (SPEC §3 fase 4.2; maquetado 201-225)
 * ===================================================================== */
.lm-mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.lm-ins { border-radius: 30px; padding: 28px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); display: flex; flex-direction: column; min-width: 0; }
.lm-ins-z { font-size: 14px; color: var(--ink3); }
.lm-ins h3 { font-size: 36px; letter-spacing: -.045em; line-height: 1.05; margin: 2px 0 20px; }
.lm-ins-dl div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.lm-ins-dl dt { color: var(--ink2); }
.lm-ins-dl dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.lm-ins-h { margin-top: 18px; font-size: 13px; color: var(--ink3); }
.lm-ins-a { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 600; margin: 4px 0 12px; }
.lm-ins-a i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.lm-mixbar { display: flex; gap: 3px; height: 12px; }
.lm-mixbar i { border-radius: 4px; min-width: 3px; }
.lm-ins-btn { margin-top: auto; justify-content: center; }
.lm-ins-empty { margin: auto; text-align: center; color: var(--ink3); max-width: 230px; }
.lm-ins-empty h3 { font-size: 22px; color: var(--ink); margin: 14px 0 6px; letter-spacing: -.02em; }
.lm-ins-empty p { font-size: 14.5px; line-height: 1.45; }

/* =====================================================================
 * DÍA D — tablero en vivo (SPEC §3 fase 4.4; maquetado 254-274)
 * ===================================================================== */
.lm-dtop { border-radius: 30px; padding: 32px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px 56px; align-items: end; }
.lm-dtop .lm-big { font-size: clamp(72px, 11vw, 148px); }
.lm-dtop h2 { font-size: 15px; color: var(--ink2); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lm-track { position: relative; height: 26px; border-radius: 99px; background: rgba(0, 0, 0, .07); margin-bottom: 34px; }
.lm-track .f { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--gold)); min-width: 26px; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.lm-track .m { position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--ink); border-radius: 2px; }
.lm-track .m span { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.lm-dsub { font-size: 17px; color: var(--ink2); margin-top: 10px; }
.lm-secs { margin-top: 16px; border-radius: 30px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); padding: 14px 32px 22px; }
.lm-secs > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 8px; flex-wrap: wrap; }
.lm-secs h2 { font-size: 19px; letter-spacing: -.02em; }
.lm-secs > header span { font-size: 13px; color: var(--ink3); display: inline-flex; gap: 8px; align-items: center; }
.lm-sr { display: grid; grid-template-columns: 116px minmax(0, 1fr) 120px; gap: 20px; align-items: center; height: 46px; border-radius: 12px; padding: 0 10px; margin: 0 -10px; transition: background 1.4s; }
.lm-sr.flash { background: color-mix(in srgb, var(--gold) 28%, transparent); transition: none; }
.lm-sr > b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-sr .bar { height: 12px; border-radius: 7px; background: rgba(0, 0, 0, .06); overflow: hidden; }
.lm-sr .bar i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.lm-sr .bar i.meta { background: var(--ok); }
.lm-sr em { font-style: normal; text-align: right; font-size: 14px; color: var(--ink2); font-variant-numeric: tabular-nums; }

/* ----- Mapas: solo el chrome; Leaflet y sus capas no se tocan ----- */
.lm-mapbox { position: relative; height: 460px; border-radius: 24px; overflow: hidden; background: #eceef3; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.lm-mapcard { position: relative; height: calc(100vh - 236px); min-height: 500px; border-radius: 30px; overflow: hidden; background: #eceef3; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); }
.lm-mleg { position: absolute; left: 16px; bottom: 16px; z-index: 2; padding: 10px 16px; border-radius: 16px; background: rgba(255, 255, 255, .78); backdrop-filter: blur(16px); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); font-size: 12.5px; color: var(--ink2); display: flex; gap: 6px 14px; flex-wrap: wrap; max-width: calc(100% - 32px); }
.lm-mleg span { display: inline-flex; align-items: center; gap: 6px; }
.lm-mleg i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }

/* =====================================================================
 * ALIAS de las clases del tema anterior (SPEC §3 fase 1.3)
 * Las 118 pantallas que ya existen toman el aspecto Lumen sin editarlas.
 * ===================================================================== */
.panel { background: #fff; border: 0; border-radius: 28px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05); }
.panel-2 { background: rgba(0, 0, 0, .035); border: 0; border-radius: 16px; }
.header-strip { height: 4px; background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent)); border-radius: 2px; }
.gradient-header { background: var(--accent-grad); color: #fff; }

/* Botones: variante `sm` porque hay muchos en filas densas. */
.btn { height: 36px; padding: 0 15px; border-radius: 999px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: none; text-decoration: none; background: transparent; color: var(--ink); transition: background .15s, box-shadow .15s, transform .12s cubic-bezier(.34, 1.56, .64, 1); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--ink); border: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); }
.btn-ghost:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.btn-icon { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--ink2); cursor: pointer; }
.btn-icon:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }

/* Pills → distintivos Lumen. */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: rgba(0, 0, 0, .06); color: var(--ink2); }
.pill-green  { background: rgba(47, 158, 91, .13); color: var(--ok-ink); }
.pill-amber  { background: rgba(217, 171, 75, .2);  color: var(--warn-ink); }
.pill-red    { background: rgba(193, 39, 45, .11);  color: var(--bad-ink); }
.pill-blue   { background: rgba(61, 76, 125, .12);  color: var(--info-ink); }
.pill-violet { background: rgba(61, 76, 125, .12);  color: var(--info-ink); }
.pill-guinda { background: var(--accent-soft); color: var(--accent); }
.pill-gold   { background: rgba(217, 171, 75, .2); color: var(--warn-ink); }
.badge-section { background: rgba(217, 171, 75, .2); color: var(--warn-ink); padding: 3px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tablas: encabezado sin mayúsculas, filas más altas. */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--ink3); font-weight: 600; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); background: transparent; }
.table td { padding: 14px; font-size: 14.5px; border-bottom: 1px solid var(--line); }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3%, transparent); }

/* KPIs, anillos, progreso, pestañas. */
.kpi-value { font-size: 32px; font-weight: 600; letter-spacing: -.04em; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink3); font-weight: 500; }
.ring-icon { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.progress { height: 10px; border-radius: 6px; background: rgba(0, 0, 0, .07); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 6px; transition: width .6s cubic-bezier(.16, 1, .3, 1); }
.tab { height: 36px; padding: 0 18px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink2); cursor: pointer; border: 0; background: none; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); color: var(--ok); animation: lm-pulse-dot 2s infinite; }
.ai-pulse { animation: lm-pulse-dot 2.5s infinite; }

/* Campos de formulario de Django sin clases: aspecto .lm-in (SPEC fase 1.4).
 * Los campos OTP de apps/accounts/forms.py traen sus propias clases y quedan
 * fuera por el :not(). */
/* Solo dentro del shell autenticado: las pantallas de acceso y las públicas
 * (baja de SMS) traen sus propios campos y no se tocan. */
/* Las negaciones van en :where() para que la regla pese lo mismo que un
 * `.lm-search input`: así un buscador con marco propio puede desactivarla sin
 * pelear por especificidad (si no, salía un recuadro dentro de otro). */
.lm-main input:where(:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not(.otp-input):not([class*="text-center"])),
.lm-main select,
.lm-main textarea {
  border: 0; border-radius: 13px; background-color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
  font-size: 15px; color: var(--ink);
}
.lm-main input:where(:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not(.otp-input):not([class*="text-center"])):focus,
.lm-main select:focus, .lm-main textarea:focus {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-ring);
  border-color: transparent; outline: 0;
}
.lm-main input[type="checkbox"], .lm-main input[type="radio"] { accent-color: var(--accent); }

/* Un campo dentro de una fila flex arrastra su ancho intrínseco (~240 px) como
 * mínimo y empuja la pantalla en celular aunque traiga `flex-1`. El piso en 0
 * deja que encoja; sin esto, formularios como el financiero desbordan a 390 px. */
.lm-main input, .lm-main select, .lm-main textarea { min-width: 0; }
.lm-main .lm-search input, .lm-main .lm-find input, .lm-main .lm-chatbar input {
  box-shadow: none; background: none; height: auto;
}

/* ----- Tablas: contenedor con desplazamiento horizontal -----
 * Los usuarios operan desde celular y ahí ninguna tabla de 5+ columnas cabe.
 * La tabla se desliza en horizontal dentro de .table-wrap y el panel sigue
 * recortando sus esquinas. Las sombras de los bordes (técnica
 * background-attachment: local) avisan que hay más columnas hacia ese lado. */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;  /* inercia en iOS */
  overscroll-behavior-x: contain;     /* no arrastra la página al tocar el borde */
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  background-image:
    linear-gradient(90deg,  var(--panel) 55%, transparent),
    linear-gradient(270deg, var(--panel) 55%, transparent),
    radial-gradient(farthest-side at 0    50%, rgba(0,0,0,.10), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.10), transparent);
  background-position: 0 0, 100% 0, 0 0, 100% 0;
  background-size: 28px 100%, 28px 100%, 12px 100%, 12px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

/* Encabezados en una sola línea: fijan un ancho mínimo digno por columna. */
.table-wrap th { white-space: nowrap; }
.table-wrap td { overflow-wrap: break-word; }

/* En celular, celdas más compactas: caben más columnas antes de desplazar. */
@media (max-width: 640px) {
  .table th { padding: 10px; }
  .table td { padding: 11px 10px; font-size: 13.5px; }
}

/* Rejillas sin columnas declaradas (en celular casi todas: `grid lg:grid-cols-2`
 * no declara nada por debajo de lg). Una columna implícita se dimensiona `auto`,
 * que NO puede encoger por debajo del contenido más ancho: un nombre largo en una
 * fila flex empujaba la tarjeta fuera de la pantalla. Con el piso en 0, la
 * columna cabe siempre y el texto trunca como debe. Ningún template usa columnas
 * implícitas a propósito (no hay `grid-flow-col` en el repo). */
.lm-main .grid { grid-auto-columns: minmax(0, 1fr); }

.scroll-area::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

/* =====================================================================
 * Responsive del shell (SPEC fase 2): < 980 px la barra lateral se vuelve
 * cajón y aparece la barra superior con los 4 accesos fijos.
 * ===================================================================== */
@media (max-width: 1180px) {
  .lm-split { grid-template-columns: 1fr; }
  .lm-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lm-hero { grid-column: span 12; }
  .lm-gauge, .lm-ev, .lm-pipe, .lm-short { grid-column: span 6; }
  .lm-row { grid-template-columns: 44px minmax(160px, 1.6fr) 150px 190px; }
  .lm-row > :nth-child(3), .lm-row > :nth-child(6) { display: none; }
  .lm-mapgrid { grid-template-columns: 1fr; }
  .lm-ins { min-height: 300px; }
}
@media (max-width: 980px) {
  .lm-app { display: block; }
  .lm-side {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%;
    padding: 10px; transform: translateX(-104%);
    transition: transform .24s cubic-bezier(.2, .8, .2, 1);
  }
  .lm-side.open { transform: none; }
  .lm-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); backdrop-filter: blur(2px); }
  .lm-topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: 10px 16px; background: rgba(245, 245, 247, .82);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line); overflow: auto; scrollbar-width: none;
  }
  .lm-topbar::-webkit-scrollbar { display: none; }
  .lm-topbar .lm-mark { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
  .lm-topbar a { white-space: nowrap; padding: 8px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; color: var(--ink2); }
  .lm-topbar a.on { background: var(--accent); color: #fff; }
  .lm-topbar .lm-out-wrap { margin-left: auto; }
  .lm-closer { display: grid; margin-left: auto; }
  .lm-main { padding: 22px 16px 110px; }
}
@media (max-width: 700px) {
  .lm-card { padding: 22px; border-radius: 24px; }
  .lm-g2, .lm-g3, .lm-g4 { grid-template-columns: 1fr; }
  .lm-tw { margin: 0 -22px; padding: 0 22px; }
  .lm-fg { grid-template-columns: 1fr; }
  .lm-head h1 { font-size: clamp(26px, 7vw, 34px); }
  .lm-bento > * { grid-column: span 12 !important; }
  .lm-t { padding: 22px; border-radius: 24px; }
  .lm-hero { min-height: 0; }
  .lm-strip { margin-top: 28px; }
  .lm-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lm-dtop { grid-template-columns: 1fr; padding: 24px; }
  .lm-secs { padding: 10px 18px 16px; }
  .lm-sr { grid-template-columns: 84px minmax(0, 1fr) 86px; gap: 10px; }
  .lm-sr em { font-size: 12.5px; }
  /* En celular la fila se queda con avatar y nombre… salvo el avance en el
   * embudo, que es la columna por la que se consulta el padrón en campo.
   * Ocultarlo volvía imposible el paso 4.5 del guion (reporte de Julio). */
  .lm-row { grid-template-columns: 44px minmax(0, 1fr); padding: 12px 16px; row-gap: 8px; }
  .lm-row > :nth-child(n+3) { display: none; }
  .lm-row > .lm-stage { display: block; grid-column: 2; }
  .lm-row > .lm-stage small { margin-bottom: 4px; }
  .lm-row.hd { display: none; }
  .lm-ins { padding: 22px; border-radius: 24px; }
  .lm-ins h3 { font-size: 28px; }
}

/* =====================================================================
 * Movimiento y transiciones. Todo respeta `prefers-reduced-motion`
 * (bloque al final): quien pida menos movimiento NO ve ninguna.
 * ===================================================================== */

/* ----- Transición entre pantallas (View Transitions API nativa) ----- */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: t360-vt-out .18s cubic-bezier(.4,0,1,1) both; }
::view-transition-new(root) { animation: t360-vt-in .26s cubic-bezier(.16,1,.3,1) both; }
@keyframes t360-vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes t360-vt-in  { from { opacity: 0; transform: translateY(8px); } }

/* ----- Entrada del contenido principal ----- */
.t360-enter { animation: t360-in .32s cubic-bezier(.16,1,.3,1) both; }
@keyframes t360-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.fade-in     { animation: t360-fade .25s ease both; }
.fade-in-up  { animation: t360-in   .3s  cubic-bezier(.16,1,.3,1) both; }
.pop-in      { animation: t360-pop  .22s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes t360-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes t360-pop  { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }

/* ----- Botones: "presión" al click ----- */
.btn:active { transform: scale(.97); }
.btn-icon { transition: background .15s, color .15s, transform .12s cubic-bezier(.34,1.56,.64,1); }
.btn-icon:active { transform: scale(.92); }

/* Sin destello azul de toque en móvil (los usuarios operan desde celular). */
.btn, .btn-icon, .lm-btn, .lm-ib, .lm-ni, .tab, .pill, .lm-bd, .lm-chip { -webkit-tap-highlight-color: transparent; }

/* ----- Paneles/tarjetas interactivas (opt-in con .panel-hover) ----- */
.panel, .lm-card { transition: box-shadow .2s, transform .2s; }
.panel-hover { transition: box-shadow .2s, transform .2s; }
.panel-hover:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(0,0,0,.09), 0 14px 28px -16px rgba(0,0,0,.28); }

.table tbody tr { transition: background .15s; }
input, select, textarea { transition: box-shadow .15s, background .15s; }

/* ----- Transiciones de HTMX (swaps de parciales: búsqueda en vivo, etc.) ----- */
.htmx-swapping { opacity: 0; transition: opacity .12s ease; }
.htmx-settling { animation: t360-fade .2s ease; }
.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator { opacity: 1; }

/* =====================================================================
 * Accesibilidad: respetar la preferencia de menos movimiento del sistema.
 * ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .lm-ni:hover, .btn:active, .lm-btn:active,
  .btn-icon:active, .panel-hover:hover { transform: none !important; }
  /* El distintivo "nuevo" deja de parpadear, pero sigue visible. */
  .lm-new { opacity: 1 !important; }
}

/* ----- Puente con las clases .*-brand existentes en los templates ----- */
.bg-brand     { background-color: var(--accent) !important; }
.text-brand   { color: var(--accent) !important; }
.border-brand { border-color: var(--accent) !important; }
.hover\:bg-brand:hover { background-color: var(--accent) !important; }
.focus\:border-brand:focus { border-color: var(--accent) !important; }
.focus\:ring-brand:focus   { --tw-ring-color: var(--accent) !important; }

/* Pipeline a pantalla completa (SPEC fase 5): la misma tarjeta oscura del
 * bento, con renglones más altos y el porcentaje al final. */
.lm-pipe.big { grid-column: auto; padding: 32px; }
.lm-pipe.big li { grid-template-columns: 22px 150px minmax(0, 1fr) 70px 56px; height: 46px; font-size: 15px; }
.lm-pipe.big .bar { height: 10px; }
.lm-pipe.big li > em { font-style: normal; text-align: right; color: rgba(255, 255, 255, .55); font-size: 13.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .lm-pipe.big { padding: 22px; }
  .lm-pipe.big li { grid-template-columns: 18px 96px minmax(0, 1fr) 46px; font-size: 13.5px; }
  .lm-pipe.big li > em { display: none; }
}

/* Vista previa del color de la campaña (Configuración · Marca). */
.lm-prev { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; padding: 14px 16px; border-radius: 18px; background: rgba(0, 0, 0, .035); }
.lm-prev > i { width: 38px; height: 38px; border-radius: 12px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.lm-prev b { display: block; font-size: 14px; font-weight: 600; }
.lm-prev small { display: block; font-size: 12.5px; color: var(--ink3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
