/* ERP de Iberika · hoja base. Tokens, carcasa y piezas comunes. Ver erp/docs/DISENO.md. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/assets/fuentes/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/assets/fuentes/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --h: 190;                                   /* matiz de la casa: los neutros tiran al teal */
  --papel: oklch(0.985 0.004 var(--h));
  --papel-2: oklch(0.965 0.006 var(--h));     /* bandas, cabeceras de tabla */
  --superficie: oklch(0.995 0.002 var(--h));  /* paneles elevados */
  --linea: oklch(0.90 0.008 var(--h));
  --linea-fuerte: oklch(0.80 0.012 var(--h));
  --texto: oklch(0.24 0.02 var(--h));
  --texto-2: oklch(0.43 0.018 var(--h));
  --texto-3: oklch(0.56 0.014 var(--h));
  --tinta: oklch(0.235 0.022 200);            /* segunda capa: menú lateral */
  --tinta-2: oklch(0.29 0.024 200);
  --tinta-texto: oklch(0.90 0.012 200);
  --tinta-texto-2: oklch(0.72 0.016 200);
  --acento: oklch(0.56 0.105 184);
  --acento-hover: oklch(0.50 0.10 184);
  --acento-suave: oklch(0.56 0.105 184 / 0.10);
  --acento-texto: oklch(0.99 0.005 184);
  --atencion: oklch(0.66 0.17 47);
  --atencion-suave: oklch(0.66 0.17 47 / 0.12);
  --ok: oklch(0.58 0.13 150);
  --ok-suave: oklch(0.58 0.13 150 / 0.12);
  --error: oklch(0.56 0.19 25);
  --error-suave: oklch(0.56 0.19 25 / 0.10);
  --ambar: oklch(0.74 0.15 75);
  --ambar-suave: oklch(0.74 0.15 75 / 0.16);
  --icono-acento: var(--atencion);
  --sombra-1: 0 1px 1px oklch(0.24 0.03 200 / 0.05), 0 1px 3px oklch(0.24 0.03 200 / 0.07);
  --sombra-2: 0 1px 2px oklch(0.24 0.03 200 / 0.06), 0 6px 18px -6px oklch(0.24 0.03 200 / 0.16);
  --sombra-3: 0 2px 4px oklch(0.24 0.03 200 / 0.08), 0 24px 48px -12px oklch(0.24 0.03 200 / 0.28);
  --brillo: inset 0 1px 0 oklch(1 0 0 / 0.6);
  --r: 10px; --r-campo: 7px;
  --curva: cubic-bezier(.23, 1, .32, 1);
  --rapido: 160ms;
  --lateral: 264px;
  --fuente: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-tema="oscuro"] {
  color-scheme: dark;
  --papel: oklch(0.205 0.014 var(--h));
  --papel-2: oklch(0.235 0.016 var(--h));
  --superficie: oklch(0.25 0.016 var(--h));
  --linea: oklch(0.32 0.016 var(--h));
  --linea-fuerte: oklch(0.42 0.018 var(--h));
  --texto: oklch(0.93 0.008 var(--h));
  --texto-2: oklch(0.78 0.012 var(--h));
  --texto-3: oklch(0.64 0.012 var(--h));
  --tinta: oklch(0.17 0.014 200);
  --tinta-2: oklch(0.22 0.018 200);
  --acento: oklch(0.72 0.11 184);
  --acento-hover: oklch(0.78 0.10 184);
  --acento-suave: oklch(0.72 0.11 184 / 0.14);
  --acento-texto: oklch(0.18 0.02 184);
  --sombra-1: 0 1px 2px oklch(0 0 0 / 0.3);
  --sombra-2: 0 1px 2px oklch(0 0 0 / 0.35), 0 8px 20px -6px oklch(0 0 0 / 0.5);
  --sombra-3: 0 24px 48px -12px oklch(0 0 0 / 0.6);
  --brillo: inset 0 1px 0 oklch(1 0 0 / 0.05);
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"] {
    color-scheme: dark;
    --papel: oklch(0.205 0.014 var(--h)); --papel-2: oklch(0.235 0.016 var(--h)); --superficie: oklch(0.25 0.016 var(--h));
    --linea: oklch(0.32 0.016 var(--h)); --linea-fuerte: oklch(0.42 0.018 var(--h));
    --texto: oklch(0.93 0.008 var(--h)); --texto-2: oklch(0.78 0.012 var(--h)); --texto-3: oklch(0.64 0.012 var(--h));
    --tinta: oklch(0.17 0.014 200); --tinta-2: oklch(0.22 0.018 200);
    --acento: oklch(0.72 0.11 184); --acento-hover: oklch(0.78 0.10 184); --acento-suave: oklch(0.72 0.11 184 / 0.14); --acento-texto: oklch(0.18 0.02 184);
    --sombra-1: 0 1px 2px oklch(0 0 0 / 0.3); --sombra-2: 0 1px 2px oklch(0 0 0 / 0.35), 0 8px 20px -6px oklch(0 0 0 / 0.5); --sombra-3: 0 24px 48px -12px oklch(0 0 0 / 0.6);
    --brillo: inset 0 1px 0 oklch(1 0 0 / 0.05);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papel); color: var(--texto); font: 400 0.875rem/1.5 var(--fuente); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.728rem; font-weight: 650; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 0.75rem; max-width: 72ch; }
.num, td.num, .importe { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 4px; }
.saltar { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--superficie); padding: 8px 12px; border-radius: 6px; }
.saltar:focus { left: 8px; }
kbd { font: 500 0.6875rem/1 var(--fuente); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--linea-fuerte); background: var(--papel-2); color: var(--texto-2); }
::selection { background: var(--acento-suave); }

