/* Generado por AssetService. No editar: cambia los modulos de assets/css/src/. */

/* ==========================================================================
   tokens.css
   ========================================================================== */

/* ==========================================================================
   TOKENS
   Unica fuente de verdad del diseno. Ningun otro modulo debe escribir un color,
   un radio o un espaciado literal: siempre var(--...).

   Dos capas a proposito:
   1. Paleta cruda (--teal-500, --gray-200...): los valores. No usar en componentes.
   2. Tokens semanticos (--color-primary, --color-border...): el significado.
      Es lo que consumen los componentes. Cambiando esta capa se retematiza
      la app entera sin tocar un solo componente.
   ========================================================================== */

:root {
    /* --- Paleta cruda: marca (teal/petroleo) ------------------------------ */
    --teal-50:  #eefbf7;
    --teal-100: #d3f5ea;
    --teal-200: #a9ead8;
    --teal-300: #71d9c0;
    --teal-400: #3cc0a4;
    --teal-500: #17a488;
    --teal-600: #0d8770;
    --teal-700: #0d6b5c;
    --teal-800: #0f554b;
    --teal-900: #10473f;
    --teal-950: #042a26;

    /* --- Paleta cruda: neutros (gris con matiz frio, armoniza con el teal) - */
    --gray-0:   #ffffff;
    --gray-25:  #fbfcfc;
    --gray-50:  #f5f8f8;
    --gray-100: #edf2f1;
    --gray-200: #dee6e5;
    --gray-300: #c5d1d0;
    --gray-400: #97a8a7;
    --gray-500: #6d8180;
    --gray-600: #536665;
    --gray-700: #3e4e4d;
    --gray-800: #263230;
    --gray-900: #16201f;

    /* --- Paleta cruda: semanticos ---------------------------------------- */
    --green-50:  #e9f7ef;
    --green-500: #1f9d63;
    --green-700: #146c44;

    --red-50:  #fdecec;
    --red-500: #d64545;
    --red-700: #9b2c2c;

    --amber-50:  #fef4e2;
    --amber-500: #d98324;
    --amber-700: #92400e;

    --blue-50:  #eaf2fd;
    --blue-500: #3b7dd8;
    --blue-700: #1d4e91;

    /* --- Superficies y texto --------------------------------------------- */
    --color-bg: var(--gray-50);
    --color-bg-gradient:
        radial-gradient(circle at 100% 0%, rgba(23, 164, 136, 0.10), transparent 42%),
        linear-gradient(180deg, var(--gray-25) 0%, var(--gray-50) 100%);
    --color-surface: var(--gray-0);
    --color-surface-sunken: var(--gray-100);
    --color-surface-hover: var(--gray-50);

    --color-text: var(--gray-900);
    --color-text-muted: var(--gray-600);
    --color-text-subtle: var(--gray-500);
    --color-text-inverse: var(--gray-0);

    --color-border: var(--gray-200);
    --color-border-strong: var(--gray-300);
    --color-border-subtle: var(--gray-100);

    /* --- Acciones --------------------------------------------------------- */
    --color-primary: var(--teal-600);
    --color-primary-hover: var(--teal-700);
    --color-primary-active: var(--teal-800);
    --color-primary-soft: var(--teal-50);
    --color-primary-on: var(--gray-0);
    --color-accent: var(--amber-500);

    /* --- Estados ---------------------------------------------------------- */
    --color-success: var(--green-500);
    --color-success-soft: var(--green-50);
    --color-success-text: var(--green-700);

    --color-danger: var(--red-500);
    --color-danger-soft: var(--red-50);
    --color-danger-text: var(--red-700);

    --color-warning: var(--amber-500);
    --color-warning-soft: var(--amber-50);
    --color-warning-text: var(--amber-700);

    --color-info: var(--blue-500);
    --color-info-soft: var(--blue-50);
    --color-info-text: var(--blue-700);

    /* --- Barra lateral (tema oscuro propio) ------------------------------- */
    --sidebar-bg: linear-gradient(180deg, var(--teal-900) 0%, var(--teal-950) 100%);
    --sidebar-text: rgba(255, 255, 255, 0.92);
    --sidebar-text-muted: rgba(255, 255, 255, 0.62);
    --sidebar-item-hover: rgba(255, 255, 255, 0.08);
    --sidebar-item-active: rgba(255, 255, 255, 0.14);
    --sidebar-border: rgba(255, 255, 255, 0.10);

    /* --- Tipografia ------------------------------------------------------- */
    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;

    --text-xs:   0.75rem;   /* 12px */
    --text-sm:   0.8125rem; /* 13px */
    --text-base: 0.9375rem; /* 15px */
    --text-md:   1rem;      /* 16px */
    --text-lg:   1.125rem;  /* 18px */
    --text-xl:   1.375rem;  /* 22px */
    --text-2xl:  1.75rem;   /* 28px */
    --text-3xl:  2.125rem;  /* 34px */

    --leading-tight: 1.25;
    --leading-snug: 1.4;
    --leading-normal: 1.6;

    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* --- Espaciado (base 4px) --------------------------------------------- */
    --space-1: 0.25rem;  /*  4px */
    --space-2: 0.5rem;   /*  8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-7: 1.75rem;  /* 28px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */

    /* --- Radios ----------------------------------------------------------- */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-full: 999px;

    /* --- Sombras ---------------------------------------------------------- */
    --shadow-xs: 0 1px 2px rgba(16, 32, 31, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 32, 31, 0.07), 0 1px 2px rgba(16, 32, 31, 0.04);
    --shadow-md: 0 4px 12px rgba(16, 32, 31, 0.07), 0 2px 4px rgba(16, 32, 31, 0.04);
    --shadow-lg: 0 12px 32px rgba(16, 32, 31, 0.10), 0 4px 8px rgba(16, 32, 31, 0.04);
    --shadow-xl: 0 24px 56px rgba(16, 32, 31, 0.14);

    /* --- Foco (accesibilidad) --------------------------------------------- */
    --focus-ring: 0 0 0 3px rgba(23, 164, 136, 0.30);
    --focus-ring-danger: 0 0 0 3px rgba(214, 69, 69, 0.28);

    /* --- Movimiento -------------------------------------------------------- */
    --transition-fast: 120ms ease;
    --transition-base: 180ms ease;

    /* --- Capas ------------------------------------------------------------- */
    --z-sticky: 100;
    --z-dropdown: 200;
    --z-modal: 1000;

    /* --- Medidas de layout -------------------------------------------------- */
    --sidebar-width: 264px;
    --content-padding: var(--space-8);
    --measure: 68ch;
}

