/* Identidad ODESA para el admin del ERP y las pantallas propias.
   Propuesta UX v01 (docs/Propuesta_UX_v01_2026-11-14.md), aprobada por Brian el 14/11/2026 (decision 21).

   Colores del sistema de diseno ODESA (tokens.json):
   rojo-odesa #922922 (Pantone 484), bordo #531915 (Pantone 491), grafito #282828,
   gris-azulado #8D9FA2, gris-claro #ECECEC, blanco #FFFFFF.
   Derivados, no colores nuevos: texto secundario #5F7B81 (del grafico de indices; 4,5:1 sobre blanco),
   modo oscuro #1F1F1F y #3A3A3A. El gris #D8E0E5 salio del admin [Brian, 14/11/2026].
   Tipografia IBM Plex (instalada en las PC del estudio). Radio 0 en todo (radius-none del sistema).

   Criterios de diseno:
   1. Interfaz calma: fondo neutro; el rojo-odesa se reserva para acciones y para "donde estoy".
   2. Sin rayado de filas ni bloques de color: lineas finas y resaltado al pasar el mouse.
   3. Acciones de fila discretas: "+" (agregar) y tres puntos (modificar), mas visibles al pasar por la fila.
   4. Una sola accion principal por pantalla (boton lleno); el resto, botones de contorno.
   5. Aristas vivas: radio 0 en botones, campos, chips y tablas.
   6. Los numeros se leen en columna: IBM Plex Mono con cifras tabulares, a la derecha, signo visible.
   7. El rojo nunca es dato: un desvio se lee por signo, peso y barra en grafito o gris azulado.
   8. Lo provisorio y lo que no existe se dicen en texto (chip "provisorio", estado vacio con motivo).
   Los colores de error y mensajes quedan los de Django: son de funcion, no de marca. */

/* ---------- Variables: modo claro ---------- */
:root,
html[data-theme="light"] {
    --primary: #531915;
    --secondary: #922922;
    --accent: #922922;
    --primary-fg: #ffffff;

    --body-fg: #282828;
    --body-bg: #ffffff;
    --body-quiet-color: #5f7b81;
    --body-medium-color: #282828;
    --body-loud-color: #282828;

    --header-bg: #ffffff;
    --header-color: #282828;
    --header-branding-color: #922922;
    --header-link-color: #282828;

    --breadcrumbs-bg: transparent;
    --breadcrumbs-fg: #5f7b81;
    --breadcrumbs-link-fg: #5f7b81;

    --link-fg: #282828;
    --link-hover-color: #922922;
    --link-selected-fg: #922922;

    --hairline-color: #ececec;
    --border-color: #8d9fa2;

    --darkened-bg: #ececec;
    --selected-bg: #ececec;
    --selected-row: #ececec;

    --button-fg: #ffffff;
    --button-bg: #922922;
    --button-hover-bg: #531915;
    --default-button-bg: #922922;
    --default-button-hover-bg: #531915;
    --close-button-bg: #282828;
    --close-button-hover-bg: #531915;

    --object-tools-fg: #ffffff;
    --object-tools-bg: #922922;
    --object-tools-hover-bg: #531915;

    --font-family-primary: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --font-family-monospace: "IBM Plex Mono", ui-monospace, Consolas, monospace;

    /* Propias de ODESA */
    --odesa-rojo: #922922;
    --odesa-bordo: #531915;
    --odesa-grafito: #282828;
    --odesa-azulado: #8d9fa2;
    --odesa-claro: #ececec;
    --odesa-texto-2: #5f7b81;
    --odesa-superficie-nav: #ffffff;
    --odesa-titulo-fg: #922922;
    --odesa-linea-marca: #922922;
    --odesa-linea-fuerte: #8d9fa2;
    --odesa-hover: #ececec;
    --odesa-accion-fg: #8d9fa2;
    --odesa-accion-hover-fg: #922922;
    --odesa-actual-fg: #922922;
    --odesa-barra-mas: #282828;
    --odesa-barra-menos: #8d9fa2;
    --odesa-chip-lleno-bg: #282828;
    --odesa-chip-lleno-fg: #ffffff;
    --odesa-foco: rgba(146, 41, 34, 0.35);
}