/* ---------- Carcasa ---------- */
.app { display: grid; grid-template-columns: var(--lateral) 1fr; min-height: 100dvh; }
.app.menu-plegado { --lateral: 68px; }
.lateral {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  background:
    radial-gradient(120% 60% at 0% 0%, oklch(0.42 0.07 184 / 0.35), transparent 60%),
    var(--tinta);
  color: var(--tinta-texto); border-right: 1px solid oklch(0 0 0 / 0.2);
}
/* Grano muy suave por encima de la tinta (como el del Hub): textura, nunca ruido. */
.lateral::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: url("/assets/graficos/grano.webp"); opacity: 0.06; mix-blend-mode: soft-light; }
.lateral > * { position: relative; z-index: 1; }
.lateral-cabeza { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 10px 16px; }
.marca { display: flex; align-items: center; gap: 10px; color: var(--tinta-texto); font-weight: 650; font-size: 0.95rem; letter-spacing: -0.01em; }
.marca:hover { text-decoration: none; }
.marca-ico { width: 28px; height: 28px; }
.empresa-activa { display: flex; align-items: center; gap: 10px; margin: 4px 10px 8px; padding: 8px 10px; border-radius: var(--r); background: oklch(1 0 0 / 0.05); color: var(--tinta-texto); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.06); }
.empresa-activa:hover { text-decoration: none; background: oklch(1 0 0 / 0.09); }
.empresa-sello { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; background: var(--c-empresa); color: oklch(0.99 0 0); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.3), 0 2px 6px oklch(0 0 0 / 0.3); flex: none; }
.empresa-nombre { flex: 1; min-width: 0; font-weight: 600; font-size: 0.8125rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empresa-nombre small { display: block; font-weight: 400; color: var(--tinta-texto-2); text-transform: capitalize; }
.menu { flex: 1; overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: thin; scrollbar-color: oklch(1 0 0 / 0.15) transparent; }
/* Menú: Inicio, y los módulos agrupados por áreas. Solo el módulo abierto lleva su color pleno; los demás, apagado.
   El nombre del módulo lleva a su portada (/m/<módulo>); la flecha de al lado despliega o pliega sus pantallas. */
.menu-area-nombre { margin: 16px 8px 4px; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: oklch(0.66 0.016 200); }
.menu-modulo-fila { display: flex; align-items: center; border-radius: 8px; transition: background var(--rapido) var(--curva); }
.menu-modulo-fila:hover { background: oklch(1 0 0 / 0.06); }
.menu-raiz, .menu-modulo-nombre { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 8px; border-radius: 8px; color: var(--tinta-texto-2); font-weight: 500; transition: color var(--rapido) var(--curva), background var(--rapido) var(--curva); }
.menu-raiz { margin-bottom: 2px; }
.menu-raiz:hover { background: oklch(1 0 0 / 0.06); }
.menu-raiz:hover, .menu-modulo-nombre:hover { color: var(--tinta-texto); text-decoration: none; }
.menu-texto { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-desplegar { flex: none; width: 32px; height: 32px; margin-right: 2px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--tinta-texto-2); cursor: pointer; }
.menu-desplegar:hover { background: oklch(1 0 0 / 0.08); color: var(--tinta-texto); }
.menu-flecha { width: 15px; height: 15px; opacity: 0.55; transition: transform var(--rapido) var(--curva), opacity var(--rapido) var(--curva); }
.menu-desplegar:hover .menu-flecha, .menu-desplegar:focus-visible .menu-flecha { opacity: 1; }
.menu-desplegar[aria-expanded="true"] .menu-flecha { transform: rotate(180deg); }
.menu .baldosa { width: 26px; height: 26px; border-radius: 7px; background: color-mix(in oklch, var(--c-m) 26%, var(--tinta-2)); color: color-mix(in oklch, var(--c-m) 45%, oklch(0.95 0.01 200)); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.08); transition: background var(--rapido) var(--curva), color var(--rapido) var(--curva); }
.menu .baldosa .ico { width: 16px; height: 16px; }
.menu-raiz:hover .baldosa, .menu-modulo-fila:hover .baldosa { color: oklch(0.97 0.01 200); }
.menu-modulo.activo > .menu-modulo-fila, .menu-raiz[aria-current="page"] { background: oklch(1 0 0 / 0.07); }
.menu-modulo.activo .menu-modulo-nombre, .menu-raiz[aria-current="page"] { color: oklch(0.98 0.005 200); font-weight: 600; }
.menu-modulo.activo .baldosa, .menu-raiz[aria-current="page"] .baldosa { background: color-mix(in oklch, var(--c-m) 78%, black); color: oklch(0.99 0 0); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.25), 0 1px 3px oklch(0 0 0 / 0.35); }
.menu-modulo-nombre[aria-current="page"] { box-shadow: inset 0 0 0 1px oklch(0.72 0.11 184 / 0.4); }
.menu-sub { margin: 2px 0 8px 34px; }
.menu-sub[hidden] { display: none; }
/* Encabezado de grupo: se lee como rótulo, no como enlace. Más pequeño, del color del módulo muy apagado y con un filete fino
   que corre hasta el borde; sin sangría propia ni mayúsculas. */
.menu-grupo { display: flex; align-items: center; gap: 8px; margin: 12px 8px 2px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em; color: oklch(0.68 0.02 200); color: oklch(from var(--c-m) 0.74 0.06 h); cursor: default; user-select: none; }
.menu-grupo::after { content: ""; flex: 1; height: 1px; background: oklch(1 0 0 / 0.12); background: linear-gradient(90deg, oklch(from var(--c-m) 0.62 0.07 h / 0.55), transparent); }
.menu-sub > .menu-grupo:first-child { margin-top: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 4px 8px; border-radius: 7px; color: var(--tinta-texto-2); font-size: 0.8125rem; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; font-family: inherit; }
.menu-item .ico { width: 16px; height: 16px; display: none; }
.menu-item:hover { color: var(--tinta-texto); background: oklch(1 0 0 / 0.06); text-decoration: none; }
.menu-item[aria-current="page"] { color: oklch(0.99 0 0); font-weight: 550; background: oklch(0.56 0.105 184 / 0.34); box-shadow: inset 0 0 0 1px oklch(0.72 0.11 184 / 0.32); }
.menu-config { margin-top: 8px; }
.menu-config > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 8px; border-radius: 7px; font-size: 0.8125rem; color: oklch(0.70 0.016 200); cursor: pointer; }
.menu-config > summary::-webkit-details-marker { display: none; }
.menu-config > summary:hover { background: oklch(1 0 0 / 0.06); color: var(--tinta-texto); }
.menu-config > summary .ico { width: 15px; height: 15px; }
.menu-config > summary .menu-flecha { margin-left: auto; }
.menu-config[open] > summary .menu-flecha { transform: rotate(180deg); }
.lateral-pie { border-top: 1px solid oklch(1 0 0 / 0.08); padding: 8px; display: grid; gap: 2px; }
.lateral-pie .menu-item { padding-left: 10px; min-height: 34px; }
.lateral-pie .menu-item .ico { display: block; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--tinta-2); font-size: 0.75rem; font-weight: 650; color: var(--tinta-texto); flex: none; }
.menu-plegado .marca span, .menu-plegado .empresa-nombre, .menu-plegado .empresa-activa > .ico, .menu-plegado .menu-texto, .menu-plegado .menu-desplegar, .menu-plegado .menu-sub { display: none; }
.menu-plegado .menu-area-nombre { height: 1px; margin: 10px 12px; background: oklch(1 0 0 / 0.1); }
.menu-plegado .menu-area-nombre span { display: none; }
.menu-plegado .menu-modulo-nombre, .menu-plegado .menu-raiz { justify-content: center; padding-inline: 0; }
.menu-plegado .lateral-cabeza { flex-direction: column; gap: 6px; padding-inline: 8px; }
.menu-plegado .empresa-activa { justify-content: center; margin-inline: 8px; padding-inline: 0; }