/* Respeta a quien pide menos animacion en el sistema operativo. */
@media (prefers-reduced-motion: reduce) {
    :root {
        --transition-fast: 0ms;
        --transition-base: 0ms;
    }
}


/* ==========================================================================
   reset.css
   ========================================================================== */

/* ==========================================================================
   RESET
   Normalizacion minima. Nada de estilo con opinion aqui: eso va en typography
   y en los componentes.
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    background-image: var(--color-bg-gradient);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg,
iframe {
    max-width: 100%;
}

img,
svg {
    display: block;
    height: auto;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
    margin: 0;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: var(--space-5) 0;
}

details > summary {
    cursor: pointer;
}

/* Anillo de foco visible y consistente en toda la app.
   :focus-visible en vez de :focus para no molestar al usuario de raton. */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}


/* ==========================================================================
   typography.css
   ========================================================================== */

/* ==========================================================================
   TIPOGRAFIA
   Escala y ritmo vertical. Los margenes de los bloques de texto se definen
   aqui una sola vez para que ninguna vista tenga que corregirlos con estilos
   sueltos.
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-3);
    line-height: var(--leading-tight);
    font-weight: var(--weight-semibold);
    letter-spacing: -0.01em;
    color: var(--color-text);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
h5, h6 { font-size: var(--text-base); }

p {
    margin: 0 0 var(--space-3);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

strong, b {
    font-weight: var(--weight-semibold);
}

small {
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
}

/* Texto secundario. Es la clase mas usada de la app. */
.muted {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

p.muted {
    margin: var(--space-1) 0 0;
}

/* Etiqueta corta en mayusculas sobre un titulo. */
.eyebrow {
    display: inline-block;
    margin-bottom: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-accent);
}

/* Titulo de un bloque dentro de una tarjeta ("Pregunta del visitante"). */
.field-label {
    margin: var(--space-4) 0 var(--space-1);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
}