/* ---------- Variables: modo oscuro (sigue al sistema) ----------
   El rojo no alcanza contraste como texto sobre grafito (1,8:1): queda en superficies y lineas. */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #531915;
        --primary-fg: #ffffff;
        --body-fg: #ececec;
        --body-bg: #282828;
        --body-quiet-color: #8d9fa2;
        --body-medium-color: #ececec;
        --body-loud-color: #ffffff;
        --header-bg: #1f1f1f;
        --header-color: #ececec;
        --header-branding-color: #ececec;
        --header-link-color: #ececec;
        --breadcrumbs-bg: transparent;
        --breadcrumbs-fg: #8d9fa2;
        --breadcrumbs-link-fg: #8d9fa2;
        --link-fg: #ececec;
        --link-hover-color: #ffffff;
        --link-selected-fg: #ececec;
        --hairline-color: #3a3a3a;
        --border-color: #8d9fa2;
        --darkened-bg: #1f1f1f;
        --selected-bg: #1f1f1f;
        --selected-row: #1f1f1f;
        --close-button-bg: #8d9fa2;
        --close-button-hover-bg: #922922;
        --odesa-texto-2: #8d9fa2;
        --odesa-superficie-nav: #1f1f1f;
        --odesa-titulo-fg: #ececec;
        --odesa-linea-fuerte: #8d9fa2;
        --odesa-hover: #1f1f1f;
        --odesa-accion-fg: #8d9fa2;
        --odesa-accion-hover-fg: #ececec;
        --odesa-actual-fg: #ececec;
        --odesa-barra-mas: #ececec;
        --odesa-barra-menos: #8d9fa2;
        --odesa-chip-lleno-bg: #ececec;
        --odesa-chip-lleno-fg: #282828;
    }
}
html[data-theme="dark"] {
    --primary: #531915;
    --primary-fg: #ffffff;
    --body-fg: #ececec;
    --body-bg: #282828;
    --body-quiet-color: #8d9fa2;
    --body-medium-color: #ececec;
    --body-loud-color: #ffffff;
    --header-bg: #1f1f1f;
    --header-color: #ececec;
    --header-branding-color: #ececec;
    --header-link-color: #ececec;
    --breadcrumbs-bg: transparent;
    --breadcrumbs-fg: #8d9fa2;
    --breadcrumbs-link-fg: #8d9fa2;
    --link-fg: #ececec;
    --link-hover-color: #ffffff;
    --link-selected-fg: #ececec;
    --hairline-color: #3a3a3a;
    --border-color: #8d9fa2;
    --darkened-bg: #1f1f1f;
    --selected-bg: #1f1f1f;
    --selected-row: #1f1f1f;
    --close-button-bg: #8d9fa2;
    --close-button-hover-bg: #922922;
    --odesa-texto-2: #8d9fa2;
    --odesa-superficie-nav: #1f1f1f;
    --odesa-titulo-fg: #ececec;
    --odesa-linea-fuerte: #8d9fa2;
    --odesa-hover: #1f1f1f;
    --odesa-accion-fg: #8d9fa2;
    --odesa-accion-hover-fg: #ececec;
    --odesa-actual-fg: #ececec;
    --odesa-barra-mas: #ececec;
    --odesa-barra-menos: #8d9fa2;
    --odesa-chip-lleno-bg: #ececec;
    --odesa-chip-lleno-fg: #282828;
}

/* Los selectores llevan "html body" para ganarle a las hojas de Django que cargan despues. */
html body { font-size: 14px; line-height: 20px; }
html body a:link, html body a:visited { color: var(--link-fg); text-decoration: none; }
html body a:hover { color: var(--link-hover-color); text-decoration: underline; text-underline-offset: 3px; }
html body :focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }
/* Django 6 subraya todos los enlaces del contenido (base.css, con un selector de mucho peso). En los enlaces de
   texto se deja: ayuda a verlos. En lo que se dibuja como boton, pestaña o accion de fila, no. */
html body #container a.boton-contorno, html body #container a.boton-lleno, html body #container a.button,
html body #container a.accion-fila, html body #container .pestanas a, html body #container a.addlink,
html body #container a.changelink, html body #container a.viewlink, html body #container a.deletelink,
html body #container .paginator a, html body #container thead th a { text-decoration: none; }
.visual-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html body * { transition: none !important; } }

/* ---------- Cabecera: 56 px, marca, buscador, IA, usuario; linea roja debajo ---------- */
html body #header {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 56px;
    padding: 6px 24px;
    border-bottom: 3px solid var(--odesa-linea-marca);
    background: var(--header-bg);
    color: var(--header-color);
}
html body #branding { display: flex; align-items: center; min-width: 200px; }
html body #branding h1 { margin: 0; }
html body a.marca-odesa:link, html body a.marca-odesa:visited {
    display: flex; align-items: center; gap: 10px;
    font-family: "IBM Plex Sans Condensed", var(--font-family-primary);
    font-weight: 600; font-size: 18px; letter-spacing: 0.06em;
    color: var(--header-branding-color); text-decoration: none;
}
/* Isotipo: lugar reservado. Hasta que Brian pase el archivo es un cuadrado tenue, sin texto (el "iso" de
   antes parecia un error). El isotipo y el logo de ODESA no se redibujan ni se modifican.
   Archivo real: erp/static/odesa/marca/isotipo.svg, cuadrado, de un solo color (se pinta con el color del
   texto de la marca: rojo en claro, gris claro en oscuro, blanco sobre el plano rojo del ingreso).
   Medidas en pantalla: 24 x 24 px en la cabecera, 32 x 32 px en el ingreso. Los iconos de la aplicacion del
   telefono van aparte: erp/static/odesa/pwa/icono-180.png, icono-192.png e icono-512.png (180, 192 y 512 px).
   Para activarlo, con el archivo ya copiado: sacar el borde y la opacidad de la regla de abajo y pintar el
   isotipo como mascara (propiedades mask y -webkit-mask apuntando a marca/isotipo.svg, "center / contain
   no-repeat", con background: currentColor). La regla exacta, lista para pegar, esta en
   docs/Entrega_10_Correcciones_Pantallas_v01_2026-11-26.md, seccion 5. No se escribe aca porque el servidor,
   al juntar los archivos de estilo, busca todo archivo nombrado en una hoja y falla si todavia no existe. */