.marco { min-width: 0; display: flex; flex-direction: column; }
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px; background: color-mix(in oklch, var(--papel) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--linea); }
.migas { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--texto-3); font-size: 0.8125rem; white-space: nowrap; overflow: hidden; }
.migas a { color: var(--texto-2); display: inline-flex; }
.migas .ico { width: 16px; height: 16px; }
.migas [aria-current] { color: var(--texto); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.buscador { margin-left: auto; display: flex; align-items: center; gap: 8px; width: min(380px, 40vw); height: 36px; padding: 0 8px 0 10px; border-radius: 8px; border: 1px solid var(--linea); background: var(--superficie); color: var(--texto-3); font: inherit; cursor: pointer; box-shadow: var(--sombra-1); }
.buscador span { flex: 1; text-align: left; }
.buscador:hover { border-color: var(--linea-fuerte); }
.barra-acciones { display: flex; gap: 4px; }
.boton-icono { position: relative; width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--texto-2); cursor: pointer; }
.boton-icono:hover { background: var(--papel-2); color: var(--texto); }
.lateral .boton-icono { color: var(--tinta-texto-2); }
.lateral .boton-icono:hover { background: oklch(1 0 0 / 0.08); color: var(--tinta-texto); }
.asistente-boton { color: var(--acento); }
.contador { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--atencion); color: oklch(0.99 0 0); font-size: 0.625rem; font-weight: 700; display: grid; place-items: center; }
.solo-movil { display: none; }

.contenido { flex: 1; padding: 0 28px 48px; outline: none; }
.pie { display: flex; justify-content: space-between; padding: 14px 28px; color: var(--texto-3); font-size: 0.75rem; border-top: 1px solid var(--linea); }

/* Cabecera de página (con banda ilustrada del área si la hay) */
.cabecera { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 24px 0 18px; margin: 0 -28px 8px; padding-inline: 28px; isolation: isolate; }
.cabecera.con-banda { padding-top: 64px; }
.cabecera.con-banda::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--img-banda) center / cover no-repeat; -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent); mask-image: linear-gradient(180deg, #000 30%, transparent); opacity: 0.9; }
.cabecera.con-banda::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--papel) 0%, color-mix(in oklch, var(--papel) 70%, transparent) 45%, transparent 80%); }
/* Las bandas están hechas para el tema claro: en oscuro se apagan y se tiñen de la tinta para no deslumbrar. */
:root[data-tema="oscuro"] .cabecera.con-banda::before { opacity: 0.22; filter: saturate(0.7) brightness(0.8); }
@media (prefers-color-scheme: dark) { :root[data-tema="auto"] .cabecera.con-banda::before { opacity: 0.22; filter: saturate(0.7) brightness(0.8); } }
.cabecera-titulo { display: flex; align-items: center; gap: 14px; min-width: 0; }
.subtitulo { margin: 4px 0 0; color: var(--texto-2); }
.cabecera-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.baldosa { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: color-mix(in oklch, var(--c-modulo, var(--acento)) 14%, var(--superficie)); color: color-mix(in oklch, var(--c-modulo, var(--acento)) 85%, var(--texto)); flex: none; box-shadow: var(--brillo); }
.baldosa.grande { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(160deg, color-mix(in oklch, var(--c-modulo) 85%, white), var(--c-modulo)); color: oklch(0.99 0 0); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 6px 16px -6px color-mix(in oklch, var(--c-modulo) 70%, transparent); }
.baldosa.grande .ico { width: 24px; height: 24px; }

/* ---------- Botones ---------- */
.boton { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--r-campo); border: 1px solid var(--linea-fuerte); background: var(--superficie); color: var(--texto); font: 550 0.8125rem/1 var(--fuente); cursor: pointer; white-space: nowrap; box-shadow: var(--sombra-1), var(--brillo); transition: background var(--rapido) var(--curva), border-color var(--rapido) var(--curva), transform var(--rapido) var(--curva); }
.boton:hover { text-decoration: none; border-color: var(--texto-3); }
.boton:active { transform: translateY(1px); }
.boton .ico { width: 17px; height: 17px; color: var(--acento); }
.boton.primario { background: linear-gradient(180deg, color-mix(in oklch, var(--acento) 88%, white), var(--acento)); border-color: var(--acento-hover); color: var(--acento-texto); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.25), 0 2px 6px -2px color-mix(in oklch, var(--acento) 60%, transparent); }
.boton.primario .ico { color: currentColor; }
.boton.primario:hover { background: var(--acento-hover); }
.boton.peligro { color: var(--error); }
.boton.peligro .ico { color: var(--error); }
.boton.peligro.lleno { background: var(--error); border-color: var(--error); color: oklch(0.99 0 0); }
.boton.discreto { border-color: transparent; background: transparent; box-shadow: none; }
.boton.discreto:hover { background: var(--papel-2); }
.boton.pequeno { height: 30px; padding: 0 10px; font-size: 0.75rem; }
.boton.grande { height: 48px; padding: 0 20px; font-size: 0.95rem; }
.boton[disabled], .boton[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.boton[aria-busy="true"] { color: transparent; position: relative; }
.boton[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--texto-3); border-top-color: transparent; animation: girar 0.7s linear infinite; }
.boton.primario[aria-busy="true"]::after { border-color: var(--acento-texto); border-top-color: transparent; }
@keyframes girar { to { transform: rotate(360deg); } }
.grupo-botones { display: inline-flex; }
.grupo-botones .boton { border-radius: 0; margin-left: -1px; }
.grupo-botones .boton:first-child { border-radius: var(--r-campo) 0 0 var(--r-campo); }
.grupo-botones .boton:last-child { border-radius: 0 var(--r-campo) var(--r-campo) 0; }