/* Lista de pasos numerados dentro de un <details> de ayuda. */
.steps-list {
    margin: var(--space-2) 0 0;
    padding-left: var(--space-5);
    line-height: var(--leading-normal);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.steps-list li + li {
    margin-top: var(--space-1);
}

/* Lista simple con viñeta discreta. */
.plain-list {
    margin: 0;
    padding-left: var(--space-5);
    color: var(--color-text-muted);
    display: grid;
    gap: var(--space-2);
}


/* ==========================================================================
   layout.css
   ========================================================================== */

/* ==========================================================================
   LAYOUT
   El esqueleto del panel: shell de dos columnas, cabecera de pagina y las
   rejillas reutilizables. Los media queries viven junto a lo que modifican.
   ========================================================================== */

/* --- Shell principal ------------------------------------------------------ */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.main-content {
    min-width: 0;
    padding: var(--content-padding);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* --- Cabecera de pagina --------------------------------------------------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
}

.topbar > div {
    min-width: 0;
}

.topbar h1 {
    margin: 0;
    font-size: var(--text-2xl);
}

.topbar p {
    margin: var(--space-1) 0 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    max-width: var(--measure);
}

.topbar-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* --- Contenido ------------------------------------------------------------ */

.page-content {
    display: grid;
    /* minmax(0, 1fr) y no 1fr: los items de grid traen min-width:auto, asi que
       una tabla ancha estiraria la columna y haria scrollear la pagina entera
       en horizontal en vez de scrollear dentro de su .table-wrap. */
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
    align-content: start;
}

/* --- Rejillas reutilizables ----------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Contenido principal + panel lateral de inspeccion (constructor de flujos). */
.grid.flow-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
}

/* --- Agrupadores de elementos en linea ------------------------------------ */

/* Fila de botones que envuelve en pantallas estrechas. */
.actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}

/* Titulo a la izquierda, accion a la derecha. */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.section-header h3 {
    margin: 0;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .grid.two,
    .grid.three,
    .grid.flow-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    :root {
        --content-padding: var(--space-4);
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions .btn {
        width: 100%;
    }

    /* El titulo y su accion no caben en linea: se apilan. */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }
}


/* ==========================================================================
   sidebar.css
   ========================================================================== */

/* ==========================================================================
   BARRA LATERAL
   En escritorio es una columna fija. En movil se convierte en una barra de
   navegacion horizontal desplazable: antes desaparecia por completo y no
   quedaba forma de navegar desde el movil.
   ========================================================================== */

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    overflow-y: auto;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: var(--z-sticky);
}

/* --- Marca ---------------------------------------------------------------- */

.sidebar-brand {
    display: block;
}

.brand {
    display: block;
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.02em;
    color: var(--color-text-inverse);
}

.brand:hover {
    color: var(--color-text-inverse);
    text-decoration: none;
}

.brand-subtitle {
    margin: var(--space-1) 0 0;
    font-size: var(--text-xs);
    line-height: var(--leading-snug);
    color: var(--sidebar-text-muted);
}

/* --- Navegacion ----------------------------------------------------------- */

.sidebar-nav {
    display: grid;
    gap: 2px;
    /* Empuja el pie de la barra hacia abajo sin necesidad de space-between. */
    margin-bottom: auto;
}

.sidebar-nav a {
    display: block;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    color: var(--sidebar-text);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-nav a:hover {
    background: var(--sidebar-item-hover);
    color: var(--color-text-inverse);
    text-decoration: none;
}

.sidebar-nav a[aria-current="page"] {
    background: var(--sidebar-item-active);
    color: var(--color-text-inverse);
    font-weight: var(--weight-medium);
    box-shadow: inset 3px 0 0 var(--teal-300);
}

/* Insignia "beta" junto a las secciones cuyo motor aun no ejecuta en el chat. */
.nav-beta {
    display: inline-block;
    margin-left: var(--space-1);
    padding: 1px var(--space-2);
    border-radius: var(--radius-full);
    background: rgba(242, 166, 90, 0.22);
    color: var(--amber-500);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.sidebar-nav a:focus-visible {
    outline-color: var(--teal-300);
}

/* --- Pie: usuario y salida ------------------------------------------------ */

.sidebar-footer {
    display: grid;
    gap: var(--space-3);
}

.user-card {
    display: grid;
    gap: 2px;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--sidebar-item-hover);
    border: 1px solid var(--sidebar-border);
}

.user-card strong {
    font-size: var(--text-base);
    color: var(--color-text-inverse);
    overflow-wrap: anywhere;
}

.user-card span {
    font-size: var(--text-xs);
    color: var(--sidebar-text-muted);
    overflow-wrap: anywhere;
}

/* Boton de cerrar sesion sobre fondo oscuro. */
.sidebar .btn-logout {
    width: 100%;
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
}

.sidebar .btn-logout:hover {
    background: var(--sidebar-item-hover);
    color: var(--color-text-inverse);
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 1080px) {
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: var(--space-4);
        padding: var(--space-3) var(--space-4);
        overflow-x: auto;
        overflow-y: hidden;
    }

    .sidebar-brand {
        flex-shrink: 0;
    }

    .brand-subtitle {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        gap: var(--space-1);
        margin-bottom: 0;
    }

    .sidebar-nav a {
        white-space: nowrap;
    }

    .sidebar-nav a[aria-current="page"] {
        box-shadow: inset 0 -2px 0 var(--teal-300);
    }

    .sidebar-footer {
        margin-left: auto;
        flex-shrink: 0;
    }

    /* En movil el correo del usuario no aporta y roba mucho ancho. */
    .user-card {
        display: none;
    }

    .sidebar .btn-logout {
        white-space: nowrap;
    }
}