html body .marca-iso {
    display: inline-block; width: 24px; height: 24px; box-sizing: border-box; flex: none;
    border: 1px solid currentColor; opacity: 0.35;
}
html body #user-tools.barra-herramientas {
    display: flex; align-items: center; gap: 12px; flex: 1; margin: 0;
    font-size: 14px; font-weight: 400; letter-spacing: 0; text-transform: none; text-align: left;
}
html body .buscar-global { position: relative; flex: 1 1 240px; max-width: 520px; margin: 0; }
html body .buscar-global input[type="search"] {
    width: 100%; height: 40px; padding: 0 12px 0 38px; box-sizing: border-box;
    border: 1px solid var(--border-color); background: var(--body-bg); color: var(--body-fg); border-radius: 0;
}
html body .buscar-global svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--odesa-texto-2); pointer-events: none; }
html body #user-tools a.boton-contorno:link, html body #user-tools a.boton-contorno:visited,
html body #user-tools a#asistente-boton:link, html body #user-tools a#asistente-boton:visited {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; margin: 0;
    border: 1px solid var(--border-color); border-radius: 0; color: var(--header-link-color);
    text-decoration: none; text-transform: none; letter-spacing: 0; white-space: nowrap;
}
html body #user-tools a.boton-contorno svg { width: 18px; height: 18px; }
html body #user-tools a.boton-contorno:hover, html body #user-tools a#asistente-boton:hover,
html body #user-tools a#asistente-boton[aria-expanded="true"] {
    border-color: var(--odesa-accion-hover-fg); color: var(--odesa-accion-hover-fg); text-decoration: none;
}
html body .usuario-actual { display: flex; align-items: center; gap: 10px; margin-left: auto; position: relative; }
html body .usuario-avatar {
    width: 32px; height: 32px; display: grid; place-items: center;
    background: var(--odesa-grafito); color: #ffffff; font-weight: 600; font-size: 13px;
}
@media (prefers-color-scheme: dark) { html body .usuario-avatar { background: var(--odesa-claro); color: var(--odesa-grafito); } }
html body .usuario-datos { display: flex; flex-direction: column; line-height: 16px; }
html body .usuario-datos strong { font-weight: 500; }
html body .usuario-rol { font-size: 12px; color: var(--odesa-texto-2); }
html body .usuario-menu summary {
    list-style: none; cursor: pointer; width: 40px; height: 40px; display: grid; place-items: center;
    font-size: 18px; color: var(--odesa-accion-fg); border: 1px solid transparent;
}
html body .usuario-menu summary::-webkit-details-marker { display: none; }
html body .usuario-menu summary:hover { color: var(--odesa-accion-hover-fg); border-color: var(--odesa-linea-fuerte); }
html body .usuario-menu-lista {
    position: absolute; right: 0; top: 46px; z-index: 50; min-width: 200px;
    display: flex; flex-direction: column; background: var(--body-bg); border: 1px solid var(--border-color);
}
html body .usuario-menu-lista a, html body .usuario-menu-lista button {
    display: block; width: 100%; box-sizing: border-box; text-align: left; padding: 12px 16px;
    background: transparent; border: 0; color: var(--body-fg); font: inherit; cursor: pointer; text-decoration: none;
}
html body .usuario-menu-lista a:hover, html body .usuario-menu-lista button:hover { background: var(--odesa-hover); }
html body #logout-form { margin: 0; }

/* ---------- Menu lateral: por area y por rol; atenuado; el actual con barra roja ---------- */
html body #nav-sidebar { background: var(--odesa-superficie-nav); border-right: 1px solid var(--hairline-color); padding: 12px 0 24px; }
html body .menu-grupo { display: flex; flex-direction: column; padding: 10px 0 4px; }
html body .menu-titulo {
    padding: 6px 24px; font-size: 11px; line-height: 16px; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--odesa-texto-2);
}
html body #nav-sidebar a:link, html body #nav-sidebar a:visited, html body .menu-telefono a:link, html body .menu-telefono a:visited {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 20px 0 21px;
    border-left: 3px solid transparent; color: var(--body-fg); text-decoration: none;
}
html body #nav-sidebar a:hover, html body .menu-telefono a:hover { background: var(--odesa-hover); color: var(--body-fg); }
html body #nav-sidebar a.actual, html body .menu-telefono a.actual {
    border-left-color: var(--odesa-rojo); font-weight: 600; color: var(--odesa-actual-fg); background: var(--odesa-hover);
}
html body .menu-contador {
    margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box;
    display: grid; place-items: center; font-family: var(--font-family-monospace); font-size: 12px; font-weight: 400;
    border: 1px solid var(--odesa-linea-fuerte); color: var(--body-fg);
}
html body .menu-telefono { display: none; }
html body .solo-telefono { display: none; }
html body .menu-telefono summary { list-style: none; }
html body .menu-telefono summary::-webkit-details-marker { display: none; }

/* ---------- Ruta de navegacion ---------- */
html body .breadcrumbs { font-size: 13px; padding: 14px 32px 0; border-bottom: none; background: transparent; }
html body .breadcrumbs a:link, html body .breadcrumbs a:visited { color: var(--breadcrumbs-link-fg); }

/* ---------- Contenido y titulos ---------- */
html body #content { padding: 20px 32px 48px; }
html body #content h1 { font-weight: 600; font-size: 24px; line-height: 30px; letter-spacing: -0.01em; color: var(--body-loud-color); margin: 0 0 4px; }
html body #content > h2, html body #content .titles h2 { font-weight: 400; font-size: 14px; color: var(--odesa-texto-2); margin: 0 0 16px; }
html body .bajada { color: var(--odesa-texto-2); margin: 0 0 20px; }
html body .module h2, html body .module caption, html body .inline-group h2, html body #changelist-filter h2, html body .h3 {
    background: transparent; color: var(--odesa-titulo-fg); font-weight: 600; font-size: 11px; line-height: 16px;
    letter-spacing: 0.1em; text-transform: uppercase; padding: 14px 12px 6px; margin: 0;
    border-bottom: 1px solid var(--odesa-linea-marca);
}
html body .h3 { padding: 0 0 8px; }
html body .bloque-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
html body .bloque-cab .h3 { flex: 1; }
html body .bloque-cab a:link, html body .bloque-cab a:visited { font-size: 13px; color: var(--odesa-texto-2); white-space: nowrap; }
html body .module caption a.section:link, html body .module caption a.section:visited { color: var(--odesa-titulo-fg); }
html body #changelist-filter h2 { margin-bottom: 8px; }