/* ---------- Campos ---------- */
.campo { display: grid; gap: 5px; align-content: start; min-width: 0; }
.panel { min-width: 0; }
.campo > label, .campo > .etiqueta { font-size: 0.8125rem; font-weight: 550; color: var(--texto-2); }
.campo .obligatorio { color: var(--atencion); margin-left: 2px; }
.campo .ayuda { font-size: 0.75rem; color: var(--texto-3); }
.campo .error-campo { font-size: 0.75rem; color: var(--error); display: flex; gap: 4px; align-items: center; }
.entrada, input.entrada, select.entrada, textarea.entrada {
  width: 100%; min-height: 36px; padding: 7px 10px; border-radius: var(--r-campo); border: 1px solid var(--linea-fuerte);
  background: var(--superficie); color: var(--texto); font: 400 0.875rem/1.4 var(--fuente); box-shadow: inset 0 1px 2px oklch(0.24 0.03 200 / 0.05);
  transition: border-color var(--rapido) var(--curva), box-shadow var(--rapido) var(--curva);
}
textarea.entrada { min-height: 84px; resize: vertical; }
.entrada:hover { border-color: var(--texto-3); }
.entrada:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
.entrada[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-suave); }
.entrada.num { text-align: right; }
.entrada:disabled, .entrada[readonly] { background: var(--papel-2); color: var(--texto-2); }
.interruptor { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 36px; }
.interruptor input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--linea-fuerte); position: relative; cursor: pointer; transition: background var(--rapido) var(--curva); margin: 0; }
.interruptor input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: oklch(0.99 0 0); box-shadow: 0 1px 2px oklch(0 0 0 / 0.3); transition: transform var(--rapido) var(--curva); }
.interruptor input:checked { background: var(--acento); }
.interruptor input:checked::after { transform: translateX(16px); }
.rejilla-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.rejilla-campos .completo { grid-column: 1 / -1; }
.ref-buscador { position: relative; }
.ref-lista { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra-3); }
.ref-lista li { padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.ref-lista li[aria-selected="true"], .ref-lista li:hover { background: var(--acento-suave); }

/* ---------- Paneles y pestañas ---------- */
.panel { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra-1); }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--linea); }
.panel > header h2 { font-size: 1rem; }
.panel-cuerpo { padding: 16px; }
.pestanas { display: flex; gap: 2px; border-bottom: 1px solid var(--linea); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.pestanas [role="tab"] { position: relative; padding: 10px 14px; border: 0; background: none; font: 550 0.8125rem/1 var(--fuente); color: var(--texto-2); cursor: pointer; white-space: nowrap; }
.pestanas [role="tab"]:hover { color: var(--texto); }
.pestanas [role="tab"][aria-selected="true"] { color: var(--texto); }
.pestanas [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--acento); }

/* ---------- Ficha ---------- */
.ficha { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ficha-lado { position: sticky; top: 72px; display: grid; gap: 16px; }
.ficha-barra { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin: 20px -16px -16px; padding: 12px 16px; background: color-mix(in oklch, var(--superficie) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--linea); border-radius: 0 0 var(--r) var(--r); }
.ficha-barra .sin-guardar { margin-right: auto; color: var(--atencion); font-size: 0.8125rem; display: none; }
.ficha.con-cambios .ficha-barra .sin-guardar { display: inline-flex; gap: 6px; align-items: center; }
.actividad { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.actividad li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; font-size: 0.8125rem; }
.actividad .cuando { color: var(--texto-3); font-size: 0.75rem; }

/* ---------- Tablas ---------- */
.listado-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.listado-barra .entrada-buscar { position: relative; flex: 1 1 260px; max-width: 420px; }
.listado-barra .entrada-buscar .ico { position: absolute; left: 10px; top: 9px; width: 18px; height: 18px; color: var(--texto-3); }
.listado-barra .entrada-buscar input { padding-left: 34px; }
.vistas { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; }
.vistas a { padding: 5px 10px; border-radius: 999px; color: var(--texto-2); font-size: 0.8125rem; font-weight: 550; border: 1px solid transparent; }
.vistas a[aria-current="true"] { background: var(--superficie); border-color: var(--linea); color: var(--texto); box-shadow: var(--sombra-1); }
.tabla-marco { overflow: auto; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra-1); max-height: calc(100dvh - 260px); }
table.tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; }
.tabla th { position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 600; color: var(--texto-2); background: var(--papel-2); padding: 9px 12px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
.tabla th a { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.tabla td { padding: 0 12px; height: 40px; border-bottom: 1px solid var(--linea); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.tabla tbody tr { cursor: pointer; transition: background var(--rapido) var(--curva); }
.tabla tbody tr:hover { background: color-mix(in oklch, var(--acento) 5%, transparent); }
.tabla tbody tr[aria-selected="true"], .tabla tbody tr:focus-visible { background: var(--acento-suave); outline: none; }
.tabla td.num, .tabla th.num { text-align: right; }
.tabla tfoot td { position: sticky; bottom: 0; background: var(--papel-2); font-weight: 650; border-top: 1px solid var(--linea); border-bottom: 0; }
.tabla .marcar { width: 36px; padding-right: 0; }
.densa .tabla td { height: 32px; }
.paginacion { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--texto-3); font-size: 0.8125rem; }

/* ---------- Chips y estados ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 550; background: var(--papel-2); color: var(--texto-2); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.chip.sin-punto::before { display: none; }
.chip.ok { background: var(--ok-suave); color: color-mix(in oklch, var(--ok) 80%, var(--texto)); }
.chip.atencion { background: var(--atencion-suave); color: color-mix(in oklch, var(--atencion) 80%, var(--texto)); }
.chip.error { background: var(--error-suave); color: var(--error); }
.chip.ambar { background: var(--ambar-suave); color: color-mix(in oklch, var(--ambar) 55%, var(--texto)); }
.chip.acento { background: var(--acento-suave); color: color-mix(in oklch, var(--acento) 80%, var(--texto)); }
.filtros-activos { display: flex; flex-wrap: wrap; gap: 6px; }
.filtros-activos .chip a { color: inherit; display: inline-flex; }

/* ---------- Avisos ---------- */
.avisos { display: grid; gap: 8px; margin-bottom: 8px; }
.avisos:empty { display: none; }
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); background: var(--acento-suave); color: var(--texto); border: 1px solid color-mix(in oklch, var(--acento) 25%, transparent); animation: entrar var(--rapido) var(--curva); }
.aviso .ico { color: var(--acento); }
.aviso-error { background: var(--error-suave); border-color: color-mix(in oklch, var(--error) 30%, transparent); }
.aviso-error .ico { color: var(--error); }
.aviso-atencion { background: var(--atencion-suave); border-color: color-mix(in oklch, var(--atencion) 30%, transparent); }
.aviso-atencion .ico { color: var(--atencion); }
@keyframes entrar { from { opacity: 0; transform: translateY(-4px); } }
.tostada { position: fixed; z-index: 90; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: var(--tinta); color: var(--tinta-texto); box-shadow: var(--sombra-3); font-weight: 550; animation: entrar var(--rapido) var(--curva); }