/* ==========================================================================
   buttons.css
   ========================================================================== */

/* ==========================================================================
   BOTONES
   Una base (.btn) y variantes por color. Cualquier <a> o <button> con .btn
   se ve igual. Estados hover/active/focus/disabled definidos para todas.
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    background: var(--color-primary);
    color: var(--color-primary-on);
    box-shadow: var(--shadow-xs);
    transition: background var(--transition-fast),
                border-color var(--transition-fast),
                color var(--transition-fast),
                box-shadow var(--transition-fast),
                transform var(--transition-fast);
}

.btn:hover {
    background: var(--color-primary-hover);
    color: var(--color-primary-on);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    background: var(--color-primary-active);
    transform: translateY(1px);
    box-shadow: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    pointer-events: none;
    box-shadow: none;
}

/* --- Variantes ------------------------------------------------------------ */

.btn-secondary {
    background: var(--color-surface);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-text-subtle);
    color: var(--color-text);
}

.btn-secondary:active {
    background: var(--color-surface-sunken);
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-text-inverse);
}

.btn-danger:hover {
    background: var(--color-danger-text);
    color: var(--color-text-inverse);
}

.btn-danger:active {
    background: var(--color-danger-text);
}

.btn-danger:focus-visible {
    box-shadow: var(--focus-ring-danger);
}

/* Accion terciaria: parece un enlace pero se alinea como boton. */
.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--color-surface-sunken);
    color: var(--color-text);
    box-shadow: none;
}

/* --- Modificadores -------------------------------------------------------- */

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
}

/* En movil un boton de texto largo en nowrap se sale de la pantalla:
   ahi preferimos que parta en dos lineas. */
@media (max-width: 640px) {
    .btn {
        white-space: normal;
    }
}


/* ==========================================================================
   forms.css
   ========================================================================== */

/* ==========================================================================
   FORMULARIOS
   La app usa el patron <label>Texto <input></label>. Aqui se le da estructura
   a ese patron una sola vez, en vez de repetir margenes en cada vista.
   ========================================================================== */

/* --- Etiqueta contenedora ------------------------------------------------- */

/* Un <label> que envuelve a su control se convierte en una pila vertical. */
label {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text);
}

/* Los textos de ayuda dentro de la etiqueta no deben heredar el peso. */
label small,
label .muted {
    font-weight: var(--weight-normal);
}

/* Excepcion: si la etiqueta envuelve una casilla, el control va al lado del
   texto, no encima. Cubre las casillas sueltas que no estan en .checkboxes. */
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--weight-normal);
    cursor: pointer;
}

/* --- Controles ------------------------------------------------------------ */

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:not([type="checkbox"]):not([type="radio"]):hover,
textarea:hover,
select:hover {
    border-color: var(--color-text-subtle);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

input:read-only,
input:disabled,
textarea:disabled,
select:disabled {
    background: var(--color-surface-sunken);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 90px;
    line-height: var(--leading-normal);
}

select[multiple] {
    padding: var(--space-1);
}

select[multiple] option {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-xs);
}

input[type="checkbox"],
input[type="radio"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}

::placeholder {
    color: var(--color-text-subtle);
    opacity: 1;
}

/* --- Composicion ---------------------------------------------------------- */