html body .cabecera { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
html body .cabecera h1 { margin: 0; }
html body .cabecera .bajada { margin: 4px 0 0; }
html body .acciones { display: flex; flex-wrap: wrap; gap: 12px; }
html body .grilla-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 32px 40px; margin-bottom: 32px; }
html body .grilla-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px 32px; margin-bottom: 32px; }
html body .bloque { min-width: 0; margin-bottom: 32px; }
html body .secundario { color: var(--odesa-texto-2); }
html body .chico { font-size: 12px; line-height: 16px; }
html body .mono { font-family: var(--font-family-monospace); font-variant-numeric: tabular-nums; }
html body .num { text-align: right; font-family: var(--font-family-monospace); font-variant-numeric: tabular-nums; white-space: nowrap; }
html body .mas-gasto { font-weight: 600; }
html body .nota { color: var(--odesa-texto-2); font-size: 13px; }

/* Cifra: valor con etiqueta y nota, linea superior fina. */
html body .cifra { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--odesa-linea-fuerte); }
html body .cifra .etiqueta { font-size: 12px; line-height: 16px; color: var(--odesa-texto-2); }
html body .cifra .valor { font-family: var(--font-family-monospace); font-variant-numeric: tabular-nums; font-size: 28px; line-height: 32px; font-weight: 500; }
html body .cifra .valor small { font-size: 14px; font-weight: 400; color: var(--odesa-texto-2); margin-left: 6px; }
html body .cifra .nota-cifra { font-size: 12px; line-height: 16px; color: var(--odesa-texto-2); }

/* Chip de estado. Lleno solo para "confirmado" y "balancea". */
html body .chip {
    display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; box-sizing: border-box;
    font-size: 12px; line-height: 16px; font-weight: 400; border: 1px solid var(--odesa-linea-fuerte); white-space: nowrap; color: var(--body-fg);
    vertical-align: middle; text-transform: none; letter-spacing: 0;
}
html body .chip-lleno { background: var(--odesa-chip-lleno-bg); color: var(--odesa-chip-lleno-fg); border-color: var(--odesa-chip-lleno-bg); }
html body .chip-tenue { border-color: var(--hairline-color); color: var(--odesa-texto-2); }

/* Barra de desvio: largo = magnitud; cero al centro; grafito = gasto de mas, gris azulado = de menos. */
html body .desvio { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; }
html body .desvio .pista { width: 96px; height: 8px; background: var(--odesa-claro); position: relative; flex: none; }
@media (prefers-color-scheme: dark) { html body .desvio .pista { background: #3a3a3a; } }
html body .desvio .pista i { position: absolute; top: 0; height: 8px; display: block; }
html body .desvio .pista i.mas { left: 50%; background: var(--odesa-barra-mas); }
html body .desvio .pista i.menos { right: 50%; background: var(--odesa-barra-menos); }
html body .desvio .pista .cero { position: absolute; left: 50%; top: -3px; width: 1px; height: 14px; background: var(--odesa-linea-fuerte); }

/* Estado vacio: una frase, un motivo y una accion. */
html body .vacio { display: flex; flex-direction: column; gap: 12px; padding: 24px; border: 1px dashed var(--odesa-linea-fuerte); max-width: 64ch; }
html body .vacio p { margin: 0; color: var(--odesa-texto-2); }
html body .vacio p.vacio-titulo { color: var(--body-fg); font-weight: 500; }

/* Aviso: texto entre dos lineas, sin bloque de color ni borde izquierdo. */
html body .aviso { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; margin: 0 0 24px; border-top: 1px solid var(--odesa-linea-fuerte); border-bottom: 1px solid var(--odesa-linea-fuerte); }
html body .aviso svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--odesa-texto-2); }
html body .aviso p { margin: 0; }

/* Pestañas */
html body .pestanas { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--hairline-color); margin-bottom: 24px; }
html body .pestanas a:link, html body .pestanas a:visited { display: inline-flex; align-items: center; height: 44px; padding: 0 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--odesa-texto-2); }
html body .pestanas a:hover { color: var(--body-fg); text-decoration: none; }
html body .pestanas a.actual { color: var(--odesa-actual-fg); border-bottom-color: var(--odesa-rojo); font-weight: 600; }

/* Ficha (lista de datos) */
html body dl.ficha { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; align-items: baseline; margin: 0; }
html body dl.ficha dt { font-size: 12px; line-height: 20px; color: var(--odesa-texto-2); margin: 0; }
html body dl.ficha dd { margin: 0; }