/* ---------- Estado vacío ---------- */
.vacio { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 48px 16px; color: var(--texto-2); }
.vacio h2 { color: var(--texto); }
.vacio-ilus img { width: 160px; height: 160px; filter: drop-shadow(0 12px 18px oklch(0.24 0.03 200 / 0.12)); }

/* ---------- Paleta ⌘K ---------- */
.paleta { position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center; padding-top: 12vh; background: oklch(0.2 0.02 200 / 0.35); }
.paleta[hidden] { display: none; }
.paleta-caja { width: min(640px, 92vw); background: var(--superficie); border: 1px solid var(--linea); border-radius: 14px; box-shadow: var(--sombra-3); overflow: hidden; animation: entrar var(--rapido) var(--curva); }
.paleta-entrada { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--linea); }
.paleta-entrada .ico { color: var(--texto-3); }
.paleta-entrada input { flex: 1; height: 54px; border: 0; background: none; font: 400 1rem var(--fuente); color: var(--texto); outline: none; }
.paleta-lista { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.paleta-lista li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.paleta-lista li small { margin-left: auto; color: var(--texto-3); }
.paleta-lista li[aria-selected="true"] { background: var(--acento-suave); }
.paleta-lista .grupo { padding: 8px 10px 4px; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--texto-3); cursor: default; }
.paleta-pie { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--linea); color: var(--texto-3); font-size: 0.75rem; background: var(--papel-2); }

/* ---------- Asistente ---------- */
.asistente { position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); display: flex; flex-direction: column; background: var(--superficie); border-left: 1px solid var(--linea); box-shadow: var(--sombra-3); animation: deslizar 220ms var(--curva); }
.asistente[hidden] { display: none; }
@keyframes deslizar { from { transform: translateX(24px); opacity: 0; } }
.asistente > header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--linea); }
.asistente > header .boton-icono { margin-left: auto; }
.asistente-hilo { flex: 1; overflow: auto; padding: 16px; display: grid; align-content: start; gap: 12px; }
.msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; line-height: 1.45; }
.msg.yo { justify-self: end; background: var(--acento); color: var(--acento-texto); border-bottom-right-radius: 4px; }
.msg.ia { background: var(--papel-2); border-bottom-left-radius: 4px; }
.msg.ia table { font-size: 0.75rem; border-collapse: collapse; margin-top: 6px; }
.msg.ia td, .msg.ia th { padding: 3px 6px; border-bottom: 1px solid var(--linea); }
.msg .propuesta { margin-top: 8px; display: flex; gap: 6px; }
.asistente-form { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--linea); }
.asistente-form textarea { resize: none; width: 100%; border-radius: var(--r); border: 1px solid var(--linea-fuerte); padding: 10px; font: inherit; background: var(--papel); color: var(--texto); }
.asistente-form .boton { justify-self: end; }

/* ---------- Bloques de resumen (Inicio, fichas) ---------- */
.bloques { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.bloques > * { grid-column: span 4; }
.bloques > .ancho-6 { grid-column: span 6; }
.bloques > .ancho-8 { grid-column: span 8; }
.bloques > .ancho-12 { grid-column: 1 / -1; }
.cifras { display: flex; flex-wrap: wrap; gap: 0; }
.cifra { flex: 1 1 160px; padding: 14px 16px; border-right: 1px solid var(--linea); }
.cifra:last-child { border-right: 0; }
.cifra dt { font-size: 0.75rem; color: var(--texto-2); }
.cifra dd { margin: 4px 0 0; font-size: 1.44rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.cifra .tendencia { font-size: 0.75rem; font-weight: 550; }
.cifra .tendencia.sube { color: var(--ok); }
.cifra .tendencia.baja { color: var(--error); }
.pendientes { list-style: none; margin: 0; padding: 0; }
.pendientes li a { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 10px 16px; color: var(--texto); border-bottom: 1px solid var(--linea); }
.pendientes li:last-child a { border-bottom: 0; }
.pendientes li a:hover { background: var(--papel-2); text-decoration: none; }
.pendientes small { color: var(--texto-3); display: block; }


/* ---------- Inicio y resumen de módulo ---------- */
/* El asistente: un campo, no una fila de botones. */
.pregunta { display: grid; gap: 8px; width: min(440px, 100%); }
.pregunta-caja { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 14px; border-radius: 12px; background: var(--superficie); border: 1px solid var(--linea-fuerte); box-shadow: var(--sombra-2), var(--brillo); cursor: text; transition: border-color var(--rapido) var(--curva), box-shadow var(--rapido) var(--curva); }
.pregunta-caja:hover { border-color: var(--texto-3); }
.pregunta-caja:focus-within { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave), var(--sombra-2); }
.pregunta-caja > .ico { color: var(--acento); }
.pregunta-caja input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--texto); font: 400 0.9375rem var(--fuente); outline: none; }
.pregunta-caja input::placeholder { color: var(--texto-3); }
.pregunta-atajos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.chip.atajo { height: 28px; padding: 0 10px; border: 1px solid var(--linea); background: color-mix(in oklch, var(--superficie) 80%, transparent); color: var(--texto-2); font-family: inherit; cursor: pointer; transition: color var(--rapido) var(--curva), border-color var(--rapido) var(--curva), transform var(--rapido) var(--curva); }
.chip.atajo:hover { color: var(--texto); border-color: var(--linea-fuerte); }
.chip.atajo:active { transform: scale(0.97); }
.pagina-inicio .cabecera { align-items: center; }
.pagina-inicio .cabecera.con-banda { padding-top: 44px; }