.form-grid {
    display: grid;
    /* minmax(0, 1fr): sin esto un boton de texto largo (que va en nowrap)
       estira la columna y desborda el contenedor en pantallas estrechas. */
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    align-content: start;
}

/* Texto de ayuda bajo un control. */
.form-hint {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: var(--weight-normal);
}

/* Grupo de casillas en linea. El label vuelve a ser horizontal aqui. */
.checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-5);
}

.checkboxes label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--weight-normal);
    cursor: pointer;
}

/* --- Fieldset agrupador --------------------------------------------------- */

.fieldset {
    margin: 0;
    /* El navegador le pone min-inline-size:min-content a todo <fieldset>, asi
       que en movil se niega a encoger y desborda la tarjeta. Hay que anularlo. */
    min-inline-size: 0;
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
}

.fieldset > legend {
    padding: 0 var(--space-2);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}

/* --- Barras de herramientas de filtros ------------------------------------ */

.conversation-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(150px, 0.8fr) auto;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-4);
}

.conversation-toolbar .badge {
    justify-self: end;
}

.flow-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.flow-toolbar label {
    min-width: 180px;
}

.flow-ai-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
    .conversation-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .conversation-toolbar .badge {
        justify-self: start;
    }
}

@media (max-width: 640px) {
    .flow-ai-toolbar {
        grid-template-columns: minmax(0, 1fr);
    }

    .flow-toolbar label {
        min-width: 100%;
    }
}


/* ==========================================================================
   cards.css
   ========================================================================== */

/* ==========================================================================
   TARJETAS
   Superficie base de todo el panel (.card) y sus variantes: metricas del
   dashboard, editor de mensajes y marco de previsualizacion.
   ========================================================================== */

.card {
    padding: var(--space-6);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.card > :last-child {
    margin-bottom: 0;
}

/* --- Tarjeta de metrica (dashboard) --------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
}

.stat-card {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card span {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.stat-card strong {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    line-height: 1;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

/* --- Editor de mensajes de una conversacion -------------------------------- */

.conversation-editor {
    display: grid;
    gap: var(--space-4);
}

.message-editor {
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    display: grid;
    gap: var(--space-3);
}

/* Quien habla, en el editor de una conversacion. */
.message-editor.user {
    border-left-color: var(--teal-700);
}

.message-editor.assistant {
    border-left-color: var(--color-accent);
}

/* Valoracion, en la pantalla de mejoras. */
.message-editor.is-positive {
    border-left-color: var(--color-success);
}

.message-editor.is-negative {
    border-left-color: var(--color-warning);
}

.message-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* El rol llega de la base de datos en minusculas ("user", "assistant"). */
.message-role {
    text-transform: capitalize;
}

/* --- Marco de previsualizacion del widget ---------------------------------- */

.preview-frame {
    width: 100%;
    max-width: 420px;
    height: 560px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

/* --- Responsive ------------------------------------------------------------ */

@media (max-width: 1080px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .card {
        padding: var(--space-4);
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-3);
    }

    .stat-card strong {
        font-size: var(--text-2xl);
    }
}


/* ==========================================================================
   status.css
   ========================================================================== */

/* ==========================================================================
   ESTADO
   Etiquetas (.badge), avisos de pagina (.alert), resultado de comprobaciones
   (.ping-result) y textos con color semantico. Todas las variantes comparten
   el mismo juego de tokens: soft de fondo, text de color.
   ========================================================================== */

/* --- Badges ---------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    line-height: 1.5;
    white-space: nowrap;
    background: var(--color-surface-sunken);
    color: var(--color-text-muted);
}

.badge.success {
    background: var(--color-success-soft);
    color: var(--color-success-text);
}

.badge.danger {
    background: var(--color-danger-soft);
    color: var(--color-danger-text);
}

.badge.warning {
    background: var(--color-warning-soft);
    color: var(--color-warning-text);
}

.badge.info {
    background: var(--color-info-soft);
    color: var(--color-info-text);
}

.badge.muted {
    background: var(--color-surface-sunken);
    color: var(--color-text-muted);
}

.badge + .badge {
    margin-left: var(--space-2);
}

/* --- Alerts ---------------------------------------------------------------- */

.alert {
    padding: var(--space-3) var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
}

.alert.success {
    background: var(--color-success-soft);
    border-color: var(--color-success);
    color: var(--color-success-text);
}

.alert.danger {
    background: var(--color-danger-soft);
    border-color: var(--color-danger);
    color: var(--color-danger-text);
}

.alert.info {
    background: var(--color-info-soft);
    border-color: var(--color-info);
    color: var(--color-info-text);
}

/* Aviso flotante en las pantallas sin barra lateral (login / registro). */
.guest-alert {
    width: min(980px, calc(100% - var(--space-8)));
    margin: var(--space-5) auto 0;
}

/* --- Resultado de "Probar conexion" ---------------------------------------- */

.ping-result {
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    background: var(--color-surface-sunken);
    color: var(--color-text-muted);
}

.ping-result.is-ok {
    background: var(--color-success-soft);
    border-color: var(--color-success);
    color: var(--color-success-text);
}

.ping-result.is-error {
    background: var(--color-danger-soft);
    border-color: var(--color-danger);
    color: var(--color-danger-text);
}

/* --- Texto con color semantico --------------------------------------------- */

.text-success { color: var(--color-success-text); }
.text-danger  { color: var(--color-danger-text); }
.text-warning { color: var(--color-warning-text); }
.text-muted   { color: var(--color-text-muted); }

/* --- Estado vacio ----------------------------------------------------------- */

.empty-state {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}


/* ==========================================================================
   tables.css
   ========================================================================== */

/* ==========================================================================
   TABLAS Y LISTAS
   Dos formas de listar en la app: <table> para datos con columnas y .list-row
   para pares titulo/valor dentro de una tarjeta.
   ========================================================================== */

/* --- Tablas ---------------------------------------------------------------- */

/* Las tablas anchas hacen scroll dentro de su contenedor: la pagina nunca
   debe desplazarse en horizontal. */
.table-wrap {
    overflow-x: auto;
    margin: 0 calc(var(--space-6) * -1) calc(var(--space-6) * -1);
    padding: 0 var(--space-6) var(--space-6);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

thead th {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border-strong);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    white-space: nowrap;
}

tbody td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--color-surface-hover);
}

