/*
 * IdeaStack — capa de tema de los paneles (owner y admin de cada sitio).
 * Sistema de diseño `call-design-system` (variante sin Color Admin): Bootstrap 5.3 local + esta capa, cargada última.
 * Paleta: UNA familia de azul tomada del azul del logo y de los botones (#3D5AFE), en tres intensidades que combinan
 * entre sí — azul marino profundo #151A4D (sidebar), azul intenso #24349E (héroe, títulos) y azul de acción #3D5AFE
 * (botones, ítem activo, foco) — más el violeta del logo #6A3DF0 solo como acento. Lienzo gris azulado, tarjetas,
 * modales y tablas blancas, 13 px, controles de 36 px.
 * Las clases nx-* son las que dibuja el núcleo JS (public/assets/js/panel).
 */

:root {
    --nx-navy: #151a4d;
    --nx-navy-2: #24349e;
    --nx-sidebar-bg: #1a246f;
    --nx-primary: #3d5afe;
    --nx-primary-dark: #2c45dc;
    --nx-primary-subtle: #edf0ff;
    --nx-accent: #6a3df0;
    --nx-lilac: #9f95f4;
    --nx-lilac-soft: #c9c3fa;
    --nx-canvas: #f4f6fc;
    --nx-border: #dce2f0;
    --nx-text: #1a1f45;
    --nx-text-muted: #667091;
    --nx-success: #16a34a;
    --nx-warning: #f59e0b;
    --nx-danger: #dc2626;
    --nx-radius: 10px;
    --nx-fs: 13px;
    --nx-control-h: 36px;
    --nx-sidebar-w: 248px;
    --nx-sidebar-mini: 76px;

    --bs-primary: var(--nx-primary);
    --bs-primary-rgb: 61, 90, 254;
    --bs-link-color: var(--nx-primary);
    --bs-link-color-rgb: 61, 90, 254;
    --bs-link-hover-color: var(--nx-primary-dark);
    --bs-body-bg: var(--nx-canvas);
    --bs-body-color: var(--nx-text);
    --bs-border-color: var(--nx-border);
    --bs-body-font-size: var(--nx-fs);
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { font-size: var(--nx-fs); }
body { background: var(--nx-canvas); color: var(--nx-text); }
a { text-decoration: none; }

/* ── Controles: un alto para todo ───────────────────────────────────── */
.btn, .form-control, .form-select { min-height: var(--nx-control-h); font-size: var(--nx-fs); }
.form-control, .form-select { border-color: var(--nx-border); border-radius: 6px; }
/* Igual que .card: Bootstrap 5.3 pinta los controles con --bs-body-bg (el gris del lienzo); van blancos. */
.form-control, .form-select, .input-group-text { background-color: #fff; }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: #f4f6fb; }
/* Casillas, interruptores y foco con el azul de la marca (Bootstrap trae #0d6efd fijo). */
.form-check-input:checked { background-color: var(--nx-primary); border-color: var(--nx-primary); }
.form-check-input:indeterminate { background-color: var(--nx-primary); border-color: var(--nx-primary); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #aab5ff; box-shadow: 0 0 0 .2rem rgba(61, 90, 254, .16); }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23aab5ff'/%3e%3c/svg%3e"); }
::selection { background: #dfe3ff; }
.btn { border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--nx-primary); --bs-btn-border-color: var(--nx-primary); --bs-btn-hover-bg: var(--nx-primary-dark); --bs-btn-hover-border-color: var(--nx-primary-dark); --bs-btn-active-bg: var(--nx-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--nx-primary); --bs-btn-border-color: var(--nx-primary); --bs-btn-hover-bg: var(--nx-primary); --bs-btn-hover-border-color: var(--nx-primary); }
.btn-icon { width: var(--nx-control-h); padding: 0; }
.form-label { font-weight: 600; margin-bottom: .3rem; }
.nx-required::after { content: " *"; color: var(--nx-danger); }

/* ── Estructura: barra lateral + cabecera + contenido ───────────────── */
.nx-app { display: flex; min-height: 100vh; }
/* El sidebar queda fijo a la vista con su propio scroll (el menú del admin es largo). */
.nx-sidebar { width: var(--nx-sidebar-w); flex: 0 0 var(--nx-sidebar-w); background: var(--nx-sidebar-bg); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: transparent transparent; }
/* La barra de scroll del sidebar aparece solo al pasar el mouse (si no, se ve como una franja en el borde). */
.nx-sidebar:hover { scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.nx-sidebar .nx-nav { padding-bottom: 1.25rem; }
.nx-sidebar-backdrop { display: none; }
/* Botón ☰ de la cabecera: azul sólido, siempre visible; oculta y muestra el sidebar. */
.nx-header__toggle { display: inline-flex; width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid var(--nx-primary); border-radius: 8px; background: var(--nx-primary); color: #fff; align-items: center; justify-content: center; transition: background .15s; }
.nx-header__toggle:hover, .nx-header__toggle:focus-visible { background: var(--nx-primary-dark); border-color: var(--nx-primary-dark); color: #fff; }
/*
 * Escritorio: ☰ deja el sidebar ANGOSTO (76 px), no lo oculta: símbolo del logo, avatar e íconos del menú; las
 * secciones pasan a ser líneas, el ítem activo un cuadrado azul y el nombre aparece al pasar el mouse (title).
 * La clase la pone el script del <head> (sin parpadeo) o admin-ui.js.
 */
.nx-sidebar__logo-mark { display: none; width: 40px; height: 40px; }
@media (min-width: 992px) {
    .nx-sidebar { transition: width .2s ease, flex-basis .2s ease; }
    .nx-sidebar-collapsed .nx-sidebar { width: var(--nx-sidebar-mini); flex-basis: var(--nx-sidebar-mini); }
    .nx-sidebar-collapsed .nx-sidebar__logo-img { display: none; }
    .nx-sidebar-collapsed .nx-sidebar__logo-mark { display: block; }
    .nx-sidebar-collapsed .nx-sidebar__brand { padding: 1rem .5rem; }
    .nx-sidebar-collapsed .nx-profile { margin: .9rem auto; padding: .5rem; width: 56px; justify-content: center; }
    .nx-sidebar-collapsed .nx-profile__text { display: none; }
    .nx-sidebar-collapsed .nx-nav { padding: 0 .55rem 1.25rem; }
    .nx-sidebar-collapsed .nx-nav__section { font-size: 0; padding: 0; margin: .75rem .6rem; border-top: 1px solid rgba(255, 255, 255, .16); }
    .nx-sidebar-collapsed .nx-nav__section:first-child { display: none; }
    .nx-sidebar-collapsed .nx-nav a { justify-content: center; width: 44px; height: 44px; margin: .3rem auto; padding: 0; border-radius: 10px; }
    .nx-sidebar-collapsed .nx-nav a i { width: auto; font-size: 17px; }
    .nx-sidebar-collapsed .nx-nav__label { display: none; }
}

/* Buscador global de la cabecera (pages/shell.js). */
.nx-search { position: relative; flex: 1 1 auto; max-width: 440px; }
.nx-search .input-group-text { background: #fff; color: var(--nx-text-muted); }
.nx-search > .input-group-text:first-child { border-right: 0; padding-right: .35rem; }
.nx-search .form-control { border-left: 0; border-right: 0; }
.nx-search .form-control:focus { box-shadow: none; }
.nx-search:focus-within .input-group-text, .nx-search:focus-within .form-control { border-color: #aab5ff; }
.nx-search__kbd { gap: .2rem; padding-left: .35rem; }
.nx-search__kbd kbd { font-size: 10.5px; padding: .1rem .35rem; background: var(--nx-canvas); color: var(--nx-text-muted); border: 1px solid var(--nx-border); box-shadow: none; }
.nx-search__menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1050; background: #fff; border: 1px solid var(--nx-border); border-radius: 10px; box-shadow: 0 10px 30px rgba(21, 26, 77, .12); padding: .35rem; }
.nx-search__menu a { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 6px; color: var(--nx-text); }
.nx-search__menu a i { width: 16px; text-align: center; color: var(--nx-text-muted); }
.nx-search__menu a b { color: var(--nx-primary); }
.nx-search__menu a:hover, .nx-search__menu a.is-active { background: var(--nx-primary-subtle); }
.nx-sidebar__brand { padding: 1.1rem 1.25rem; display: flex; align-items: center; gap: .7rem; min-height: 64px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
/* Logo blanco de IdeaStack (docs/logos-ideastack) con el sitio debajo. */
.nx-sidebar__brand--logo { flex-direction: column; align-items: center; justify-content: center; gap: .4rem; }
/* El sidebar tiene alto fijo y scroll propio: sus bloques no se achican (si no, el nombre del sitio queda en 0 px). */
.nx-sidebar > * { flex-shrink: 0; }
.nx-sidebar__logo-img { display: block; height: 40px; width: auto; max-width: 100%; }
.nx-sidebar__logo { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; background: linear-gradient(135deg, var(--nx-primary), var(--nx-accent)); display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.nx-sidebar__product { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.nx-sidebar__scope { font-size: 11.5px; color: rgba(255, 255, 255, .62); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-profile { margin: 1rem; padding: .75rem .85rem; border-radius: var(--nx-radius); background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); display: flex; align-items: center; gap: .7rem; }
.nx-profile__text { min-width: 0; }
.nx-profile__text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-profile__text small { display: block; color: rgba(255, 255, 255, .65); }
.nx-nav { list-style: none; margin: 0; padding: 0 .75rem; }
.nx-nav__section { padding: 1rem .6rem .35rem; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .5); }
.nx-nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 8px; color: rgba(255, 255, 255, .82); font-size: 1rem; }
.nx-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nx-nav a.is-active { background: var(--nx-primary); color: #fff; }
.nx-nav a i { width: 18px; text-align: center; }

.nx-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.nx-header { height: 52px; background: #fff; border-bottom: 1px solid var(--nx-border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1.5rem; }
.nx-header__context { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: .75rem; }
.nx-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: var(--nx-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.nx-avatar--lg { width: 40px; height: 40px; flex-basis: 40px; font-size: 14px; }
.nx-user-menu { display: inline-flex; align-items: center; gap: .55rem; border: 0; background: transparent; padding: .3rem .5rem; border-radius: 8px; color: var(--nx-text); font-weight: 700; }
.nx-user-menu:hover, .nx-user-menu[aria-expanded="true"] { background: var(--nx-canvas); }
.nx-dropdown { min-width: 200px; border: 1px solid var(--nx-border); border-radius: 10px; box-shadow: 0 10px 30px rgba(21, 26, 77, .12); padding: .35rem; font-size: var(--nx-fs); }
.nx-dropdown .dropdown-item { border-radius: 6px; padding: .5rem .7rem; display: flex; align-items: center; gap: .55rem; color: var(--nx-text); }
.nx-dropdown .dropdown-item:hover, .nx-dropdown .dropdown-item:focus { background: var(--nx-primary-subtle); color: var(--nx-text); }
.nx-content { padding: 20px 30px 40px; }
.nx-content > * + * { margin-top: 1rem; }

/* ── Héroe azul ─────────────────────────────────────────────────────── */
/* Héroe de color sólido (índigo de la marca), sin degradados ni brillos. */
.nx-hero { background: var(--nx-navy-2); color: #fff; border-radius: 12px; padding: 22px 26px; min-height: 112px; display: flex; align-items: center; gap: 1rem; position: relative; overflow: hidden; }
.nx-hero__icon { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 12px; background: rgba(255, 255, 255, .12); display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.nx-hero__eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .7); font-weight: 700; }
.nx-hero__title { font-size: 21px; font-weight: 800; margin: .1rem 0; }
.nx-hero__subtitle { font-size: 13.5px; color: rgba(255, 255, 255, .82); margin: 0; }
.nx-hero__body { flex: 1 1 auto; min-width: 0; position: relative; z-index: 1; }
.nx-hero__actions { display: flex; flex-wrap: wrap; gap: .5rem; position: relative; z-index: 1; }
.nx-hero__btn { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .55); --bs-btn-hover-color: var(--nx-navy); --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #fff; --bs-btn-active-color: var(--nx-navy); --bs-btn-active-bg: #fff; }
.nx-hero__chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.nx-hero__chips:empty { display: none; }
.nx-chip { background: rgba(255, 255, 255, .14); border-radius: 999px; padding: .15rem .6rem; font-size: 11.5px; font-weight: 700; }

/* ── Tarjetas de formulario (encabezado: pastilla con ícono + título + línea) ─── */
.nx-card-head { display: flex; align-items: center; gap: .7rem; padding: 14px 20px; border-bottom: 1px solid var(--nx-border); }
.nx-card-head__icon { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 8px; background: var(--nx-primary-subtle); color: var(--nx-primary); display: inline-flex; align-items: center; justify-content: center; }
.nx-card-head__title { font-weight: 800; font-size: 14px; margin: 0; }
.nx-card-head__subtitle { color: var(--nx-text-muted); font-size: 12px; margin: 0; }
.form-text { color: var(--nx-text-muted); font-size: 12px; }
/* Editor visual (TinyMCE): mismo borde y radio que los controles; en rojo si el campo tiene error. */
.tox.tox-tinymce { border: 1px solid var(--nx-border); border-radius: 6px; }
.is-invalid + .tox.tox-tinymce { border-color: var(--nx-danger); }
textarea.nx-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; min-height: 340px; }
.nx-switch-box { border: 1px solid var(--nx-border); border-radius: 8px; padding: .65rem .8rem; background: #fbfcfe; }
.nx-switch-box .form-check { margin: 0; }
.nx-page-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* Vista previa en buscadores */
.nx-serp { border: 1px dashed var(--nx-border); border-radius: 8px; padding: .75rem .9rem; background: #fff; min-width: 0; }
/* Una grilla de una columna no se ensancha por un texto sin cortes (URL de la vista previa, nombres largos). */
.card-body.d-grid, .nx-details > .d-grid { grid-template-columns: minmax(0, 1fr); }
.nx-serp__url { color: #1a7f37; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-serp__title { color: #1a0dab; font-size: 16px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-serp__desc { color: #4d5156; font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Pestañas píldora (configuración, Mi cuenta) */
.nx-pills { display: flex; flex-wrap: wrap; gap: .5rem; border: 0; }
.nx-pills .nav-link { border: 1px solid var(--nx-border); border-radius: 999px; background: #fff; color: var(--nx-text); font-weight: 600; padding: .5rem 1rem; display: inline-flex; align-items: center; gap: .45rem; }
.nx-pills .nav-link i { color: var(--nx-text-muted); }
.nx-pills .nav-link.active { border-color: var(--nx-primary); color: var(--nx-primary); background: #fff; box-shadow: 0 0 0 1px var(--nx-primary) inset; }
.nx-pills .nav-link.active i { color: var(--nx-primary); }
.nx-pills .nav-link.has-error { border-color: var(--nx-danger); color: var(--nx-danger); }

/* Inicio del admin */
.nx-quick { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border: 1px solid var(--nx-border); border-radius: var(--nx-radius); background: #fff; color: var(--nx-text); height: 100%; }
.nx-quick:hover { border-color: var(--nx-primary); color: var(--nx-text); box-shadow: 0 6px 18px rgba(61, 90, 254, .08); }
.nx-quick small { display: block; color: var(--nx-text-muted); }
.nx-list-plain { list-style: none; margin: 0; padding: 0; }
.nx-list-plain li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid #eef2f8; }
.nx-list-plain li:last-child { border-bottom: 0; }
/* El texto de la fila se recorta con «…» en lugar de ensanchar la tarjeta (Bootstrap no trae `min-w-0`). */
.nx-list-plain li > :first-child { flex: 1 1 auto; min-width: 0; }
.nx-list-plain li > .badge { flex: 0 0 auto; }
.min-w-0 { min-width: 0; }

/* ── Tarjetas y KPIs ────────────────────────────────────────────────── */
/* Bootstrap 5.3 toma el fondo de .card de --bs-body-bg (acá, el gris del lienzo): las tarjetas se fijan en blanco. */
.card { --bs-card-bg: #fff; background: #fff; border: 1px solid var(--nx-border); border-radius: var(--nx-radius); box-shadow: none; }
/* Misma trampa en el resto de los componentes de Bootstrap: el gris es solo del lienzo; modales, tablas, desplegables,
   paneles, popovers, listas y acordeones van blancos. */
.modal { --bs-modal-bg: #fff; }
.modal-content { background-color: #fff; }
.table { --bs-table-bg: #fff; }
.dropdown-menu { --bs-dropdown-bg: #fff; }
.offcanvas { --bs-offcanvas-bg: #fff; }
.popover { --bs-popover-bg: #fff; }
.list-group { --bs-list-group-bg: #fff; }
.accordion { --bs-accordion-bg: #fff; }
.toast { --bs-toast-bg: #fff; }
.card-body { padding: 18px 20px; }
.nx-kpis { --bs-gutter-y: 1rem; }
/* KPI: borde de 1 px del color del tono en los cuatro lados (sin franja gruesa), etiqueta del mismo color. */
.nx-kpi { background: #fff; border: 1px solid var(--nx-kpi-color, var(--nx-primary)); border-radius: var(--nx-radius); padding: 16px 18px; display: flex; justify-content: space-between; gap: .75rem; height: 100%; }
.nx-kpi__label { color: var(--nx-kpi-color, var(--nx-primary)); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
.nx-kpi__value { font-size: 24px; font-weight: 800; line-height: 1.2; }
.nx-kpi__sub { color: var(--nx-text-muted); font-size: 12px; }
.nx-kpi__icon { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--nx-kpi-color, var(--nx-primary)); background: color-mix(in srgb, var(--nx-kpi-color, var(--nx-primary)) 12%, #fff); }
.nx-kpi--blue { --nx-kpi-color: #3d5afe; }
.nx-kpi--green { --nx-kpi-color: #16a34a; }
.nx-kpi--orange { --nx-kpi-color: #f59e0b; }
.nx-kpi--red { --nx-kpi-color: #dc2626; }
.nx-kpi--indigo { --nx-kpi-color: #4f46e5; }
.nx-kpi--purple { --nx-kpi-color: #9333ea; }
.nx-kpi--teal { --nx-kpi-color: #0d9488; }

/* ── Filtros ────────────────────────────────────────────────────────── */
.nx-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; align-items: end; }
.nx-filter .form-label { font-size: 12px; color: var(--nx-text-muted); }
.nx-filter-actions { display: flex; gap: .5rem; }

/* ── Lista ──────────────────────────────────────────────────────────── */
.nx-list-toolbar, .nx-list-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }
.nx-list-toolbar { margin-bottom: .9rem; }
.nx-list-toolbar select { width: auto; min-width: 72px; }
.nx-list-footer { margin-top: .9rem; color: var(--nx-text-muted); }
.nx-table-wrap { overflow-x: auto; transition: opacity .15s; border: 1px solid var(--nx-border); border-radius: 8px; }
.nx-table-wrap .table > :last-child > tr:last-child > td { border-bottom: 0; }
.is-loading .nx-table-wrap { opacity: .45; pointer-events: none; }
.nx-table-wrap .table { margin: 0; vertical-align: middle; }
.nx-table-wrap thead th { background: #f7f7fd; color: var(--nx-text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; border-bottom-color: var(--nx-border); }
.nx-table-wrap tbody td { padding-top: .7rem; padding-bottom: .7rem; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: "\f0dc"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: .35rem; opacity: .35; }
th[data-sort].is-sorted[data-order="asc"]::after { content: "\f0de"; opacity: 1; color: var(--nx-primary); }
th[data-sort].is-sorted[data-order="desc"]::after { content: "\f0dd"; opacity: 1; color: var(--nx-primary); }
.nx-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2rem 1rem; color: var(--nx-text-muted); }
.nx-empty > i { font-size: 1.6rem; opacity: .6; }
.nx-row-actions { display: flex; justify-content: flex-end; gap: .35rem; }
.nx-row-actions .btn { width: 34px; min-height: 34px; padding: 0; }
.nx-card-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--nx-primary-subtle); color: var(--nx-primary); display: inline-flex; align-items: center; justify-content: center; margin-right: .7rem; flex: 0 0 34px; }

/* Paginación de 8 controles (components/Pagination.js) */
.nx-pagination { list-style: none; display: flex; gap: .3rem; margin: 0; padding: 0; }
.nx-pagination li > a, .nx-pagination li > span { min-width: 32px; height: 32px; padding: 0 .5rem; border-radius: 6px; border: 1px solid var(--nx-border); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--nx-text); }
.nx-pagination li > a:hover { border-color: var(--nx-primary); color: var(--nx-primary); }
.nx-pagination li.is-active > span { background: var(--nx-primary); border-color: var(--nx-primary); color: #fff; font-weight: 700; }
.nx-pagination li.is-disabled > span { opacity: .45; }
.nx-pagination .nx-ellipsis { border: 0; background: transparent; }

/* Badges por tono (Template: data-bind-tone) */
/* Badges de estado en tablas: sólidos, 11 px, peso 700, radio 4 px (teal activo, ámbar pendiente con texto oscuro,
   rojo error, celeste informativo, gris inactivo o categórico). */
.badge { font-size: 11px; font-weight: 700; padding: .38em .6em; border-radius: 4px; }
.nx-badge-success { background: #13a89e; color: #fff; }
.nx-badge-warning { background: #ec8f0a; color: #fff; }
.nx-badge-danger { background: #dc2626; color: #fff; }
.nx-badge-info { background: #0ea5e9; color: #fff; }
.nx-badge-muted { background: #6b7280; color: #fff; }

/* Detalle (core/Detail.js) y modales */
.nx-detail-table td:first-child { width: 38%; background: #f7f7fd; font-weight: 600; color: var(--nx-text-muted); }
.nx-detail-list { margin: 0; padding-left: 1.1rem; }
.modal-content { border-radius: 12px; border: 0; max-height: min(720px, 100vh - 3.5rem); }
.modal-dialog-scrollable { height: auto; }
.nx-modal__eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--nx-text-muted); font-weight: 700; }
.modal-title { font-size: 1.15rem; font-weight: 800; }
.nx-form-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.nx-confirm .modal-title i { color: var(--nx-warning); }

/* Avisos (NxUi.notify) */
.nx-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; }
.nx-toast { min-width: 260px; max-width: 380px; background: #fff; border: 1px solid var(--nx-border); border-left: 4px solid var(--nx-primary); border-radius: 8px; padding: .7rem .9rem; box-shadow: 0 8px 24px rgba(21, 26, 77, .12); }
.nx-toast--success { border-left-color: var(--nx-success); }
.nx-toast--warning { border-left-color: var(--nx-warning); }
.nx-toast--error { border-left-color: var(--nx-danger); }

/* ── Login ──────────────────────────────────────────────────────────── */
/*
 * Foto a la izquierda con velo índigo/violeta de la marca; tarjeta a la derecha (como el login de facturador).
 * Foto: public/assets/img/brand/login-bg.jpg — bocetos de páginas web en acuarela, de Unsplash
 * (https://images.unsplash.com/photo-1522542550221-31fd19575a2d). Licencia de Unsplash: uso comercial libre, sin
 * atribución obligatoria.
 */
.nx-login-body { background: #fff; }
.nx-login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) clamp(26rem, 36%, 33rem); }
.nx-login__brand {
    position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
    padding: 3rem 4.5rem 4rem; color: #fff; overflow: hidden;
    background:
        linear-gradient(180deg, rgba(21, 26, 77, 0) 35%, rgba(21, 26, 77, .92) 100%),
        linear-gradient(135deg, rgba(36, 52, 158, .9) 0%, rgba(61, 90, 254, .62) 55%, rgba(106, 61, 240, .55) 100%),
        url("/assets/img/brand/login-bg.jpg") center / cover no-repeat,
        var(--nx-navy);
}
.nx-login__badge {
    display: inline-flex; align-items: center; gap: .6rem; width: fit-content; padding: .45rem 1rem .45rem .8rem;
    border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(6px); font-size: 12px; font-weight: 600;
}
.nx-login__badge::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--nx-lilac-soft); box-shadow: 0 0 0 4px rgba(201, 195, 250, .3); }
.nx-login__pitch { max-width: 36rem; }
.nx-login__eyebrow { margin-bottom: .75rem; color: var(--nx-lilac-soft); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.nx-login__pitch h2 { margin: 0 0 1rem; font-size: clamp(1.9rem, 3vw, 2.7rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; color: #fff; }
.nx-login__pitch p { margin: 0; max-width: 30rem; font-size: 14.5px; line-height: 1.55; color: rgba(255, 255, 255, .86); }

.nx-login__main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem 2.5rem; background: linear-gradient(180deg, #fff 0%, #f7f6ff 100%); }
.nx-login__card { width: 100%; max-width: 25rem; }
.nx-login__logo { display: block; width: 210px; height: auto; margin: 0 auto 2.25rem; }
/* En px (no rem): el panel usa html { font-size: 13px } y en rem el título saldría más chico que en facturador. */
.nx-login__card h1 { margin: 0 0 5px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; color: var(--nx-navy-2); }
.nx-login__lead { margin: 0 0 24px; color: var(--nx-text-muted); font-size: 13.5px; }
.nx-login__card .form-floating > .form-control { height: 3.5rem; min-height: 3.5rem; border-radius: 10px; font-size: 14px; }
.nx-login__card .form-floating > label { color: var(--nx-text-muted); font-size: 13px; }
.nx-login__pass .form-control { padding-right: 3rem; }
.nx-login__pass [data-toggle-password] { position: absolute; top: 0; right: 0; z-index: 5; display: flex; width: 3rem; height: 3.5rem; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--nx-text-muted); }
.nx-login__pass [data-toggle-password]:hover { color: var(--nx-primary); }
.nx-login__submit { height: 3rem; border: 0; border-radius: 10px; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(90deg, var(--nx-navy-2) 0%, var(--nx-primary) 55%, var(--nx-accent) 100%); box-shadow: 0 10px 22px rgba(61, 90, 254, .28); }
.nx-login__submit:hover, .nx-login__submit:focus { color: #fff; filter: brightness(1.08); }
.nx-login__foot { margin-top: 1.75rem; padding-top: 1.1rem; border-top: 1px solid #e6e6f2; color: var(--nx-text-muted); font-size: 12px; text-align: center; }
.nx-login__copy { margin-top: .6rem; font-size: 11.5px; }

/* ── Contenido (fase 2b) ────────────────────────────────────────────── */
/* KPI con un texto en lugar de una cifra (p. ej. el tema): misma altura que las demás tarjetas. */
.nx-kpi__value--text { font-size: 16px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Miniaturas en filas de listado */
.nx-avatar-thumb { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: 0 0 34px; margin-right: .7rem; background: var(--nx-canvas); border: 1px solid var(--nx-border); }
.nx-slide-thumb { width: 56px; height: 36px; border-radius: 6px; overflow: hidden; flex: 0 0 56px; margin-right: .7rem; background: var(--nx-canvas); border: 1px solid var(--nx-border); }
.nx-avatar-thumb img, .nx-slide-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nx-cell-clamp { max-width: 380px; }
.nx-cell-clamp, .nx-cell-clamp > div { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
td.nx-cell-clamp { display: table-cell; }
tr.is-unread td { background: #f6f7ff; }
tr.is-unread .fw-semibold { font-weight: 800 !important; }
.nx-message-text { white-space: pre-wrap; line-height: 1.55; }

/* Opciones avanzadas plegables dentro de una tarjeta */
.nx-details > summary { cursor: pointer; font-weight: 700; color: var(--nx-primary); list-style: none; display: inline-flex; align-items: center; gap: .4rem; }
.nx-details > summary::-webkit-details-marker { display: none; }
.nx-details > summary::before { content: "\f054"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 10px; transition: transform .15s; }
.nx-details[open] > summary::before { transform: rotate(90deg); }

/* Campo de imagen (admin.partials.media-field) */
.nx-media-field { display: flex; gap: .75rem; align-items: flex-start; }
.nx-media-field__preview { width: 76px; height: 76px; flex: 0 0 76px; border-radius: 8px; border: 1px dashed var(--nx-border); background: var(--nx-canvas); color: var(--nx-text-muted); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font-size: 1.2rem; }
.nx-media-field__preview.has-image { border-style: solid; background: #fff; }
.nx-media-field__preview img { width: 100%; height: 100%; object-fit: cover; }
.nx-media-field__control { flex: 1 1 auto; min-width: 0; }
.nx-media-field__actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.nx-media-field__actions .btn-sm { min-height: 30px; font-size: 12px; }
/* Biblioteca de medios: cuadrícula de tarjetas (pantalla y selector) */
.nx-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.nx-media-grid__empty { grid-column: 1 / -1; border: 1px solid var(--nx-border); border-radius: 8px; }
.nx-media-card { display: flex; flex-direction: column; border: 1px solid var(--nx-border); border-radius: 8px; background: #fff; overflow: hidden; text-align: left; padding: 0; color: var(--nx-text); transition: border-color .15s, box-shadow .15s; }
.nx-media-card:hover { border-color: #b7c8dd; box-shadow: 0 4px 14px rgba(20, 33, 61, .06); }
.nx-media-card__thumb { aspect-ratio: 4 / 3; background: var(--nx-canvas); display: flex; align-items: center; justify-content: center; color: var(--nx-danger); font-size: 2rem; border-bottom: 1px solid var(--nx-border); overflow: hidden; }
.nx-media-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nx-media-card__body { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .7rem; min-width: 0; }
.nx-media-card__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-media-card__meta { font-size: 11.5px; color: var(--nx-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-media-card__actions { display: flex; gap: .35rem; padding: 0 .7rem .65rem; }
.nx-media-card__actions .btn { width: 34px; min-height: 34px; padding: 0; }
.nx-media-card--pick { cursor: pointer; }
.nx-media-card--pick.is-selected { border-color: var(--nx-primary); box-shadow: 0 0 0 3px rgba(61, 90, 254, .2); }
.nx-media-grid--picker { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.nx-picker-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.nx-picker-search { max-width: 340px; }
.nx-modal--stacked { z-index: 1360; }
.nx-backdrop--stacked { z-index: 1355; }
.nx-dropzone-hint { border: 1px dashed var(--nx-border); border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; color: var(--nx-text-muted); font-size: 12.5px; background: var(--nx-canvas); }
[data-dropzone].is-dragging { outline: 2px dashed var(--nx-primary); outline-offset: -6px; }
[data-dropzone].is-dragging .nx-dropzone-hint { border-color: var(--nx-primary); color: var(--nx-primary); background: var(--nx-primary-subtle); }

/* Menús: lista de menús de la columna izquierda */
.nx-menu-list { display: grid; gap: .5rem; }
.nx-menu-list__item { display: flex; align-items: center; gap: .25rem; width: 100%; padding: .6rem .7rem; border: 1px solid var(--nx-border); border-radius: 8px; background: #fff; color: var(--nx-text); }
.nx-menu-list__item:hover { border-color: #b7c8dd; }
.nx-menu-list__item.is-active { border-color: var(--nx-primary); background: var(--nx-primary-subtle); }
.nx-card-head .btn-sm { white-space: nowrap; }

/* ── Alertas: las clásicas de Bootstrap con fondo tintado, borde de 1 px, ícono solo y texto del tono ── */
.alert {
    --nx-alert-accent: var(--nx-primary);
    --nx-alert-bg: #eef0ff;
    --nx-alert-border: #d6dbff;
    --nx-alert-text: #26267a;
    background: var(--nx-alert-bg);
    border: 1px solid var(--nx-alert-border);
    border-radius: 10px;
    color: var(--nx-alert-text);
    padding: .8rem 1rem;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(20, 33, 61, .04);
}
.alert-info { --nx-alert-accent: #3d5afe; --nx-alert-bg: #eef0ff; --nx-alert-border: #d6dbff; --nx-alert-text: #26267a; }
.alert-success { --nx-alert-accent: #16a34a; --nx-alert-bg: #effbf4; --nx-alert-border: #c6efd6; --nx-alert-text: #14532d; }
.alert-warning { --nx-alert-accent: #f59e0b; --nx-alert-bg: #fffaeb; --nx-alert-border: #fbe5b2; --nx-alert-text: #7a4a06; }
.alert-danger { --nx-alert-accent: #dc2626; --nx-alert-bg: #fff3f3; --nx-alert-border: #fbd3d3; --nx-alert-text: #7f1d1d; }
.alert.d-flex { align-items: center !important; gap: .75rem !important; }
/* Ícono solo, del color de la alerta (sin pastilla ni anillo). */
.alert > .fa-solid:first-child, .alert > .fa-regular:first-child {
    flex: 0 0 auto; margin: 0 !important; font-size: 15px; line-height: 1; color: var(--nx-alert-accent);
}
.alert strong { color: inherit; font-weight: 800; }
.alert a { color: var(--nx-alert-accent); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.alert a:hover { color: var(--nx-alert-text); }
.alert code { background: rgba(255, 255, 255, .75); color: var(--nx-alert-text); padding: .05rem .35rem; border-radius: 4px; }

/* ── Grilla de permisos de un rol (módulo × Todo · Ver · Gestionar) ───── */
.nx-perm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
/* Un solo scroll (el del modal): el encabezado de la grilla queda pegado arriba mientras se baja. */
.nx-perm-wrap { overflow: visible; }
.nx-perm-grid thead th:first-child { border-top-left-radius: 8px; }
.nx-perm-grid thead th:last-child { border-top-right-radius: 8px; }
.nx-perm-module { color: var(--nx-text); }
.nx-perm-grid { --bs-table-bg: #fff; font-size: 13px; }
.nx-perm-grid thead th { position: sticky; top: -16px; z-index: 1; background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--nx-text-muted); font-weight: 700; padding: .6rem .9rem; border-bottom: 1px solid var(--nx-border); white-space: nowrap; }
.nx-perm-grid thead th:not(:first-child), .nx-perm-grid td:not(:first-child) { width: 104px; border-left: 1px solid #eef2f7; }
.nx-perm-grid td { padding: .5rem .9rem; vertical-align: middle; border-bottom: 1px solid #eef2f7; }
.nx-perm-grid tbody tr:not(.nx-perm-section):hover td { background: #fafaff; }
.nx-perm-grid .nx-perm-section td { background: var(--nx-canvas); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--nx-text); padding: .45rem .9rem; border-left: 0; }
.nx-perm-grid .form-check-input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; }
.nx-perm-grid .form-check-input:disabled { cursor: not-allowed; opacity: .45; }
.nx-perm-grid .form-check-input[data-locked] { background-color: #f1f4f9; }
.nx-perm-col { display: inline-flex; align-items: center; gap: .4rem; margin: 0; cursor: pointer; }

/* ── Dashboard con gráficos ─────────────────────────────────────────── */
.nx-dashboard-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.nx-dashboard-bar__meta { display: flex; align-items: center; gap: .75rem; }
[data-dashboard] [data-kpis] { margin-bottom: 1rem; }
.nx-charts { margin-bottom: 1rem; }
.nx-chart-card .nx-card-head { border-bottom-style: dashed; }
.nx-chart { position: relative; height: 270px; }
.nx-chart.is-empty canvas { visibility: hidden; }
.nx-chart__empty { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; padding: 0 1.5rem; color: var(--nx-text-muted); }
.nx-chart.is-empty .nx-chart__empty { display: flex; }
.nx-kpi__change { font-weight: 700; }
.nx-kpi__change.is-up { color: var(--nx-success); }
.nx-kpi__change.is-down { color: var(--nx-danger); }
.nx-kpi.is-placeholder { opacity: .45; }
[data-pane].is-loading .nx-kpis, [data-pane].is-loading .nx-charts { opacity: .55; transition: opacity .15s; }
.nx-mini-table { --bs-table-bg: #fff; }
.nx-mini-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--nx-text-muted); font-weight: 700; padding: .6rem 1rem; background: #f8fafc; }
.nx-mini-table td { padding: .55rem 1rem; vertical-align: middle; }
.nx-mini-table tbody tr:last-child td { border-bottom: 0; }
.nx-cell-truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Responsivo ─────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    /* Cabecera de celular: ☰ + buscador + avatar. */
    .nx-header { gap: .5rem; }
    .nx-search .form-control { font-size: 12.5px; }
}
@media (max-width: 991.98px) {
    /* Sidebar oculto a la izquierda (mismo diseño que en escritorio): lo abre el botón de la cabecera. */
    .nx-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; height: auto; z-index: 1045;
        width: min(var(--nx-sidebar-w), 86vw); flex: none;
        transform: translateX(-100%); transition: transform .22s ease; box-shadow: none;
    }
    .nx-sidebar.is-open { transform: none; box-shadow: 12px 0 32px rgba(21, 26, 77, .25); }
    .nx-sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1040; background: rgba(10, 23, 51, .45); opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s; }
    .nx-sidebar-backdrop.is-open { opacity: 1; visibility: visible; }
    body.nx-sidebar-open { overflow: hidden; }
    /* Encabezados de tarjeta con botones (Menús): los botones bajan a su propio renglón. */
    .nx-card-head { flex-wrap: wrap; }
    .nx-card-head > .d-flex:last-child { flex-wrap: wrap; }
    .nx-header__context { gap: .6rem; }
    .nx-search__kbd { display: none; }
    .nx-search .form-control { border-right: 1px solid var(--bs-border-color); border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0 !important; }
    .nx-content { padding: 16px; }
    /* Login en pantallas chicas: solo la tarjeta (la foto se oculta). */
    .nx-login { grid-template-columns: 1fr; }
    .nx-login__brand { display: none; }
    .nx-login__main { justify-content: flex-start; padding-top: 3rem; }
    .nx-hero { flex-wrap: wrap; }
    .nx-hero__actions { width: 100%; }
    .nx-user-menu__name { display: none; }
    .nx-header { padding: 0 1rem; position: sticky; top: 0; z-index: 1030; }
}