/* Cómo va: una sola banda con 1-4 cifras, separadas por filetes, no tarjetas sueltas. */
.como-va { margin-bottom: 20px; }
.como-va-lista { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); margin: 0; background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra-2); overflow: hidden; }
.kpi + .kpi { border-left: 1px solid var(--linea); }
.kpi-enlace { display: flex; flex-direction: column; height: 100%; padding: 16px 20px 14px; color: var(--texto); transition: background var(--rapido) var(--curva); }
.kpi-enlace:hover { background: color-mix(in oklch, var(--papel-2) 70%, transparent); text-decoration: none; }
.kpi dt { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 0.8125rem; font-weight: 500; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-modulo { display: inline-flex; color: color-mix(in oklch, var(--c-m) 80%, var(--texto)); }
.kpi-modulo .ico { width: 16px; height: 16px; }
.kpi-valor { margin: 6px 0 0; font-size: 1.5rem; font-weight: 650; letter-spacing: -0.015em; line-height: 1.15; white-space: nowrap; }
.kpi-comp { display: flex; align-items: center; gap: 4px; margin: 4px 0 0; min-width: 0; font-size: 0.75rem; color: var(--texto-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-comp .ico { width: 14px; height: 14px; }
.kpi-comp.sube { color: color-mix(in oklch, var(--ok) 85%, var(--texto)); }
.kpi-comp.baja { color: var(--error); }
.kpi-serie { margin: auto 0 0; padding-top: 10px; }
.linea { display: block; width: 100%; height: 28px; overflow: visible; }
.linea-trazo { fill: none; stroke: var(--acento); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.linea-area { fill: var(--acento-suave); stroke: none; }

.inicio-cuerpo { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; align-items: start; }
.inicio-cuerpo.una-area { grid-template-columns: minmax(0, 760px); }
.inicio-cuerpo > .panel > header h2 { font-size: 1rem; }

/* Hoy: grupos por urgencia; solo el urgente lleva el naranja. */
.hoy-total { margin-left: auto; font-size: 0.8125rem; color: var(--texto-3); }
.hoy-grupo + .hoy-grupo { border-top: 1px solid var(--linea); }
.hoy-grupo > h3, .hoy-grupo > summary { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; font-size: 0.8125rem; font-weight: 600; color: var(--texto-2); }
.hoy-grupo > summary { list-style: none; padding-bottom: 14px; cursor: pointer; border-radius: 0 0 var(--r) var(--r); }
.hoy-grupo > summary::-webkit-details-marker { display: none; }
.hoy-grupo > summary:hover { background: var(--papel-2); }
.hoy-grupo[open] > summary { padding-bottom: 6px; }
.hoy-flecha { margin-left: auto; width: 16px; height: 16px; color: var(--texto-3); transition: transform var(--rapido) var(--curva); }
.hoy-grupo[open] .hoy-flecha { transform: rotate(180deg); }
.hoy-cuenta { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--papel-2); color: var(--texto-2); font-size: 0.6875rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.nivel-urgente .hoy-nivel-nombre { color: color-mix(in oklch, var(--atencion) 75%, var(--texto)); }
.nivel-urgente .hoy-cuenta { background: var(--atencion); color: oklch(0.99 0 0); }
.hoy-lista { list-style: none; margin: 0; padding: 0 8px 8px; }
.hoy-lista li { --c-modulo: var(--c-m); }
.hoy-lista a { display: grid; grid-template-columns: 32px minmax(0, 1fr) 16px; align-items: center; gap: 12px; min-height: 48px; padding: 6px 8px; border-radius: 8px; color: var(--texto); transition: background var(--rapido) var(--curva); }
.hoy-lista a:hover { background: var(--papel-2); text-decoration: none; }
.hoy-lista .baldosa { width: 32px; height: 32px; border-radius: 8px; }
.hoy-lista .baldosa .ico { width: 18px; height: 18px; }
.hoy-texto { min-width: 0; }
.hoy-titulo { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hoy-texto small { display: block; font-size: 0.75rem; color: var(--texto-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hoy-ir { width: 16px; height: 16px; color: var(--texto-3); transition: transform var(--rapido) var(--curva), color var(--rapido) var(--curva); }
.hoy-lista a:hover .hoy-ir { color: var(--acento); transform: translateX(2px); }
.hoy-mas > summary { list-style: none; padding: 2px 16px 12px 60px; color: var(--acento); font-size: 0.8125rem; font-weight: 550; cursor: pointer; }
.hoy-mas > summary::-webkit-details-marker { display: none; }
.hoy-mas[open] > summary { display: none; }
.vacio-compacto { padding: 28px 16px; }
.vacio-compacto .vacio-ilus img { width: 112px; height: 112px; }

/* Por áreas: una línea por módulo, sin tarjetas. */
.areas-lista { list-style: none; margin: 0; padding: 0; }
.areas-lista li { --c-modulo: var(--c-m); display: grid; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--linea); }
.area-nombre { display: flex; align-items: center; gap: 10px; width: fit-content; font-weight: 600; color: var(--texto); }
.area-nombre .baldosa { width: 26px; height: 26px; border-radius: 7px; }
.area-nombre .baldosa .ico { width: 16px; height: 16px; }
.area-cifras { display: flex; flex-wrap: wrap; gap: 2px 18px; margin: 0 0 0 36px; }
.area-cifras div { display: flex; align-items: baseline; gap: 6px; }
.area-cifras dt { font-size: 0.75rem; color: var(--texto-3); }
.area-cifras dd { margin: 0; font-weight: 600; }
.area-nota { margin-left: 36px; font-size: 0.75rem; color: var(--texto-3); }
.areas-sin { margin: 0; padding: 12px 16px 14px; font-size: 0.8125rem; color: var(--texto-3); max-width: none; }
.areas-sin a { color: var(--texto-2); text-decoration: underline; text-decoration-color: var(--linea-fuerte); text-underline-offset: 2px; }

/* ---------- Lista de datos (etiqueta y valor) y ajustes de conexiones ---------- */
.datos-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin: 0 0 16px; }
.datos-lista dt { font-size: 0.75rem; color: var(--texto-3); }
.datos-lista dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; }
.datos-lista.en-linea { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.datos-lista.en-linea div { display: flex; align-items: baseline; gap: 6px; }
.datos-lista.en-linea dd { margin: 0; }
.crm-ajustes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.crm-ajustes .cifras { border-bottom: 1px solid var(--linea); }
.crm-ajustes .aviso { margin-bottom: 16px; }
.crm-conectar { display: grid; gap: 14px; max-width: 520px; }
.crm-conectar p { margin: 0; }
.crm-desconectar { margin-top: 4px; }
.crm-quien { margin: 12px 0 16px; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--texto-2); font-size: 0.8125rem; }
.crm-quien strong { color: var(--texto); font-weight: 600; }
.crm-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.crm-tabla { margin-bottom: 16px; }
.vacio-linea { margin: 0; color: var(--texto-3); max-width: none; }

/* ---------- Portada de módulo (/m/<módulo>) ---------- */
.pagina-portada .cabecera-acciones { align-self: center; }
.portada-cuerpo { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 20px; align-items: start; }
.portada-cuerpo.sin-pendientes { grid-template-columns: minmax(0, 1fr); }
.indice-grupos { columns: 2 300px; column-gap: 8px; padding: 8px 8px 4px; }
.sin-pendientes .indice-grupos { columns: 3 280px; }
.indice-grupo { break-inside: avoid; padding: 8px 0 10px; }
.indice-grupo h3 { display: flex; align-items: center; gap: 8px; margin: 0 8px 4px; font-size: 0.75rem; font-weight: 600; color: var(--texto-3); }
.indice-grupo h3::after { content: ""; flex: 1; height: 1px; background: var(--linea); }
.indice-grupo ul { list-style: none; margin: 0; padding: 0; }
.indice-grupo a { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 44px; padding: 6px 8px; border-radius: 8px; color: var(--texto); transition: background var(--rapido) var(--curva); }
.indice-grupo a:hover { background: var(--papel-2); text-decoration: none; }
.indice-grupo .baldosa { width: 30px; height: 30px; border-radius: 8px; }
.indice-grupo .baldosa .ico { width: 17px; height: 17px; }
.indice-nombre { display: block; font-weight: 550; }
.indice-texto small { display: block; font-size: 0.75rem; line-height: 1.35; color: var(--texto-3); }
.indice-config { border-top: 1px solid var(--linea); }
.indice-config > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-weight: 600; font-size: 0.8125rem; color: var(--texto-2); cursor: pointer; border-radius: 0 0 var(--r) var(--r); }
.indice-config > summary::-webkit-details-marker { display: none; }
.indice-config > summary:hover { background: var(--papel-2); }
.indice-config > summary .ico:first-child { width: 17px; height: 17px; color: var(--texto-3); }
.indice-config[open] > summary .hoy-flecha { transform: rotate(180deg); }
.indice-cuenta { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--papel-2); font-size: 0.6875rem; font-weight: 650; color: var(--texto-2); }
.vacio-celda { color: var(--texto-3); }
.muestra-color { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.15); }
.opciones-marcar { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.archivada td { color: var(--texto-3); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.8125rem; }
.lista-empresas { display: grid; gap: 8px; margin-top: 16px; }

body.sin-carcasa { min-height: 100dvh; }
.contenido-suelto { min-height: 100dvh; }

/* ---------- Páginas sueltas (entrar, errores sin sesión) ---------- */
body.suelta { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: url("/assets/graficos/acceso.webp") center / cover no-repeat, var(--tinta); }
.suelta-caja { width: min(420px, 100%); background: var(--superficie); border-radius: 16px; padding: 32px; box-shadow: var(--sombra-3); }
.suelta-caja h1 { font-size: 1.44rem; margin-bottom: 6px; }
.suelta-caja form { display: grid; gap: 14px; margin-top: 20px; }
.suelta-caja .aviso + p, .suelta-caja .aviso + form { margin-top: 16px; }
.suelta-marca { display: flex; align-items: center; gap: 10px; font-weight: 650; margin-bottom: 20px; color: var(--texto); }
.suelta-marca .ico { width: 32px; height: 32px; }

/* ---------- Adaptación ---------- */
@media (max-width: 1100px) {
  .ficha { grid-template-columns: minmax(0, 1fr); }
  .ficha-lado { position: static; }
  .bloques > * , .bloques > .ancho-6, .bloques > .ancho-8 { grid-column: 1 / -1; }
  .inicio-cuerpo, .portada-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .portada-cuerpo > .hoy { order: -1; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: fixed; z-index: 60; left: 0; width: 280px; transform: translateX(-100%); transition: transform 220ms var(--curva); }
  .app.menu-abierto .lateral { transform: none; box-shadow: var(--sombra-3); }
  .app.menu-plegado { --lateral: 0; }
  .solo-movil { display: inline-grid; }
  .buscador span, .buscador kbd { display: none; }
  .buscador { width: 36px; padding: 0; justify-content: center; margin-left: auto; }
  .contenido { padding: 0 16px 40px; }
  .cabecera { margin: 0 -16px 8px; padding-inline: 16px; flex-direction: column; align-items: stretch; }
  .migas { display: none; }
  .app.menu-abierto .marco::before { content: ""; position: fixed; inset: 0; z-index: 55; background: oklch(0.2 0.02 200 / 0.45); }
  .como-va-lista { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(odd) { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--linea); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi-enlace { padding: 14px 16px 12px; }
  .kpi-valor { font-size: 1.25rem; }
  .pregunta { width: 100%; }
  .pregunta-atajos { justify-content: flex-start; }
  .chip.atajo { height: 36px; }
  .pagina-inicio .cabecera.con-banda { padding-top: 28px; }
  .pregunta-caja kbd { display: none; }
  h1 { font-size: 1.44rem; }
  .cabecera-acciones .boton { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .lateral, .barra, .pie, .cabecera-acciones, .ficha-barra { display: none !important; } .app { display: block; } }

/* ---------- Elegir empresa ---------- */
.elegir-empresa { width: min(480px, 100%); padding: 28px; }
.elegir-empresa h1 { font-size: 1.44rem; margin: 0; }
.elegir-empresa .subtitulo { margin: 4px 0 18px; }
.lista-empresas { display: grid; gap: 8px; margin: 0; }
.empresa-opcion { display: grid; grid-template-columns: 40px 1fr 20px; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--linea); border-radius: var(--r); background: var(--superficie); color: var(--texto); font: inherit; text-align: left; cursor: pointer; box-shadow: var(--sombra-1); transition: border-color var(--rapido) var(--curva), box-shadow var(--rapido) var(--curva), transform var(--rapido) var(--curva); }
.empresa-opcion:hover { border-color: var(--acento); box-shadow: var(--sombra-2); }
.empresa-opcion:active { transform: translateY(1px); }
.empresa-opcion[aria-current="true"] { border-color: color-mix(in oklch, var(--acento) 45%, var(--linea)); background: color-mix(in oklch, var(--acento) 5%, var(--superficie)); }
.empresa-opcion .empresa-sello { width: 40px; height: 40px; border-radius: 10px; font-size: 1.05rem; }
.empresa-opcion-texto { display: grid; gap: 2px; min-width: 0; }
.empresa-opcion-texto strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empresa-opcion-texto small { color: var(--texto-3); font-size: 0.8125rem; }
.empresa-opcion-flecha { color: var(--texto-3); width: 18px; height: 18px; transition: transform var(--rapido) var(--curva), color var(--rapido) var(--curva); }
.empresa-opcion:hover .empresa-opcion-flecha { color: var(--acento); transform: translateX(2px); }
.elegir-pie { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--linea); }
.elegir-pie .boton:only-child { margin-left: auto; }

/* ---------- «Entrar como» de la administración de Iberika (lib/plantilla.php): franja fija mientras dura ---------- */
.franja-como { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 28px; background: linear-gradient(90deg, oklch(0.45 0.13 42), oklch(0.51 0.15 47)); color: oklch(0.99 0.01 47); font-size: 0.8125rem; box-shadow: 0 2px 10px -4px color-mix(in oklch, var(--atencion) 70%, transparent); }
.franja-como > .ico { width: 18px; height: 18px; flex: none; --icono-acento: currentColor; }
.franja-como > span { flex: 1; min-width: 0; }
.franja-como form { margin: 0; }
.franja-como .boton { background: oklch(0.99 0.01 47); border-color: transparent; color: oklch(0.32 0.08 47); box-shadow: none; }
.franja-como .boton .ico { color: currentColor; }
@media (max-width: 820px) { .franja-como { padding: 8px 16px; flex-wrap: wrap; } }

/* ---------- Motor de listados y fichas: exportar, filtros, adjuntos, hijos y relaciones ---------- */
.solo-lector { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.entrada.filtro { width: auto; max-width: 240px; }
.menu-desplegable { position: relative; }
.menu-desplegable > summary { list-style: none; }
.menu-desplegable > summary::-webkit-details-marker { display: none; }
.menu-desplegable-lista { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 210px; display: grid; padding: 6px; border: 1px solid var(--linea); border-radius: var(--r); background: var(--superficie); box-shadow: var(--sombra-3); transform-origin: top right; animation: desplegar var(--rapido) var(--curva); }
.menu-desplegable-lista a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; color: var(--texto); text-decoration: none; font-size: 0.875rem; }
.menu-desplegable-lista a:hover, .menu-desplegable-lista a:focus-visible { background: var(--acento-suave); }
.menu-desplegable-lista .ico { width: 18px; height: 18px; color: var(--texto-2); }
@keyframes desplegar { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }

/* Adjuntos (lateral de la ficha) */
#adjuntos header { display: flex; align-items: center; gap: 10px; }
#adjuntos header .chip { margin-left: auto; }
.adjuntos { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.adjuntos li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px; border-radius: 8px; transition: background var(--rapido) var(--curva); }
.adjuntos li:hover { background: var(--papel-2); }
.adjunto-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--acento-suave); color: var(--acento); box-shadow: var(--brillo); }
.adjunto-ico .ico { width: 18px; height: 18px; }
.adjunto-texto { min-width: 0; font-size: 0.8125rem; }
.adjunto-texto a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; color: var(--texto); }
.adjunto-texto .cuando { color: var(--texto-3); font-size: 0.75rem; }
.adjunto-acciones { display: flex; gap: 2px; }
.adjunto-acciones form { margin: 0; }
.adjunto-acciones .boton-icono { width: 30px; height: 30px; }
.adjunto-acciones .ico { width: 16px; height: 16px; }
.adjuntos-vacio { margin: 0 0 12px; color: var(--texto-3); font-size: 0.8125rem; }
.adjuntar { display: grid; gap: 8px; }
.adjuntar-soltar { position: relative; display: block; cursor: pointer; }
.adjuntar-soltar input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.adjuntar-soltar > span { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px; border: 1.5px dashed var(--linea-fuerte); border-radius: var(--r-campo); color: var(--texto-2); font-size: 0.8125rem; text-align: center;
  background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in oklch, var(--acento) 4%, transparent) 8px 16px); transition: border-color var(--rapido) var(--curva), background-color var(--rapido) var(--curva); }