/* La columna de acciones no debe partirse en varias lineas si hay sitio. */
td.actions {
    white-space: nowrap;
}

/* Los formularios de accion (duplicar, borrar) no deben romper la fila. */
.actions form {
    display: contents;
}

/* --- Filas de lista --------------------------------------------------------- */

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-subtle);
}

.list-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.list-row:first-child {
    padding-top: 0;
}

.list-row strong {
    font-weight: var(--weight-medium);
}

.list-row p {
    margin: 2px 0 0;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}

.list-row > span {
    text-align: right;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}

/* --- Responsive ------------------------------------------------------------- */

@media (max-width: 640px) {
    .table-wrap {
        margin: 0 calc(var(--space-4) * -1) calc(var(--space-4) * -1);
        padding: 0 var(--space-4) var(--space-4);
    }

    .list-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-row > span {
        text-align: left;
    }
}


/* ==========================================================================
   code.css
   ========================================================================== */

/* ==========================================================================
   CODIGO
   Fragmentos incrustables, volcados de logs y codigo en linea.
   ========================================================================== */

code,
kbd,
samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* Codigo en linea dentro de un parrafo. */
:not(pre) > code {
    padding: 0.15em 0.4em;
    border-radius: var(--radius-xs);
    background: var(--color-surface-sunken);
    color: var(--color-text);
    overflow-wrap: anywhere;
}

/* Bloque de codigo sobre fondo oscuro (snippets de embed, logs). */
.code-block {
    margin: var(--space-3) 0;
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--teal-950);
    color: var(--teal-100);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: auto;
    max-height: 420px;
}

.code-block code {
    padding: 0;
    background: none;
    color: inherit;
}


/* ==========================================================================
   chat.css
   ========================================================================== */

/* ==========================================================================
   CHAT
   Registro de mensajes, burbujas y formulario de envio. Lo usan el chat admin
   y el chat publico; el widget embebido tiene su propio CSS en public/embed/.
   ========================================================================== */

.chat-log {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 340px;
    max-height: 480px;
    margin: var(--space-4) 0;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-sunken);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

/* --- Burbujas -------------------------------------------------------------- */

.chat-bubble {
    max-width: 78%;
    width: fit-content;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    overflow-wrap: anywhere;
    box-shadow: var(--shadow-xs);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--color-primary);
    color: var(--color-primary-on);
    border-bottom-right-radius: var(--radius-xs);
}

.chat-bubble.assistant {
    position: relative;
    align-self: flex-start;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: var(--radius-xs);
}