/* ---------- Tablas: sin rayado, linea fina, resaltado al pasar, encabezado fijo ---------- */
html body tr:nth-child(odd), html body tr:nth-child(even), html body tr.alt { background: transparent; }
html body .module th, html body .module td, html body #changelist table tbody td, html body #changelist table tbody th,
html body table.tabla th, html body table.tabla td {
    padding: 10px 12px; border-bottom: 1px solid var(--hairline-color); vertical-align: middle; font-size: 14px; line-height: 20px;
}
html body table.tabla { width: 100%; border-collapse: collapse; border-radius: 0; }
html body table.tabla th { text-align: left; }
html body table.tabla th.num { text-align: right; }
html body table.tabla td.mono, html body table.tabla th.mono { white-space: nowrap; }
html body .tabla-caja { overflow-x: auto; }
html body table.tabla-densa th, html body table.tabla-densa td { padding: 7px 10px; }
html body table.tabla-cond td, html body table.tabla-cond th { font-family: "IBM Plex Sans Condensed", var(--font-family-primary); }
html body table.tabla-cond td.num, html body table.tabla-cond th.num { font-family: var(--font-family-monospace); }
html body #content-main .module tbody tr:hover, html body #changelist table tbody tr:hover, html body table.tabla tbody tr:hover { background: var(--odesa-hover); }
html body #changelist table tbody tr.selected { background: var(--selected-row); }
html body table.tabla tbody th { font-weight: 500; }
html body table.tabla tfoot th, html body table.tabla tfoot td { border-top: 1px solid var(--odesa-linea-fuerte); border-bottom: 0; font-weight: 600; }
html body table.tabla .fila-accion { width: 44px; padding: 2px 4px; text-align: right; white-space: nowrap; }

html body .module th[scope="row"] a:link, html body .module th[scope="row"] a:visited,
html body #changelist table tbody th a:link, html body #changelist table tbody th a:visited { color: var(--body-fg); font-weight: 500; text-decoration: none; }
html body .module th[scope="row"] a:hover, html body #changelist table tbody th a:hover { color: var(--odesa-accion-hover-fg); text-decoration: underline; text-underline-offset: 3px; }

html body thead th, html body thead th.sorted, html body #changelist table thead th, html body table.tabla thead th {
    position: sticky; top: 0; z-index: 1; background: var(--body-bg);
    border-bottom: 1px solid var(--odesa-linea-fuerte);
    font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--odesa-texto-2);
    white-space: nowrap;
}
html body thead th.sorted a:link, html body thead th.sorted a:visited { color: var(--secondary); }
/* En las tablas propias el encabezado puede partirse en dos renglones: con "nowrap" una columna angosta
   ("Último movimiento", "Filas de listas pendientes") ensanchaba la tabla hasta sacarla de la pantalla. */
html body table.tabla thead th { white-space: normal; vertical-align: bottom; }
html body table.tabla thead tr.grupo th { text-align: center; border-bottom: 1px solid var(--hairline-color); position: static; }

/* ---------- Paneles laterales del admin (filtros): sin caja gris ---------- */
html body #changelist-filter, html body #content-related { background: transparent; border-left: 1px solid var(--hairline-color); }

/* ---------- Acciones de fila: "+" agrega, tres puntos modifica; blanco de 44 px ---------- */
html body #container a.addlink:link, html body #container a.addlink:visited,
html body #container .module td a.changelink:link, html body #container .module td a.changelink:visited,
html body #container .module td a.viewlink:link, html body #container .module td a.viewlink:visited,
html body a.accion-fila:link, html body a.accion-fila:visited, html body button.accion-fila {
    display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
    width: 44px; height: 44px; padding: 0; border: 1px solid transparent; border-radius: 0;
    background: transparent none; color: var(--odesa-accion-fg); font-size: 0; line-height: 1; letter-spacing: 0;
    text-decoration: none; vertical-align: middle; cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
html body a.accion-fila svg, html body button.accion-fila svg { width: 18px; height: 18px; }
html body #container a.addlink::before, html body a.accion-fila.mas::before, html body button.accion-fila.mas::before { content: "+"; font-size: 20px; font-weight: 300; line-height: 1; }
html body a.accion-fila.mas svg, html body button.accion-fila.mas svg { display: none; }
html body #container .module td a.changelink::before, html body #container .module td a.viewlink::before,
html body a.accion-fila.puntos::before { content: "\22EE"; font-size: 18px; font-weight: 700; line-height: 1; }
html body a.accion-fila.puntos svg { display: none; }
html body #container a.addlink:link, html body #container a.addlink:visited, html body a.accion-fila.mas:link, html body a.accion-fila.mas:visited, html body button.accion-fila.mas { border-color: var(--odesa-accion-fg); }
html body #container a.addlink:hover, html body #container a.addlink:focus-visible, html body a.accion-fila.mas:hover, html body button.accion-fila.mas:hover {
    background-color: var(--secondary); border-color: var(--secondary); color: #ffffff;
}
html body #container .module td a.changelink:hover, html body #container .module td a.viewlink:hover,
html body a.accion-fila.puntos:hover, html body a.accion-fila:hover {
    background-color: var(--odesa-hover); border-color: var(--odesa-linea-fuerte); color: var(--odesa-accion-hover-fg);
}
html body .module td:has(> a.addlink), html body .module td:has(> a.changelink) { width: 44px; padding-left: 2px; padding-right: 2px; }
@media (hover: hover) {
    html body .module tr a.addlink:link, html body .module tr a.changelink:link, html body .module tr a.viewlink:link, html body table.tabla tr a.accion-fila:link { opacity: 0.55; }
    html body .module tr:hover a.addlink, html body .module tr:hover a.changelink, html body .module tr:hover a.viewlink, html body table.tabla tr:hover a.accion-fila,
    html body .module tr a.addlink:focus-visible, html body .module tr a.changelink:focus-visible, html body .module tr a.viewlink:focus-visible, html body table.tabla tr a.accion-fila:focus-visible { opacity: 1; }
}