.adjuntar-soltar:hover > span, .adjuntar-soltar.encima > span, .adjuntar-soltar input:focus-visible + span { border-color: var(--acento); color: var(--texto); background-color: var(--acento-suave); }
.adjuntar-soltar.elegido > span { border-style: solid; border-color: var(--acento); color: var(--texto); }
.adjuntar-soltar .ico { width: 18px; height: 18px; color: var(--acento); }

/* Hijos que se editan en la ficha del padre */
.hijos-tabla .acciones-fila { width: 1%; white-space: nowrap; text-align: right; }
.hijos-tabla .acciones-fila form { display: inline; margin: 0; }
.hijos-tabla tr.editando td { background: var(--acento-suave); }
.hijo-form { margin-top: 16px; padding: 16px; border: 1px solid var(--linea); border-radius: var(--r); background: linear-gradient(180deg, var(--papel-2), var(--superficie)); box-shadow: var(--brillo); }
.hijo-form h3 { margin: 0 0 12px; font-size: 0.9375rem; }
.hijo-form .grupo-botones { margin-top: 12px; }

/* Pestañas de relación */
.relacion-pie { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 20px; margin-top: 10px; color: var(--texto-2); font-size: 0.8125rem; }
.relacion-pie strong { color: var(--texto); font-weight: 600; }
.relacion-vacia { display: grid; justify-items: center; gap: 6px; padding: 24px 12px; color: var(--texto-3); text-align: center; }
.relacion-vacia .vacio-ilus img { width: 120px; height: 120px; }

/* La franja de «edición a la vez» (bloqueos.js) va encima de la ficha, a lo ancho */
.ficha > .bloqueo-franja { grid-column: 1 / -1; }
.ficha > .bloqueo-franja[hidden] { display: none; }
/* En las pestañas que no son de campos (hijos, relaciones, paneles) no hay nada que guardar */
.ficha form[data-ficha]:not(:has(> [role="tabpanel"]:not([hidden]))) > .ficha-barra { display: none; }