.chat-bubble p {
    margin: 0 0 var(--space-2);
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble ul,
.chat-bubble ol {
    margin: var(--space-2) 0;
    padding-left: var(--space-5);
}

.chat-bubble li + li {
    margin-top: var(--space-1);
}

.chat-bubble code {
    padding: 0.15em 0.4em;
    border-radius: var(--radius-xs);
    background: rgba(16, 32, 31, 0.08);
    font-size: 0.92em;
}

.chat-bubble.user code {
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
}

.chat-bubble.user a {
    color: inherit;
    text-decoration: underline;
}

/* --- Formulario de envio ---------------------------------------------------- */

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2);
}

/* Aviso de error sobre el formulario. Se muestra anadiendo .is-visible. */
.chat-error {
    display: none;
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--color-danger-soft);
    color: var(--color-danger-text);
    font-size: var(--text-sm);
}

.chat-error.is-visible {
    display: block;
}

/* --- Chat publico a pagina completa ----------------------------------------- */

.public-chat-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-6);
}

.public-chat-card {
    width: min(720px, 100%);
    padding: var(--space-8);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
}

/* --- Responsive -------------------------------------------------------------- */

@media (max-width: 640px) {
    .chat-bubble {
        max-width: 90%;
    }

    .chat-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .public-chat-page {
        padding: var(--space-3);
    }

    .public-chat-card {
        padding: var(--space-5);
    }
}


/* ==========================================================================
   feedback.css
   ========================================================================== */

/* ==========================================================================
   FEEDBACK
   Barra de 👍/👎 bajo cada respuesta del bot, modal de correccion y bloques de
   contexto de la pantalla de mejoras.
   ========================================================================== */

/* --- Barra de valoracion ---------------------------------------------------- */

.feedback-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border-subtle);
    font-size: var(--text-xs);
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-full);
    background: transparent;
    font-size: 14px;
    line-height: 1;
    transition: background var(--transition-fast),
                border-color var(--transition-fast),
                transform var(--transition-fast);
}

.feedback-btn:hover {
    background: var(--color-surface-sunken);
    transform: translateY(-1px);
}

.feedback-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.feedback-btn[disabled] {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

.feedback-btn.is-active.up {
    background: var(--color-success-soft);
    border-color: var(--color-success);
    color: var(--color-success-text);
}

.feedback-btn.is-active.down {
    background: var(--color-danger-soft);
    border-color: var(--color-danger);
    color: var(--color-danger-text);
}

.feedback-status {
    margin-left: var(--space-1);
    color: var(--color-text-muted);
}

.feedback-status.success { color: var(--color-success-text); }
.feedback-status.error   { color: var(--color-danger-text); }

/* --- Bloque de contexto (pregunta / respuesta citada) ----------------------- */

.feedback-context {
    padding: var(--space-3);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    background: var(--color-surface-sunken);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}

.feedback-context strong {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--color-text);
}

/* La correccion guardada se distingue en verde de lo que dijo el bot. */
.feedback-context.is-correction {
    background: var(--color-success-soft);
    border-color: var(--color-success);
    color: var(--color-success-text);
}

/* --- Modal de correccion ----------------------------------------------------- */

.feedback-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgba(16, 32, 31, 0.55);
}

.feedback-modal {
    width: min(560px, 100%);
    max-height: 92vh;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    display: grid;
    gap: var(--space-3);
}

.feedback-modal h3 {
    margin: 0;
}

.feedback-modal textarea {
    min-height: 110px;
}

/* Se marca con .is-invalid cuando se intenta guardar vacio. */
.feedback-modal textarea.is-invalid {
    border-color: var(--color-danger);
    box-shadow: var(--focus-ring-danger);
}

.feedback-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    cursor: pointer;
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

@media (max-width: 640px) {
    .feedback-actions {
        flex-direction: column-reverse;
    }

    .feedback-actions .btn {
        width: 100%;
    }
}


/* ==========================================================================
   flow-builder.css
   ========================================================================== */

/* ==========================================================================
   CONSTRUCTOR DE FLUJOS
   Capa de tema sobre Drawflow (libreria externa cargada por CDN en la vista de
   flujos). Los !important son necesarios: Drawflow escribe estilos propios con
   alta especificidad sobre estas mismas clases.
   ========================================================================== */