/* El "+" de arriba de cada listado: lleno, es la accion principal de la pantalla. */
html body #container .object-tools a.addlink:link, html body #container .object-tools a.addlink:visited {
    border-color: var(--secondary); background: var(--secondary) none; color: #ffffff; opacity: 1;
}
html body #container .object-tools a.addlink::before { font-size: 22px; }
html body #container .object-tools a.addlink:hover, html body #container .object-tools a.addlink:focus-visible { background-color: var(--primary); border-color: var(--primary); }
html body #container .object-tools a:not(.addlink):link, html body #container .object-tools a:not(.addlink):visited {
    display: inline-flex; align-items: center; height: 44px; padding: 0 16px; box-sizing: border-box;
    background: transparent; color: var(--body-fg); border: 1px solid var(--border-color); border-radius: 0;
    text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500;
}
html body #container .object-tools a:not(.addlink):hover { border-color: var(--secondary); color: var(--odesa-accion-hover-fg); text-decoration: none; }
html body .object-tools { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
html body .object-tools li { display: flex; }

/* ---------- Botones: 44 px, radio 0; lleno = principal, contorno = secundario ---------- */
html body .button, html body input[type="submit"], html body input[type="button"], html body .submit-row input, html body .submit-row input.default,
html body a.button, html body .boton-contorno, html body .boton-lleno, html body a.boton-contorno, html body a.boton-lleno, html body button.boton-contorno, html body button.boton-lleno {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
    height: 44px; padding: 0 18px; border-radius: 0; cursor: pointer;
    font-family: var(--font-family-primary); font-size: 14px; font-weight: 500; line-height: 1; text-transform: none; letter-spacing: 0; white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
html body .boton-contorno svg, html body .boton-lleno svg { width: 18px; height: 18px; }
html body input[type="submit"]:not(.default), html body input[type="button"], html body .button:not(.default),
html body .boton-contorno, html body a.boton-contorno:link, html body a.boton-contorno:visited, html body button.boton-contorno {
    background: transparent; color: var(--body-fg); border: 1px solid var(--border-color); text-decoration: none;
}
html body input[type="submit"]:not(.default):hover, html body input[type="button"]:hover, html body .button:not(.default):hover,
html body .boton-contorno:hover, html body a.boton-contorno:hover { background: transparent; border-color: var(--odesa-accion-hover-fg); color: var(--odesa-accion-hover-fg); text-decoration: none; }
html body .submit-row input.default, html body input[type="submit"].default, html body .boton-lleno, html body a.boton-lleno:link, html body a.boton-lleno:visited, html body button.boton-lleno {
    background: var(--secondary); border: 1px solid var(--secondary); color: #ffffff; text-decoration: none;
}
html body .submit-row input.default:hover, html body input[type="submit"].default:hover, html body .boton-lleno:hover, html body a.boton-lleno:hover { background: var(--primary); border-color: var(--primary); color: #ffffff; text-decoration: none; }
html body .boton-chico, html body a.boton-chico:link, html body a.boton-chico:visited { height: 32px; padding: 0 12px; font-size: 13px; }
html body .boton-texto, html body a.boton-texto:link, html body a.boton-texto:visited { border-color: transparent; }
html body .submit-row { background: transparent; border: 0; padding: 16px 0; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
html body .submit-row a.deletelink:link, html body .submit-row a.deletelink:visited {
    display: inline-flex; align-items: center; height: 44px; padding: 0 18px; box-sizing: border-box;
    background: transparent; color: var(--error-fg); border: 1px solid var(--error-fg); border-radius: 0; margin-left: auto;
}
html body .submit-row a.deletelink:hover { background: var(--error-fg); color: #ffffff; }

/* ---------- Campos ---------- */
html body input[type="text"], html body input[type="search"], html body input[type="password"], html body input[type="number"],
html body input[type="email"], html body input[type="date"], html body input[type="month"], html body select, html body textarea {
    border-radius: 0; border: 1px solid var(--border-color); background: var(--body-bg); color: var(--body-fg);
    font-family: var(--font-family-primary); font-size: 14px; padding: 8px 12px; box-sizing: border-box;
}
html body select { padding-right: 32px; }
html body input:focus, html body select:focus, html body textarea:focus {
    border-color: var(--secondary); outline: 2px solid var(--odesa-foco); outline-offset: 0;
}
html body .campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
html body .campo label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--odesa-texto-2); float: none; width: auto; padding: 0; }
html body .campo input, html body .campo select { height: 44px; width: 100%; }
html body .filtros { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 0 0 24px; }
html body .filtros .campo { flex: 0 1 220px; }
html body .filtros .campo.ancho { flex: 1 1 240px; max-width: 360px; }
html body .filtros .boton-contorno { margin-bottom: 0; }

/* ---------- Tema: sigue al sistema, sin boton manual ---------- */
html body .theme-toggle { display: none; }

/* ---------- Ingreso ---------- */
html body.login #container { max-width: none; width: auto; margin: 0; padding: 0; min-height: 100vh; }
html body.login #content { padding: 0; }
html body.login #main, html body.login .content { padding: 0; margin: 0; }
html body .ingreso { display: flex; flex-wrap: wrap; min-height: 100vh; }
html body .ingreso-marca {
    flex: 1 1 420px; min-height: 360px; background: var(--odesa-rojo); color: #ffffff;
    display: flex; flex-direction: column; justify-content: space-between; padding: 48px; box-sizing: border-box;
}
html body .ingreso-logo { display: flex; align-items: center; gap: 12px; font-family: "IBM Plex Sans Condensed", var(--font-family-primary); font-weight: 600; font-size: 22px; letter-spacing: 0.06em; }
html body .ingreso-logo .marca-iso { width: 32px; height: 32px; }
html body .ingreso-texto { display: flex; flex-direction: column; gap: 16px; max-width: 36ch; }
html body .ingreso-cintillo { margin: 0; font-size: 11px; line-height: 16px; letter-spacing: 0.4em; text-transform: uppercase; font-weight: 300; }
html body .ingreso-frase { margin: 0; font-size: 28px; line-height: 34px; font-weight: 300; }
html body .ingreso-nota { margin: 0; font-size: 13px; line-height: 20px; opacity: 0.9; }
html body .ingreso-formulario { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px 32px; box-sizing: border-box; }
html body .ingreso-formulario form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 24px; }
html body .ingreso-formulario h1 { margin: 0; }
html body .ingreso-formulario .bajada { margin: 4px 0 0; }
html body .ingreso-formulario .boton-lleno { width: 100%; }
html body .ingreso-formulario .errornote { margin: 0; border-radius: 0; }

/* Una tabla "lista en telefono" tambien se vuelve lista cuando su caja es angosta en una pantalla grande
   (los bloques a dos columnas del inicio, la ficha de obra y el tablero de decisiones miden unos 430 px a
   1280): antes se desplazaba a lo ancho dentro de la caja. Mismas reglas que en telefono, mas abajo. */
html body .tabla-caja { container-type: inline-size; }
@container (max-width: 520px) {
    html body table.tabla-lista-tel thead { display: none; }
    html body table.tabla-lista-tel, html body table.tabla-lista-tel tbody, html body table.tabla-lista-tel tfoot { display: block; }
    html body table.tabla-lista-tel tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline-color); }
    html body table.tabla-lista-tel td, html body table.tabla-lista-tel th { display: block; border: 0; padding: 2px 0; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
    html body table.tabla-lista-tel th[scope="row"] { grid-column: 1 / -1; font-weight: 500; }
    html body table.tabla-lista-tel td.num { text-align: right; }
    html body table.tabla-lista-tel td[data-e]::before { content: attr(data-e) ": "; color: var(--odesa-texto-2); font-size: 12px; font-family: var(--font-family-primary); }
    html body table.tabla-lista-tel td.fila-accion, html body table.tabla-lista-tel td.ancho-tel, html body table.tabla-lista-tel td[colspan] { grid-column: 1 / -1; text-align: left; }
    html body table.tabla-lista-tel tfoot tr { border-top: 1px solid var(--odesa-linea-fuerte); }
}

/* responsive.css de Django apila la cabecera debajo de 1024 px; aca se apila solo en telefono. */
@media (min-width: 768px) {
    html body #header { flex-direction: row; justify-content: flex-start; align-items: center; padding: 6px 24px; }
    html body #user-tools.barra-herramientas { width: auto; justify-content: flex-start; margin: 0; }
    html body #branding { text-align: left; }
}

/* ---------- Telefono ---------- */
@media (max-width: 767px) {
    /* Cabecera en una sola fila de 56 px: marca, buscar (icono que se despliega), IA (icono), usuario y menu.
       Todo sigue siendo un control real (campo, enlace, <details>): se llega con Tab y se lee con lector de
       pantalla; nada depende de JavaScript salvo el panel del asistente, que ya lo necesitaba.
       #container es una columna flex: sin flex-shrink 0 la cabecera se achica cuando la pagina es alta. */
    html body #header {
        display: flex; flex-direction: row; align-items: center; gap: 8px; height: auto; min-height: 56px;
        flex: 0 0 auto; padding: 4px 8px 4px 16px; position: relative; box-sizing: border-box;
    }
    html body #branding { min-width: 0; margin: 0; flex: 0 1 auto; float: none; }
    html body a.marca-odesa:link, html body a.marca-odesa:visited { white-space: nowrap; min-height: 44px; font-size: 16px; }
    html body #user-tools.barra-herramientas {
        float: none; display: flex; align-items: center; justify-content: flex-end; gap: 4px;
        flex: 1 1 auto; width: auto; min-width: 0; margin: 0; padding: 0; position: static;
    }
    /* Buscar: un icono de 44 px; al tocarlo o llegar con Tab el campo toma el foco y ocupa toda la fila. */
    html body .buscar-global { flex: 0 0 44px; width: 44px; max-width: none; position: static; }
    html body .buscar-global svg { left: auto; top: auto; margin: 13px; position: absolute; }
    html body .buscar-global input[type="search"] {
        width: 44px; height: 44px; padding: 0; border-color: transparent; background: transparent;
        color: transparent; cursor: pointer; font-size: 16px;
    }
    html body .buscar-global input[type="search"]::placeholder { color: transparent; }
    html body .buscar-global:focus-within {
        position: absolute; left: 8px; right: 8px; top: 6px; width: auto; z-index: 70; background: var(--header-bg);
    }
    html body .buscar-global:focus-within svg { margin: 13px 12px; }
    html body .buscar-global:focus-within input[type="search"] {
        width: 100%; padding: 0 12px 0 42px; border-color: var(--secondary); background: var(--body-bg);
        color: var(--body-fg); cursor: text;
    }
    html body .buscar-global:focus-within input[type="search"]::placeholder { color: var(--odesa-texto-2); }
    /* IA: solo el icono; el texto queda para el lector de pantalla. */
    html body #header #user-tools a#asistente-boton:link, html body #header #user-tools a#asistente-boton:visited {
        width: 44px; height: 44px; padding: 0; margin: 0; justify-content: center; border-color: transparent; flex: none;
    }
    html body #user-tools a#asistente-boton .rotulo {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
    }
    html body #user-tools a#asistente-boton svg { width: 20px; height: 20px; }
    html body .usuario-actual { margin-left: 0; gap: 0; position: static; flex: none; }
    html body .usuario-datos, html body .no-telefono, html body .usuario-menu summary .puntos { display: none; }
    html body .usuario-menu summary .solo-telefono { display: grid; }
    html body .usuario-menu summary { width: 44px; height: 44px; padding: 0; }
    html body .usuario-menu summary .usuario-avatar { width: 28px; height: 28px; font-size: 12px; }
    html body .usuario-menu-lista { top: 100%; right: 8px; margin-top: 3px; }
    /* Menu: boton de tres rayas en la misma fila; la lista se abre debajo de la cabecera, a todo el ancho. */
    html body .menu-telefono { display: block; margin: 0; border: 0; flex: none; position: static; }
    html body .menu-telefono summary {
        cursor: pointer; width: 44px; height: 44px; min-height: 0; padding: 0; display: grid; place-items: center;
        color: var(--header-link-color); border: 1px solid transparent; box-sizing: border-box;
    }
    html body .menu-telefono summary svg { width: 22px; height: 22px; }
    html body .menu-telefono[open] summary { border-color: var(--odesa-linea-fuerte); }
    html body .menu-telefono .menu-telefono-lista {
        position: absolute; left: 0; right: 0; top: 100%; margin-top: 3px; z-index: 60;
        max-height: calc(100vh - 62px); overflow-y: auto; background: var(--body-bg);
        border-bottom: 1px solid var(--odesa-linea-fuerte); padding: 4px 0 12px; text-align: left;
        font-size: 14px; font-weight: 400; letter-spacing: 0; text-transform: none;
    }
    /* responsive.css de Django le pone borde y "inline-block" a todo enlace de #user-tools: aca no. */
    html body #user-tools .menu-telefono a:link, html body #user-tools .menu-telefono a:visited {
        display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 20px 0 13px; margin: 0;
        border: 0; border-left: 3px solid transparent; color: var(--body-fg); text-decoration: none;
    }
    html body #user-tools .menu-telefono a.actual { border-left-color: var(--odesa-rojo); }
    html body #user-tools .usuario-menu-lista a, html body #user-tools .usuario-menu-lista button {
        display: flex; align-items: center; min-height: 44px; border: 0; margin: 0; text-transform: none; letter-spacing: 0; font-size: 14px;
    }
    /* Listados y formularios del admin: buscador, acciones, paginas y campos, al tamaño del dedo. */
    html body #changelist #toolbar form input[type="text"], html body #changelist #toolbar form input[type="submit"],
    html body #changelist .actions select, html body #changelist .actions .button, html body #changelist .actions button {
        height: 44px; min-height: 44px; font-size: 16px;
    }
    html body #changelist #toolbar form#changelist-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
    html body #changelist #toolbar form#changelist-search > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
    html body #changelist #toolbar form input[type="text"] { flex: 1 1 160px; width: auto; }
    html body #changelist .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
    html body #changelist .actions label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
    html body .paginator ul { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0; }
    html body .paginator a:link, html body .paginator a:visited, html body .paginator .this-page {
        display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; box-sizing: border-box;
    }
    html body #changelist-filter summary, html body #changelist-filter li a { display: flex; align-items: center; min-height: 40px; }
    html body .aligned .form-row input[type="text"], html body .aligned .form-row input[type="number"],
    html body .aligned .form-row input[type="email"], html body .aligned .form-row input[type="date"],
    html body .aligned .form-row input[type="password"], html body .aligned .form-row select,
    html body .inline-group input[type="text"], html body .inline-group select { min-height: 44px; font-size: 16px; }
    /* Tablas que se vuelven lista en telefono: una fila por registro, cifras a la derecha con su etiqueta. */
    html body table.tabla-lista-tel thead { display: none; }
    html body table.tabla-lista-tel, html body table.tabla-lista-tel tbody, html body table.tabla-lista-tel tfoot { display: block; }
    html body table.tabla-lista-tel tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline-color); }
    html body table.tabla-lista-tel td, html body table.tabla-lista-tel th { display: block; border: 0; padding: 2px 0; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
    html body table.tabla-lista-tel tr { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
    html body table.tabla-lista-tel td[colspan] { grid-column: 1 / -1; }
    html body table.tabla-lista-tel th[scope="row"] { grid-column: 1 / -1; font-weight: 500; }
    html body table.tabla-lista-tel td.num { text-align: right; }
    html body table.tabla-lista-tel td[data-e]::before { content: attr(data-e) ": "; color: var(--odesa-texto-2); font-size: 12px; font-family: var(--font-family-primary); }
    html body table.tabla-lista-tel td.fila-accion, html body table.tabla-lista-tel td.ancho-tel { grid-column: 1 / -1; text-align: left; }
    html body table.tabla-lista-tel tfoot tr { border-top: 1px solid var(--odesa-linea-fuerte); }
    html body .desvio .pista { width: 64px; }
    html body .menu-telefono .menu-grupo { padding: 4px 0; }
    html body #content { padding: 16px 16px 40px; }
    html body .breadcrumbs { padding: 12px 16px 0; }
    html body .grilla-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
    html body .cifra .valor { font-size: 24px; }
    html body .acciones .boton-lleno, html body .acciones .boton-contorno { flex: 1 1 auto; }
    html body .pestanas a:link { padding: 0 10px; }
    html body.login { padding: 0; }   /* responsive.css de Django le deja 15 px a los costados: el plano rojo va a sangre */
    html body .ingreso-marca { padding: 32px 24px; min-height: 0; }
    html body .ingreso-formulario { padding: 32px 16px; }
}