.flow-builder {
    position: relative;
    display: block;
    height: 620px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.flow-builder.parent-drawflow {
    padding: 0;
    border: 1px solid var(--color-border);
}

/* Lienzo con rejilla de puntos. */
.flow-builder .drawflow {
    width: 100%;
    height: 100%;
    background-color: var(--gray-25);
    background-image:
        linear-gradient(90deg, rgba(23, 164, 136, 0.07) 1px, transparent 1px),
        linear-gradient(180deg, rgba(23, 164, 136, 0.07) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* --- Nodos ------------------------------------------------------------------ */

.flow-builder .drawflow-node {
    min-width: 240px;
    border: 1px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    background: var(--color-surface) !important;
    box-shadow: var(--shadow-md) !important;
}

.flow-builder .drawflow-node .drawflow_content_node {
    padding: var(--space-3) var(--space-4) !important;
    background: transparent !important;
    border-radius: var(--radius-md) !important;
}

.flow-builder .drawflow-node.selected {
    border-color: var(--color-primary) !important;
    background: var(--color-surface) !important;
    box-shadow: var(--focus-ring), var(--shadow-lg) !important;
}

.flow-node-card {
    display: grid;
    gap: var(--space-1);
}

.flow-node-card strong {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    color: var(--color-text);
}

.flow-node-card small {
    display: block;
    width: fit-content;
    padding: 2px var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-sunken);
    font-size: var(--text-xs);
    line-height: 1.4;
    color: var(--color-text-muted);
}

/* --- Puertos y conexiones ---------------------------------------------------- */

.flow-builder .drawflow-node .input,
.flow-builder .drawflow-node .output {
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-primary);
    background: var(--color-surface) !important;
    cursor: crosshair;
}

.flow-builder .connection .main-path {
    stroke: var(--color-primary);
    stroke-width: 2.5px;
}

/* --- Aviso cuando Drawflow no carga ------------------------------------------ */

.flow-node {
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
    .flow-builder {
        height: 440px;
    }
}


/* ==========================================================================
   auth.css
   ========================================================================== */

/* ==========================================================================
   AUTENTICACION
   Pantallas de login y registro: panel a dos columnas (argumento de venta a la
   izquierda, formulario a la derecha) que colapsa en movil.
   ========================================================================== */

.guest-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.auth-wrap {
    flex: 1;
    display: grid;
    place-items: center;
    padding: var(--space-6);
}

.auth-panel {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1fr 0.9fr;
    gap: var(--space-8);
    padding: var(--space-10);
    border-radius: var(--radius-xl);
    background: linear-gradient(140deg, var(--teal-800) 0%, var(--teal-950) 100%);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-xl);
}

.auth-panel h2 {
    margin: 0 0 var(--space-3);
    font-size: var(--text-2xl);
    color: var(--color-text-inverse);
}

.auth-panel > div > p {
    color: rgba(255, 255, 255, 0.75);
    max-width: 34ch;
}

/* El formulario es una tarjeta clara sobre el panel oscuro. */
.auth-panel .card {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: transparent;
}

@media (max-width: 860px) {
    .auth-panel {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-6);
        padding: var(--space-6);
    }
}

@media (max-width: 640px) {
    .auth-wrap {
        padding: var(--space-3);
    }
}


/* ==========================================================================
   utilities.css
   ========================================================================== */

/* ==========================================================================
   UTILIDADES
   Ultimo modulo del bundle a proposito: debe ganar a los componentes.

   Regla de uso: si necesitas mas de dos utilidades seguidas en el mismo
   elemento, probablemente falte una clase de componente. Este fichero existe
   para no volver a escribir style="..." en las vistas, no para construir con
   utilidades.
   ========================================================================== */

/* --- Visibilidad ------------------------------------------------------------ */

/* Sustituye a element.style.display = 'none' desde JavaScript. */
.is-hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* --- Margen superior --------------------------------------------------------- */

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-5 { margin-top: var(--space-5) !important; }
.mt-6 { margin-top: var(--space-6) !important; }

/* --- Margen inferior --------------------------------------------------------- */

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }

/* --- Composicion ------------------------------------------------------------- */

/* Pila vertical con separacion uniforme. */
.stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
}

.stack-sm { gap: var(--space-2); }
.stack-lg { gap: var(--space-5); }

/* Grupo horizontal que envuelve. */
.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.w-full { width: 100% !important; }

/* --- Texto -------------------------------------------------------------------- */

.text-sm { font-size: var(--text-sm) !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.nowrap { white-space: nowrap !important; }
