/* =========================================================================
   MAVEV · Sistema de diseño (estilo ejecutivo, colores planos)
   Bootstrap 5.3 + tokens propios. Tema claro/oscuro con [data-bs-theme].
   Tipografía: Quicksand (redondeada y limpia; variable 300–700, servida localmente, licencia OFL).
   Para volver a Nunito: cambiar la familia y las rutas de los @font-face a ../lib/nunito/ (sigue en el proyecto).
   ========================================================================= */

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

/* ---------- Escala de la interfaz ----------
   En escritorio la interfaz se muestra al 90 % (equivale a un "Ctrl -" del navegador).
   Las alturas de pantalla usan calc(100vh / var(--ui-zoom)) para seguir ocupando todo el alto. */
:root { --ui-zoom: 1; }
@media (min-width: 992px) {
    :root { --ui-zoom: .9; }
    html { zoom: var(--ui-zoom); }
    /* Los fondos de modal/panel usan 100vw/100vh: se compensan para cubrir toda la pantalla */
    .modal-backdrop, .offcanvas-backdrop { width: calc(100vw / var(--ui-zoom)); height: calc(100vh / var(--ui-zoom)); }
}

/* ---------- Tokens ---------- */
:root,
[data-bs-theme="light"] {
    --app-bg: #f3f5f8;
    --app-surface: #ffffff;
    --app-surface-2: #f8f9fb;
    --app-surface-3: #eef1f5;
    --app-border: #e1e6ed;
    --app-border-strong: #cfd6e0;
    --app-text: #1d2939;
    --app-text-2: #344054;
    --app-muted: #667085;

    /* Azul marino corporativo */
    --app-primary: #1f3b64;
    --app-primary-rgb: 31, 59, 100;
    --app-primary-hover: #182f50;
    --app-primary-active: #13253f;
    --app-primary-soft: #e8eef6;
    --app-primary-soft-2: #d3deec;
    --app-accent: #2f6fb3;

    --app-success: #2b7a58; --app-success-soft: #e7f3ed;
    --app-warning: #a86a12; --app-warning-soft: #fbf1e1;
    --app-danger: #b42318;  --app-danger-soft: #fdeceb;
    --app-info: #2f6fb3;    --app-info-soft: #e8f0f9;
    --app-neutral: #5d6b82; --app-neutral-soft: #eef1f5;

    --sidebar-bg: #15223a;
    --sidebar-text: #b4bfd1;
    --sidebar-text-strong: #ffffff;
    --sidebar-muted: #7d8aa3;
    --sidebar-hover: #1c2c49;
    --sidebar-active: #243a5f;
    --sidebar-border: #22314d;
    --sidebar-marker: #6f9fd8;

    --shadow-xs: 0 1px 1px rgba(16, 24, 40, .04);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-md: 0 6px 16px rgba(16, 24, 40, .08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);

    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 12px;
    --sidebar-w: 272px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 64px;
    --ease: cubic-bezier(.2, .8, .2, 1);

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-body-font-family: "Quicksand", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --bs-body-font-size: .92rem;
    --bs-body-font-weight: 500;
    --bs-border-color: var(--app-border);
    --bs-secondary-color: var(--app-muted);
    --bs-primary: #1f3b64;
    --bs-primary-rgb: 31, 59, 100;
    --bs-link-color: #2f6fb3;
    --bs-link-color-rgb: 47, 111, 179;
    --bs-link-hover-color: #1f3b64;
    --bs-border-radius: 8px;
    --bs-border-radius-lg: 10px;
    --bs-focus-ring-color: rgba(47, 111, 179, .25);
}

[data-bs-theme="dark"] {
    --app-bg: #0e1522;
    --app-surface: #151f31;
    --app-surface-2: #121b2b;
    --app-surface-3: #1c283d;
    --app-border: #253349;
    --app-border-strong: #31415c;
    --app-text: #e6ebf2;
    --app-text-2: #c5cedb;
    --app-muted: #8c99ae;

    --app-primary: #6f9fd8;
    --app-primary-rgb: 111, 159, 216;
    --app-primary-hover: #86b0e0;
    --app-primary-active: #5b8bc6;
    --app-primary-soft: #1b2b45;
    --app-primary-soft-2: #243a5c;
    --app-accent: #86b0e0;

    --app-success: #5fbf92; --app-success-soft: #173026;
    --app-warning: #e0a94e; --app-warning-soft: #33280f;
    --app-danger: #f08a80;  --app-danger-soft: #3a1b1a;
    --app-info: #86b0e0;    --app-info-soft: #1b2b45;
    --app-neutral: #9aa6b8; --app-neutral-soft: #1f2a3c;

    --sidebar-bg: #0b1220;
    --sidebar-hover: #131e33;
    --sidebar-active: #1b2b45;
    --sidebar-border: #182338;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-border-color: var(--app-border);
    --bs-tertiary-bg: var(--app-surface-3);
    --bs-secondary-bg: var(--app-surface-2);
    --bs-link-color: #86b0e0;
    --bs-link-color-rgb: 134, 176, 224;
    --bs-link-hover-color: #a9c7ea;
    --bs-primary: #3f6ea8;
    --bs-primary-rgb: 63, 110, 168;
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h5 { font-weight: 800; letter-spacing: -.01em; }
strong, b { font-weight: 800; }
::selection { background: var(--app-primary-soft-2); }
.min-w-0 { min-width: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--app-primary); color: #fff; padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { left: 8px; }
*:focus-visible { outline: 2px solid rgba(var(--app-primary-rgb), .55); outline-offset: 2px; }
.text-muted { color: var(--app-muted) !important; }

* { scrollbar-width: thin; scrollbar-color: #b9c2cf transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #b9c2cf; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: #98a3b3; }
[data-bs-theme="dark"] * { scrollbar-color: #3a4a64 transparent; }

[data-bs-theme="light"] .theme-icon-light,
[data-bs-theme="dark"] .theme-icon-dark { display: none; }

/* ---------- Botones ---------- */
.btn { font-weight: 700; border-radius: 8px; transition: background-color .15s, border-color .15s, color .15s; }
.btn-primary {
    --bs-btn-bg: var(--app-primary); --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-hover); --bs-btn-hover-border-color: var(--app-primary-hover);
    --bs-btn-active-bg: var(--app-primary-active); --bs-btn-active-border-color: var(--app-primary-active);
    --bs-btn-disabled-bg: var(--app-primary); --bs-btn-disabled-border-color: var(--app-primary);
    --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff;
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0e1522; --bs-btn-hover-color: #0e1522; --bs-btn-active-color: #0e1522; }
.btn-soft { background: var(--app-surface); border: 1px solid var(--app-border-strong); color: var(--app-text-2); }
.btn-soft:hover, .btn-soft:focus-visible, .btn-soft.show { background: var(--app-primary-soft); border-color: var(--app-primary-soft-2); color: var(--app-primary); }
.icon-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px;
    border: 1px solid var(--app-border-strong); background: var(--app-surface); color: var(--app-text-2);
    transition: background-color .15s, color .15s, border-color .15s; font-size: 1.02rem; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--app-primary-soft); color: var(--app-primary); border-color: var(--app-primary-soft-2); }
.icon-btn-dark { background: transparent; border-color: var(--sidebar-border); color: var(--sidebar-text); }
.icon-btn-dark:hover { background: var(--sidebar-hover); color: #fff; }

/* ---------- Formularios ---------- */
.form-control, .form-select { border-radius: 8px; border-color: var(--app-border-strong); background-color: var(--app-surface); padding: .52rem .8rem; font-weight: 500; }
.form-select { padding-right: 2.25rem; } /* espacio para la flecha del desplegable */
.form-control:focus, .form-select:focus { border-color: var(--app-accent); box-shadow: 0 0 0 3px rgba(47, 111, 179, .15); }
.form-label { font-size: .78rem; font-weight: 700; color: var(--app-text-2); margin-bottom: .3rem; }
.form-check-input:checked { background-color: var(--app-primary); border-color: var(--app-primary); }
.form-check-input:indeterminate { background-color: var(--app-primary); border-color: var(--app-primary); }

/* =========================================================================
   Layout
   ========================================================================= */
.app-shell { display: flex; min-height: calc(100vh / var(--ui-zoom)); }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    display: flex; flex-direction: column;
    background: var(--sidebar-bg); color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-border);
    transition: width .25s var(--ease), transform .25s var(--ease);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; }
.brand-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; min-width: 0; }
.brand-logo { width: 36px; height: 36px; flex: 0 0 auto; object-fit: contain; }
.brand-full { height: 42px; width: auto; max-width: 100%; flex: 0 1 auto; object-fit: contain; }
.sidebar .brand-full { height: 44px; }
.brand-collapsed { display: none; }
/* Logo según el tema (fondo claro: colores originales; fondo oscuro: textos en blanco) */
.logo-for-dark { display: none !important; }
[data-bs-theme="dark"] .logo-for-light { display: none !important; }
[data-bs-theme="dark"] .logo-for-dark { display: inline-block !important; }
.topbar-logo { display: inline-flex; align-items: center; margin-right: 4px; }
.topbar-logo .brand-logo { width: 30px; height: 30px; }
.status-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.status-logo .brand-full { height: 48px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text strong { font-size: 1.1rem; letter-spacing: .08em; font-weight: 900; }
.brand-text small { color: var(--sidebar-muted); font-size: .72rem; font-weight: 600; }

.sidebar-search { position: relative; margin: 4px 16px 8px; }
.sidebar-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--sidebar-muted); font-size: .85rem; }
.sidebar-search input {
    width: 100%; background: #1a2944; border: 1px solid var(--sidebar-border); color: #fff;
    border-radius: 8px; padding: .48rem .75rem .48rem 2.1rem; font-size: .83rem; outline: none; font-weight: 600;
}
[data-bs-theme="dark"] .sidebar-search input { background: #121c30; }
.sidebar-search input::placeholder { color: var(--sidebar-muted); }
.sidebar-search input:focus { border-color: var(--sidebar-marker); }

.sidebar-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 16px; }
.nav-caption { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--sidebar-muted); padding: 14px 12px 6px; font-weight: 800; white-space: nowrap; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-sub { margin: 2px 0 4px 18px; padding-left: 10px; border-left: 1px solid var(--sidebar-border); }
.sidebar .nav-link {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 1px 0; border-radius: 8px;
    color: var(--sidebar-text); font-size: .86rem; font-weight: 600; text-decoration: none; position: relative;
    transition: background-color .15s, color .15s;
}
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .nav-link.active { color: #fff; background: var(--sidebar-active); }
.sidebar .nav-link.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sidebar-marker); }
.sidebar .nav-link.active-parent { color: #fff; }
.nav-icon { font-size: 1rem; width: 22px; text-align: center; flex: 0 0 auto; }
.nav-sub .nav-icon { font-size: .88rem; }
.nav-text { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-chevron { font-size: .7rem; transition: transform .2s var(--ease); opacity: .6; }
.nav-toggle:not(.collapsed) .nav-chevron { transform: rotate(90deg); }
.nav-badge { font-size: .68rem; font-weight: 800; background: #2a4168; color: #d6e3f5; border-radius: 99px; padding: 0 7px; }
.nav-pill { font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--sidebar-muted); border: 1px solid var(--sidebar-border); border-radius: 99px; padding: 0 6px; }
.nav-pill-new { color: #9fd5b9; border-color: #2e5a47; background: #183529; }
.sidebar .nav-link.is-pending { color: #7f8ba2; }
.sidebar .nav-link.is-pending:hover { color: #bcc6d8; }
.nav-empty { color: var(--sidebar-muted); font-size: .82rem; padding: 16px 12px; }
.nav-hidden { display: none !important; }

.sidebar-footer { padding: 12px 16px 16px; border-top: 1px solid var(--sidebar-border); }
.migration-card { background: #1a2944; border: 1px solid var(--sidebar-border); border-radius: 8px; padding: 10px 12px; font-size: .76rem; color: var(--sidebar-text); font-weight: 600; }
[data-bs-theme="dark"] .migration-card { background: #121c30; }
.migration-card strong { color: #fff; }
.migration-card .progress { height: 5px; background: #0f1a2e; border-radius: 99px; }
.migration-card .progress-bar { background: var(--sidebar-marker); border-radius: 99px; }

.sidebar-backdrop { display: none; }

@media (min-width: 992px) {
    .sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
    .sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
    .sidebar-collapsed .sidebar .brand-full { display: none; }
    .sidebar-collapsed .brand-collapsed { display: inline-flex; }
    .sidebar-collapsed .brand-text,
    .sidebar-collapsed .sidebar-search,
    .sidebar-collapsed .nav-caption,
    .sidebar-collapsed .nav-text,
    .sidebar-collapsed .nav-badge,
    .sidebar-collapsed .nav-pill,
    .sidebar-collapsed .nav-chevron,
    .sidebar-collapsed .sidebar-footer,
    .sidebar-collapsed .nav-sub { display: none !important; }
    .sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 10px; }
    .sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 10px; }
    .sidebar-collapsed .sidebar .collapse { display: none !important; }
}

/* ---------- Main ---------- */
.app-main { flex: 1 1 auto; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: calc(100vh / var(--ui-zoom)); transition: margin-left .25s var(--ease); }
.topbar {
    position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px; padding: 0 28px;
    background: var(--app-surface); border-bottom: 1px solid var(--app-border);
}
.topbar-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.topbar-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--app-muted); font-weight: 800; }
.topbar-heading { font-size: 1.06rem; font-weight: 800; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.quick-search { align-items: center; gap: 8px; background: var(--app-surface-2); border: 1px solid var(--app-border-strong); border-radius: 8px; padding: 0 10px 0 12px; height: 38px; width: 320px; }
.quick-search:focus-within { border-color: var(--app-accent); background: var(--app-surface); }
.quick-search i { color: var(--app-muted); }
.quick-search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: .86rem; color: var(--app-text); min-width: 0; font-weight: 600; }
.quick-search kbd { background: var(--app-surface); color: var(--app-muted); border: 1px solid var(--app-border-strong); font-size: .7rem; padding: 1px 6px; border-radius: 5px; box-shadow: none; font-family: inherit; }

.user-chip { display: flex; align-items: center; gap: 10px; background: var(--app-surface); border: 1px solid var(--app-border-strong); border-radius: 8px; padding: 3px 10px 3px 3px; color: var(--app-text); }
.user-chip:hover { background: var(--app-surface-2); }
.user-chip-text { flex-direction: column; align-items: flex-start; line-height: 1.15; max-width: 180px; }
.user-chip-text strong { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.user-chip-text small { font-size: .7rem; color: var(--app-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-weight: 600; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: var(--app-primary); color: #fff; font-weight: 800; font-size: .78rem; flex: 0 0 auto; }
[data-bs-theme="dark"] .avatar { color: #0e1522; }
.avatar-lg { width: 44px; height: 44px; border-radius: 10px; font-size: .95rem; }
.user-menu { min-width: 290px; padding: 8px; border-radius: 10px; }
.user-menu-head { display: flex; gap: 12px; align-items: center; padding: 8px 8px 12px; }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--app-primary); border-color: var(--app-border); background: var(--app-surface); border-radius: 10px; box-shadow: var(--shadow-md); }
.dropdown-item { border-radius: 6px; padding: .5rem .75rem; font-weight: 600; }
.dropdown-item:hover { background: var(--app-primary-soft); }
.badge { font-weight: 700; }

/* "backwards": al terminar no queda transform aplicado (un transform crea contexto de apilamiento). */
.app-content { flex: 1 1 auto; padding: 24px 28px 32px; outline: none; animation: fade-in .3s ease backwards; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 28px 20px; font-size: .76rem; color: var(--app-muted); font-weight: 600; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .5); }
    .app-main { margin-left: 0; }
    .topbar { padding: 0 16px; }
    .app-content { padding: 18px 16px 28px; }
    .app-footer { padding: 14px 16px 20px; flex-direction: column; }
}

/* =========================================================================
   Componentes
   ========================================================================= */
.app-card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.app-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; background: transparent; border-bottom: 1px solid var(--app-border); padding: 16px 20px 12px; }
.app-card .card-body { padding: 18px 20px 20px; }
.app-card-title { font-size: .98rem; font-weight: 800; margin: 0; }
.app-card-subtitle { font-size: .8rem; color: var(--app-muted); margin: 2px 0 0; font-weight: 600; }

/* ---------- Bienvenida ---------- */
.welcome { max-width: 1080px; }
.welcome-head { display: flex; align-items: center; gap: 18px; background: var(--app-surface); border: 1px solid var(--app-border); border-left: 4px solid var(--app-primary); border-radius: var(--radius-lg); padding: 24px 26px; margin-bottom: 20px; }
.welcome-mark { width: 56px; height: 56px; flex: 0 0 auto; }
.welcome-date { font-size: .82rem; color: var(--app-muted); font-weight: 700; margin-bottom: 2px; }
.welcome-title { font-size: 1.55rem; font-weight: 900; margin: 0; color: var(--app-text); }
.welcome-text { color: var(--app-text-2); margin: 6px 0 0; font-weight: 600; }
.welcome-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--app-text-2); background: var(--app-surface-3); border-radius: 6px; padding: 4px 10px; }
.meta-item i { color: var(--app-primary); }
.section-title { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: var(--app-muted); margin: 6px 0 10px; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.quick-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--app-border); background: var(--app-surface); color: var(--app-text); text-decoration: none; transition: border-color .15s, background-color .15s; }
.quick-tile:hover { border-color: var(--app-primary-soft-2); background: var(--app-primary-soft); color: var(--app-text); }
.quick-tile strong { display: block; font-size: .9rem; }
.quick-tile small { color: var(--app-muted); font-size: .76rem; font-weight: 600; }
.quick-icon { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 1.1rem; flex: 0 0 auto; background: var(--app-primary-soft); color: var(--app-primary); }
.quick-arrow { margin-left: auto; font-size: 1.3rem; color: var(--app-primary); }
.help-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.help-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--app-text-2); font-weight: 600; }
.help-list i { color: var(--app-primary); margin-top: 2px; }
.help-list kbd { background: var(--app-surface-3); color: var(--app-text); border: 1px solid var(--app-border-strong); font-size: .72rem; padding: 0 6px; border-radius: 4px; box-shadow: none; font-family: inherit; }

/* ---------- Encabezado de página ---------- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; flex-wrap: wrap; }
.page-header-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-icon { width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; background: var(--app-primary); flex: 0 0 auto; }
[data-bs-theme="dark"] .page-icon { color: #0e1522; }
.page-title { font-size: 1.38rem; font-weight: 900; margin: 0; }
.page-subtitle { color: var(--app-muted); margin: 2px 0 0; font-size: .86rem; font-weight: 600; }
.page-header-stats { display: flex; gap: 10px; }
.mini-stat { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--radius); padding: 7px 16px; display: flex; flex-direction: column; min-width: 110px; }
.mini-stat span { font-size: .68rem; color: var(--app-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.mini-stat strong { font-size: 1.18rem; font-weight: 900; font-variant-numeric: tabular-nums; }

/* ---------- Grilla ---------- */
.grid-card { overflow: hidden; }
.grid-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--app-border); flex-wrap: wrap; }
.grid-search { position: relative; flex: 1 1 320px; min-width: 220px; }
.grid-search > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--app-muted); }
.grid-search .form-control { padding-left: 2.3rem; padding-right: 2.3rem; height: 40px; background: var(--app-surface-2); }
.grid-search-spinner { position: absolute; right: 13px; top: 12px; }
.grid-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-actions .btn { height: 40px; display: inline-flex; align-items: center; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--app-border); background: var(--app-surface-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--app-primary-soft); color: var(--app-primary); border: 1px solid var(--app-primary-soft-2); border-radius: 6px; padding: 2px 4px 2px 10px; font-size: .78rem; font-weight: 700; max-width: 100%; }
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.chip button { border: 0; background: transparent; color: inherit; width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; line-height: 1; opacity: .75; }
.chip button:hover { background: var(--app-primary-soft-2); opacity: 1; }
.chip-clear { background: transparent; border-style: dashed; border-color: var(--app-border-strong); color: var(--app-muted); padding-right: 10px; cursor: pointer; }

/*
  Contenedor con desplazamiento de la tabla. La integración Bootstrap 5 de DataTables envuelve la
  tabla en ".dt-layout-table > div" (clases de Bootstrap), no en ".dt-layout-cell": se apunta a ese div.
*/
.grid-wrap { position: relative; }
.grid-wrap .dt-container { padding: 0; }
.grid-wrap .dt-container > .row { margin: 0 !important; --bs-gutter-x: 0; }
.grid-wrap .dt-layout-table { margin: 0 !important; }
.grid-wrap .dt-layout-table > div {
    overflow: auto; max-height: calc(100vh / var(--ui-zoom) - 300px); min-height: 280px; padding: 0 !important;
}
.grid-wrap .dt-container > .row:not(.dt-layout-table) { padding: 10px 16px; border-top: 1px solid var(--app-border); align-items: center; }
.grid-wrap .dt-container > .row:not(.dt-layout-table) > div { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 0; }
.grid-wrap .dt-container > .row:not(.dt-layout-table) > div:last-child { justify-content: flex-end; }
.grid-wrap .dt-info { color: var(--app-muted); font-size: .8rem; padding: 0 !important; font-weight: 600; }
.grid-wrap .dt-length { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--app-muted); font-weight: 600; }
.grid-wrap .dt-length select { border-radius: 6px; padding: .22rem 1.8rem .22rem .6rem; font-size: .8rem; }
.grid-wrap .dt-paging .pagination { margin: 0; gap: 4px; }
.grid-wrap .dt-paging .page-link { border-radius: 6px !important; border: 1px solid var(--app-border-strong); background: var(--app-surface); color: var(--app-text-2); font-size: .8rem; min-width: 34px; text-align: center; font-weight: 700; }
.grid-wrap .dt-paging .page-item.active .page-link { background: var(--app-primary); color: #fff; border-color: var(--app-primary); }
[data-bs-theme="dark"] .grid-wrap .dt-paging .page-item.active .page-link { color: #0e1522; }
.grid-wrap .dt-paging .page-item.disabled .page-link { opacity: .5; }
.grid-scroll-hint { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--app-muted); font-weight: 700; }

table.app-table { margin: 0 !important; border-collapse: separate !important; border-spacing: 0; font-size: .84rem; width: max-content !important; min-width: 100%; }
table.app-table > thead > tr > th {
    position: sticky; top: 0; z-index: 2; background: var(--app-surface-3) !important; color: var(--app-text-2);
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; white-space: nowrap;
    border-bottom: 1px solid var(--app-border-strong) !important; padding: 11px 14px !important;
}
table.app-table > tbody > tr > td { padding: 10px 14px; border-bottom: 1px solid var(--app-border); color: var(--app-text-2); white-space: nowrap; vertical-align: middle; background: var(--app-surface); font-weight: 600; }
table.app-table > tbody > tr { cursor: pointer; }
table.app-table > tbody > tr:nth-child(even) > td { background: var(--app-surface-2); }
table.app-table > tbody > tr:hover > td { background: var(--app-primary-soft) !important; }
table.app-table.table-hover > tbody > tr:hover > * { --bs-table-bg-state: transparent; }
table.app-table > tbody > tr:last-child > td { border-bottom: 0; }
/* Columna "Nro." fija al desplazarse horizontalmente */
table.app-table > thead > tr > th:first-child { left: 0; z-index: 3; box-shadow: inset -1px 0 0 var(--app-border-strong); }
table.app-table > tbody > tr > td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--app-border-strong); }
.density-compact table.app-table > tbody > tr > td { padding-top: 5px; padding-bottom: 5px; }
/* Selección múltiple (columna de casillas; p.ej. Vencimientos de Póliza) */
table.app-table th.cell-select, table.app-table td.cell-select { width: 2.25rem; padding-left: 12px !important; padding-right: 8px !important; text-align: center; cursor: default; }
table.app-table .cell-select .form-check-input { margin: 0; cursor: pointer; }
table.app-table > tbody > tr.is-selected > td { background: var(--app-primary-soft) !important; }
table.app-table th.dt-ordering-asc, table.app-table th.dt-ordering-desc { color: var(--app-primary) !important; }
/* Filtro desde la cabecera (embudo, como Excel): aparece al pasar el mouse; fijo si la columna tiene filtro */
table.app-table th .th-filter {
    display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 6px; padding: 0;
    border: 0; border-radius: 5px; background: transparent; color: var(--app-muted); font-size: .8rem; vertical-align: middle;
    opacity: 0; cursor: pointer; transition: opacity .12s;
}
table.app-table th:hover .th-filter, table.app-table th .th-filter:focus-visible, table.app-table th .th-filter.is-active { opacity: 1; }
table.app-table th .th-filter:hover { background: var(--app-primary-soft); color: var(--app-primary); }
table.app-table th .th-filter.is-active { color: var(--app-primary); background: var(--app-primary-soft); }
.col-filter {
    position: absolute; z-index: 1060; width: 300px; max-width: calc(100vw - 16px); padding: 12px; display: flex; flex-direction: column; gap: 8px;
    background: var(--app-surface); border: 1px solid var(--app-border-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
    font-size: .84rem; color: var(--app-text-2);
}
.col-filter .cf-title { font-weight: 800; color: var(--app-text); }
.col-filter .cf-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--app-border); border-radius: 8px; padding: 4px 0; }
.col-filter .cf-item { display: flex; align-items: center; gap: 8px; padding: 4px 10px; margin: 0; cursor: pointer; font-weight: 600; }
.col-filter .cf-item:hover { background: var(--app-primary-soft); }
.col-filter .cf-item .form-check-input { margin: 0; flex: none; }
.col-filter .cf-all { padding-left: 11px; }
.col-filter .cf-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-filter .cf-count { color: var(--app-muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.col-filter .cf-loading, .col-filter .cf-empty { padding: 10px; color: var(--app-muted); }
.col-filter .cf-note { font-size: .76rem; color: var(--app-muted); }
.col-filter .cf-foot { display: flex; align-items: center; gap: 6px; }
.col-filter .cf-shortcuts { display: flex; flex-wrap: wrap; gap: 4px; }
.col-filter .cf-calendar .flatpickr-calendar { box-shadow: none; border: 1px solid var(--app-border); margin: 0 auto; }
.col-filter:has(.cf-calendar) { width: 340px; }
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order::before,
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order::after,
table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order::before,
table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order::after { font-size: .6em; }
div.dt-processing { display: none !important; }
.grid-wrap.is-loading::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 5; background: var(--app-accent); animation: loading-bar 1s ease-in-out infinite alternate; transform-origin: left; }
.grid-wrap.is-loading tbody { opacity: .55; }
@keyframes loading-bar { from { transform: scaleX(.1); } to { transform: scaleX(1); } }

.cell-id { font-weight: 800; color: var(--app-text); font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 700; color: var(--app-text); max-width: 280px; }
.cell-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.cell-long { max-width: 340px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; font-size: .81rem; }
.cell-sub { display: block; font-size: .72rem; color: var(--app-muted); font-weight: 600; }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-muted { color: var(--app-muted); }
.plate { display: inline-block; font-weight: 800; font-size: .76rem; letter-spacing: .06em; padding: 1px 7px; border-radius: 4px; background: var(--app-surface-3); border: 1px solid var(--app-border-strong); color: var(--app-text); }

/* Estados (colores planos) */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 800; border-radius: 5px; padding: 2px 9px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-warning { background: var(--app-warning-soft); color: var(--app-warning); }
.pill-success { background: var(--app-success-soft); color: var(--app-success); }
.pill-danger { background: var(--app-danger-soft); color: var(--app-danger); }
.pill-info { background: var(--app-info-soft); color: var(--app-info); }
.pill-neutral { background: var(--app-neutral-soft); color: var(--app-neutral); }
.pill-primary { background: var(--app-primary-soft); color: var(--app-primary); }
.tag { display: inline-block; font-size: .74rem; font-weight: 700; border-radius: 5px; padding: 1px 8px; background: var(--app-surface-3); color: var(--app-text-2); border: 1px solid var(--app-border); max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.days { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: .78rem; padding: 1px 8px; border-radius: 5px; }
.days-ok { background: var(--app-success-soft); color: var(--app-success); }
.days-mid { background: var(--app-warning-soft); color: var(--app-warning); }
.days-high { background: var(--app-danger-soft); color: var(--app-danger); }
.days-done { background: var(--app-neutral-soft); color: var(--app-neutral); }

.empty-state { text-align: center; padding: 48px 16px; color: var(--app-muted); white-space: normal; font-weight: 600; }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: 8px; color: var(--app-border-strong); }
.empty-state strong { display: block; color: var(--app-text); font-size: .95rem; margin-bottom: 4px; }

/* Menús de columnas / exportación */
.columns-menu { width: 330px; padding: 12px; }
.columns-menu-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: .86rem; }
.columns-all { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 2rem; margin: 0 -4px 6px; border-radius: 6px; background: var(--app-primary-soft); font-size: .82rem; font-weight: 800; }
.columns-all .form-check-label { flex: 1; cursor: pointer; color: var(--app-primary); }
.columns-all .form-check-input { cursor: pointer; }
.columns-count { font-size: .72rem; font-weight: 700; color: var(--app-muted); white-space: nowrap; }
.columns-list { max-height: 340px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.columns-list .form-check { padding: 6px 8px 6px 2rem; border-radius: 6px; margin: 0; font-size: .83rem; font-weight: 600; }
.columns-list .form-check:hover { background: var(--app-surface-3); }
.columns-list .form-check-input, .columns-list .form-check-label { cursor: pointer; }
.columns-list .form-check-label { width: 100%; }
.export-menu { width: 320px; padding: 8px; }
.export-menu .dropdown-item { display: flex; gap: 12px; align-items: center; white-space: normal; padding: 10px; }
.export-menu .dropdown-item strong { display: block; font-size: .87rem; }
.export-menu .dropdown-item small { color: var(--app-muted); font-size: .75rem; font-weight: 600; }
.export-icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; font-size: 1.15rem; flex: 0 0 auto; }
.export-icon.xlsx { background: var(--app-success-soft); color: var(--app-success); }
.export-icon.csv { background: var(--app-info-soft); color: var(--app-info); }

/* ---------- Offcanvas ---------- */
.app-offcanvas { --bs-offcanvas-width: 440px; --bs-offcanvas-bg: var(--app-surface); border-left: 1px solid var(--app-border) !important; box-shadow: var(--shadow-lg); }
.app-offcanvas .offcanvas-header { border-bottom: 1px solid var(--app-border); align-items: flex-start; padding: 16px 20px; }
.app-offcanvas .offcanvas-title { font-weight: 800; }
.app-offcanvas .offcanvas-body { padding: 16px 20px; }
.offcanvas-footer { display: flex; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--app-border); background: var(--app-surface-2); }
.filter-section { border: 1px solid var(--app-border); border-radius: var(--radius); padding: 12px 14px 14px; margin-bottom: 12px; background: var(--app-surface-2); }
.filter-section legend { float: none; width: auto; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--app-muted); padding: 0 6px; margin: 0 0 6px -6px; }
.filter-section legend i { margin-right: 6px; color: var(--app-primary); }
.date-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.date-presets .btn { font-size: .75rem; padding: .2rem .6rem; }

.detail-offcanvas { --bs-offcanvas-width: 560px; }
.detail-header { background: var(--app-surface-2); }
.detail-eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--app-muted); font-weight: 800; }
.detail-offcanvas .offcanvas-title { font-size: 1.3rem; font-weight: 900; }
.detail-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.detail-section { margin-bottom: 18px; }
.detail-section h6 { display: flex; align-items: center; gap: 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--app-muted); font-weight: 800; margin-bottom: 8px; }
.detail-section h6 i { color: var(--app-primary); font-size: .95rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--app-surface); border: 1px solid var(--app-border); border-radius: var(--radius); overflow: hidden; margin: 0; }
.detail-grid > div { padding: 9px 12px; min-width: 0; box-shadow: inset -1px -1px 0 var(--app-border); }
.detail-grid dt { font-size: .7rem; color: var(--app-muted); font-weight: 700; margin-bottom: 2px; }
.detail-grid dd { margin: 0; font-size: .86rem; font-weight: 700; color: var(--app-text); word-break: break-word; }
.detail-grid .span-2 { grid-column: span 2; }
.detail-text { background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: var(--radius); padding: 11px 13px; font-size: .86rem; white-space: pre-wrap; color: var(--app-text-2); line-height: 1.5; font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--app-border); }
.timeline li { position: relative; padding: 0 0 11px 26px; display: flex; justify-content: space-between; gap: 12px; font-size: .84rem; font-weight: 600; }
.timeline li::before { content: ""; position: absolute; left: 1px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--app-surface); border: 3px solid var(--app-primary); }
.timeline li span { color: var(--app-text-2); }
.timeline li strong { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Select2 / Flatpickr ---------- */
.select2-container--bootstrap-5 .select2-selection { border-radius: 8px; border-color: var(--app-border-strong); background-color: var(--app-surface); min-height: 40px; font-weight: 600; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection { border-color: var(--app-accent); box-shadow: 0 0 0 3px rgba(47, 111, 179, .15); }
.select2-container--bootstrap-5 .select2-dropdown { border-color: var(--app-border); border-radius: 8px; background: var(--app-surface); box-shadow: var(--shadow-md); overflow: hidden; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option { font-weight: 600; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--app-primary-soft); color: var(--app-primary); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected { background: var(--app-primary); color: #fff; }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--app-text); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field { background: var(--app-surface-2); color: var(--app-text); border-color: var(--app-border); }
.flatpickr-calendar { border-radius: 10px; box-shadow: var(--shadow-lg); border: 1px solid var(--app-border); font-family: inherit; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: #1f3b64; border-color: #1f3b64; }
.flatpickr-day.inRange { background: #e8eef6; box-shadow: -5px 0 0 #e8eef6, 5px 0 0 #e8eef6; border-color: transparent; }
[data-bs-theme="dark"] .flatpickr-calendar { background: var(--app-surface); }
[data-bs-theme="dark"] .flatpickr-calendar .flatpickr-day, [data-bs-theme="dark"] .flatpickr-calendar .flatpickr-weekday,
[data-bs-theme="dark"] .flatpickr-calendar .flatpickr-month, [data-bs-theme="dark"] .flatpickr-calendar .flatpickr-current-month { color: var(--app-text); fill: var(--app-text); }
[data-bs-theme="dark"] .flatpickr-day.flatpickr-disabled, [data-bs-theme="dark"] .flatpickr-day.prevMonthDay, [data-bs-theme="dark"] .flatpickr-day.nextMonthDay { color: var(--app-muted); }
[data-bs-theme="dark"] .flatpickr-day:hover { background: var(--app-surface-3); }
[data-bs-theme="dark"] .flatpickr-day.inRange { background: #1b2b45; box-shadow: -5px 0 0 #1b2b45, 5px 0 0 #1b2b45; }

/* ---------- Notificaciones (Notyf) ---------- */
.notyf { font-family: inherit; }
.notyf__toast { border-radius: 8px !important; box-shadow: var(--shadow-lg) !important; padding: 0 14px !important; max-width: 420px !important; }
.notyf__wrapper { padding: 13px 0 !important; }
.notyf__message { font-size: .87rem; font-weight: 700; line-height: 1.4; }
.notyf__icon--success, .notyf__icon--error { box-shadow: none; }
.notyf-icon { font-size: 1.1rem; color: #fff; }

/* ---------- SweetAlert2 ---------- */
/* Confirmaciones y avisos siempre por encima de las ventanas, también de las apiladas (.modal.is-stacked = 1070) */
.swal2-container { z-index: 2100 !important; }
.notyf { z-index: 2110 !important; }
.swal2-popup { border-radius: 12px !important; font-family: inherit !important; background: var(--app-surface) !important; color: var(--app-text) !important; padding: 1.5em 1.4em 1.3em !important; }
.swal2-title { font-size: 1.22rem !important; font-weight: 900 !important; color: var(--app-text) !important; }
.swal2-html-container { font-size: .93rem !important; color: var(--app-text-2) !important; font-weight: 600 !important; }
.swal2-actions { gap: 8px; }
.swal2-actions .btn { min-width: 120px; }
.swal2-icon { transform: scale(.85); }
.swal2-backdrop-show { background: rgba(15, 23, 42, .5) !important; }

/* =========================================================================
   Login
   ========================================================================= */
.auth-body { min-height: calc(100vh / var(--ui-zoom)); background: var(--app-bg); }
.auth-shell { min-height: calc(100vh / var(--ui-zoom)); display: grid; grid-template-columns: 1.05fr 1fr; }
@media (max-width: 991.98px) { .auth-shell { grid-template-columns: 1fr; } .auth-hero { display: none !important; } }

.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px; color: #fff; background: #15223a; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border: 60px solid #1b2b47; border-radius: 50%; pointer-events: none; }
.auth-hero-content { position: relative; z-index: 1; max-width: 520px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 900; letter-spacing: .1em; font-size: 1.2rem; margin-bottom: 56px; }
.auth-brand .brand-logo { width: 42px; height: 42px; }
.auth-brand .brand-full { height: 64px; }
.auth-card-brand .brand-full { height: 46px; }
.auth-hero-title { font-size: clamp(2rem, 3vw, 2.7rem); font-weight: 900; line-height: 1.12; letter-spacing: -.01em; }
.auth-hero-title span { color: #8fb5e3; }
.auth-hero-text { color: #b4bfd1; font-size: 1.02rem; margin: 16px 0 34px; max-width: 440px; font-weight: 600; }
.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-features li { display: flex; gap: 14px; align-items: flex-start; background: #1b2b47; border: 1px solid #243a5f; border-radius: 10px; padding: 14px 16px; }
.auth-features i { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: #243a5f; color: #8fb5e3; font-size: 1.05rem; flex: 0 0 auto; }
.auth-features strong { display: block; font-size: .93rem; }
.auth-features span { color: #b4bfd1; font-size: .83rem; font-weight: 600; }
.auth-hero-foot { position: relative; z-index: 1; color: #7d8aa3; font-size: .78rem; font-weight: 600; }

.auth-panel { position: relative; display: grid; place-items: center; padding: 32px 20px; background: var(--app-bg); }
.auth-theme { position: absolute; top: 20px; right: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px; padding: 36px 32px 28px; box-shadow: var(--shadow-md); }
.auth-card-brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: .1em; margin-bottom: 22px; }
.auth-card-brand .brand-logo { width: 34px; height: 34px; }
.auth-title { font-size: 1.65rem; font-weight: 900; margin: 0; }
.auth-subtitle { color: var(--app-muted); margin: 6px 0 22px; font-weight: 600; }
.auth-alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 8px; font-size: .87rem; padding: 10px 14px; border: 1px solid #f5c2bd; background: var(--app-danger-soft); color: var(--app-danger); font-weight: 700; }
.auth-card .form-floating > .form-control { height: 54px; border-radius: 8px; background: var(--app-surface); }
.auth-card .form-floating > label { color: var(--app-muted); font-weight: 600; }
.password-field .form-control { padding-right: 48px; }
.password-toggle { position: absolute; right: 8px; top: 8px; width: 38px; height: 38px; border: 0; background: transparent; color: var(--app-muted); border-radius: 6px; z-index: 5; }
.password-toggle:hover { color: var(--app-primary); background: var(--app-primary-soft); }
.caps-warning { font-size: .78rem; color: var(--app-warning); margin-top: 6px; font-weight: 700; }
.btn-auth { position: relative; height: 50px; border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-auth .btn-loading { display: none; }
.btn-auth.is-loading .btn-label, .btn-auth.is-loading .btn-arrow { display: none; }
.btn-auth.is-loading .btn-loading { display: inline-flex; align-items: center; }
.auth-help { color: var(--app-muted); font-size: .77rem; margin: 18px 0 0; text-align: center; font-weight: 600; }
.shake { animation: shake .4s ease both; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* =========================================================================
   Páginas de estado (error, 404, 403)
   ========================================================================= */
.status-body { min-height: calc(100vh / var(--ui-zoom)); display: grid; place-items: center; padding: 20px; background: var(--app-bg); }
.status-card { max-width: 460px; text-align: center; background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px; padding: 38px 32px; box-shadow: var(--shadow-md); }
.status-card h1 { font-size: 1.45rem; font-weight: 900; }
.status-card p { color: var(--app-muted); font-weight: 600; }
.status-icon { width: 64px; height: 64px; border-radius: 12px; display: grid; place-items: center; font-size: 1.8rem; margin: 0 auto 16px; }
.status-danger { background: var(--app-danger-soft); color: var(--app-danger); }
.status-info { background: var(--app-info-soft); color: var(--app-info); }
.status-warning { background: var(--app-warning-soft); color: var(--app-warning); }
.status-code { font-size: .86rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Ajustes finales */
.welcome-head .brand-logo { width: 56px; height: 56px; }
/* Etiqueta flotante del login: sin el fondo gris que Bootstrap toma del body */
.form-floating > .form-control:focus ~ label::after,
.form-floating > .form-control:not(:placeholder-shown) ~ label::after { background-color: transparent !important; }
/* Grilla compacta: textos largos en una línea (texto completo en el tooltip y en el detalle) */
table.app-table .cell-long { -webkit-line-clamp: 1; max-width: 320px; }
table.app-table .cell-clip, table.app-table .cell-long { vertical-align: middle; }

/* ---------- Mantenimientos (Usuarios) ---------- */
.toolbar-select { width: auto; flex: 0 1 190px; min-width: 150px; height: 40px; }
.grid-toolbar .grid-search:has(~ .toolbar-select) { flex: 1 1 240px; }
.row-actions { display: inline-flex; gap: 6px; }
.icon-btn-sm { width: 30px; height: 30px; font-size: .85rem; border-radius: 6px; }
.icon-btn-danger:hover { background: var(--app-danger-soft); color: var(--app-danger); border-color: var(--app-danger-soft); }
table.app-table td.col-actions { position: sticky; right: 0; z-index: 1; box-shadow: inset 1px 0 0 var(--app-border-strong); }
/* Ventana emergente de mantenimiento (modal centrado) */
.app-modal .modal-content { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.app-modal .modal-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--app-border); }
.app-modal .modal-title { font-weight: 900; font-size: 1.15rem; margin: 0; }
.app-modal .modal-body { padding: 18px 20px 6px; background: var(--app-surface); }
.app-modal .modal-body .filter-section { margin-bottom: 14px; }
.app-modal .modal-footer { padding: 12px 20px; border-top: 1px solid var(--app-border); background: var(--app-surface-2); border-radius: 0 0 12px 12px; gap: 8px; }
.app-modal .modal-footer > * { margin: 0; }
/* Acciones en la cabecera (Guardar, Cancelar, Eliminar…): siempre visibles aunque el contenido tenga desplazamiento */
.app-modal .modal-header { flex-wrap: wrap; row-gap: 10px; }
.app-modal .modal-header > .min-w-0 { flex: 1 1 220px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.modal-actions > * { margin: 0; }
.modal-actions .btn { white-space: nowrap; }
.modal-actions .actions-sep { width: 1px; align-self: stretch; background: var(--app-border); margin: 2px 2px; }
.app-modal .modal-header > .btn-close { margin: 0 0 0 4px; flex: 0 0 auto; }
@media (max-width: 767.98px) { .modal-actions { order: 5; flex: 1 1 100%; } }
/* La ventana no debe superar el alto visible (la interfaz está al 90 % en escritorio) */
@media (min-width: 992px) {
    .modal { width: calc(100vw / var(--ui-zoom)); height: calc(100vh / var(--ui-zoom)); }
}
.app-modal .modal-dialog-scrollable .modal-content { max-height: calc(100vh / var(--ui-zoom) - 2 * var(--bs-modal-margin, 1.75rem)); }
.modal-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem; background: var(--app-primary-soft); color: var(--app-primary); flex: 0 0 auto; }
.modal-backdrop.show { opacity: .5; }
@media (min-width: 1200px) { .app-modal .modal-xl { --bs-modal-width: 1040px; } }
.req { color: var(--app-danger); font-weight: 800; }
.input-group > .btn-soft { border-color: var(--app-border-strong); }

/* ---------- Actualizar contraseña ---------- */
.narrow-page { max-width: 560px; }
.notice { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); font-weight: 600; }
.notice > i { font-size: 1.3rem; }
.strength-bar { height: 6px; border-radius: 99px; background: var(--app-surface-3); overflow: hidden; margin-bottom: 4px; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .25s, background-color .25s; }
.req-list { list-style: none; padding: 12px 14px; margin: 0; display: grid; gap: 6px; background: var(--app-surface-2); border: 1px solid var(--app-border); border-radius: var(--radius); font-size: .84rem; font-weight: 600; color: var(--app-muted); }
.req-list li { display: flex; gap: 8px; align-items: center; }
.req-list li.ok { color: var(--app-success); }
.req-list li.optional:not(.ok) { font-weight: 500; }

/* ---------- Clientes ---------- */
/* Control segmentado (tipo de cliente, Sí/No, estados) */
.segmented { display: inline-flex; background: var(--app-surface-3); border: 1px solid var(--app-border); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; color: var(--app-text-2); font-weight: 700; font-size: .8rem; padding: 6px 12px; border-radius: 7px; line-height: 1.2; transition: background-color .15s, color .15s; }
.segmented button:hover { color: var(--app-primary); }
.segmented button.active { background: var(--app-surface); color: var(--app-primary); box-shadow: var(--shadow-sm); }
.segmented-block { display: flex; }
.segmented-block button { flex: 1 1 0; }
.segmented-sm button { font-size: .76rem; padding: 4px 12px; }
.segmented .seg-count { font-size: .7rem; font-weight: 800; color: var(--app-muted); margin-left: 3px; }
.segmented button.active .seg-count { color: var(--app-primary); }
.grid-toolbar .segmented { height: 40px; align-items: center; flex-wrap: nowrap; }
.grid-toolbar .grid-search:has(~ .segmented) { flex: 1 1 260px; }

/* Lista */
.client-cell { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 340px; }
.client-avatar-sm { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: .72rem; font-weight: 900; background: var(--app-primary-soft); color: var(--app-primary); letter-spacing: .02em; }
.count-chip { min-width: 34px; border: 1px solid var(--app-primary-soft); background: var(--app-primary-soft); color: var(--app-primary); font-weight: 800; font-size: .78rem; border-radius: 99px; padding: 2px 10px; font-variant-numeric: tabular-nums; }
.count-chip:hover { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.count-chip.is-zero { background: transparent; border-color: var(--app-border); color: var(--app-muted); }
.yn { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: .9rem; }
.yn-yes { background: var(--app-success-soft); color: var(--app-success); }
.yn-no { background: var(--app-neutral-soft); color: var(--app-neutral); }

/* Ficha del cliente */
@media (min-width: 1200px) { .client-modal .modal-xl { --bs-modal-width: 1180px; } }
.client-modal .modal-body { min-height: 460px; padding-bottom: 16px; }
/* Altura fija en escritorio: la ventana no "salta" al cambiar de pestaña */
@media (min-width: 992px) { .client-modal .modal-content { height: min(880px, calc(100vh / var(--ui-zoom) - 3.5rem)); } }
.client-head { background: var(--app-surface-2); align-items: flex-start !important; }
.client-avatar { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.05rem; font-weight: 900; background: var(--app-primary); color: #fff; letter-spacing: .03em; }
.client-avatar.is-juridica { background: var(--app-accent); }
.client-avatar .bi { font-size: 1.35rem; }
.client-tabs-wrap { border-bottom: 1px solid var(--app-border); background: var(--app-surface); overflow-x: auto; scrollbar-width: thin; flex-shrink: 0; }
.client-tabs { flex-wrap: nowrap; padding: 0 8px; gap: 0; }
.client-tabs .nav-link { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--app-text-2); font-weight: 700; font-size: .82rem; padding: 12px 9px 10px; background: none; }
.client-tabs .nav-link .bi { color: var(--app-muted); }
.client-tabs .nav-link:hover { color: var(--app-primary); }
.client-tabs .nav-link.active { color: var(--app-primary); border-bottom-color: var(--app-primary); }
.client-tabs .nav-link.active .bi { color: var(--app-primary); }
.client-tabs .nav-link.disabled { opacity: .45; }
.tab-count { font-size: .68rem; font-weight: 800; background: var(--app-surface-3); color: var(--app-text-2); border-radius: 99px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.nav-link.active .tab-count { background: var(--app-primary); color: #fff; }
.is-dimmed { opacity: .6; transition: opacity .15s; }
.is-dimmed:focus-within, .is-dimmed:hover { opacity: 1; }
.yn-list { display: grid; gap: 4px; }
.yn-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--app-border); font-weight: 700; font-size: .86rem; color: var(--app-text-2); }
.yn-row:last-child { border-bottom: 0; }
.info-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--app-info-soft); color: var(--app-info); font-size: .84rem; font-weight: 600; }
.action-menu { width: 330px; padding: 6px; }
.action-menu .dropdown-item { display: flex; gap: 12px; align-items: flex-start; white-space: normal; padding: 9px 10px; border-radius: 7px; }
.action-menu .dropdown-item > i { font-size: 1.05rem; margin-top: 1px; color: var(--app-primary); }
.action-menu .dropdown-item.text-danger > i { color: var(--app-danger); }
.action-menu .dropdown-item strong { display: block; font-size: .85rem; }
.action-menu .dropdown-item small { color: var(--app-muted); font-size: .74rem; font-weight: 600; }
.action-menu .dropdown-item:active small, .action-menu .dropdown-item:active > i { color: inherit; }

/* Pestañas con registros */
.sub-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sub-title { display: flex; align-items: center; gap: 10px; }
.sub-title > i { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--app-primary-soft); color: var(--app-primary); font-size: 1.05rem; }
.sub-title strong { display: block; font-size: .95rem; }
.sub-title small { color: var(--app-muted); font-weight: 600; font-size: .78rem; }
.sub-editor { border: 1px solid var(--app-border-strong); border-left: 3px solid var(--app-primary); background: var(--app-surface-2); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.sub-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--app-primary); }
.sub-editor-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.sub-table { border: 1px solid var(--app-border); }
table.app-table.sub-table > thead > tr > th:first-child, table.app-table.sub-table > tbody > tr > td:first-child { position: static; box-shadow: none; }
.sub-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); background: var(--app-surface-2); white-space: nowrap; }
.sub-table tbody tr[data-sub-edit] { cursor: pointer; }
.sub-table tbody tr.is-editing > td { background: var(--app-primary-soft); }
.sub-search { position: relative; width: 280px; max-width: 100%; }
.sub-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--app-muted); font-size: .85rem; }
.sub-search input { padding-left: 30px; }
.sub-loading { padding: 28px; text-align: center; color: var(--app-muted); font-weight: 600; }
.empty-state.compact { padding: 32px 16px; border: 1px dashed var(--app-border-strong); border-radius: var(--radius); }
.sum-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sum-chip { display: inline-flex; flex-direction: column; padding: 8px 14px; border: 1px solid var(--app-border); border-radius: var(--radius); background: var(--app-surface-2); min-width: 120px; }
.sum-chip small { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); }
.sum-chip strong { font-size: 1.02rem; font-variant-numeric: tabular-nums; }

/* Archivos */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 26px 16px; border: 2px dashed var(--app-border-strong); border-radius: var(--radius-lg); background: var(--app-surface-2); color: var(--app-text-2); cursor: pointer; text-align: center; transition: border-color .15s, background-color .15s; margin-bottom: 14px; width: 100%; }
.dropzone > i { font-size: 2rem; color: var(--app-primary); }
.dropzone small { color: var(--app-muted); font-weight: 600; }
.dropzone:hover, .dropzone.is-over { border-color: var(--app-primary); background: var(--app-primary-soft); }
.upload-queue { display: grid; gap: 6px; margin-bottom: 10px; }
.upload-queue:empty { display: none; }
.upload-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--app-surface-2); border: 1px solid var(--app-border); font-weight: 600; font-size: .84rem; }
.upload-item small { color: var(--app-muted); }
.upload-item.is-error { background: var(--app-danger-soft); color: var(--app-danger); border-color: var(--app-danger-soft); }
.upload-item.is-error small { color: var(--app-danger); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--app-border); border-radius: var(--radius); background: var(--app-surface); min-width: 0; }
.file-card:hover { border-color: var(--app-border-strong); box-shadow: var(--shadow-sm); }
.file-card.is-missing { background: var(--app-surface-2); }
.file-name { font-weight: 700; font-size: .86rem; }
.file-icon { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font-size: 1.2rem; }
.fi-pdf { background: var(--app-danger-soft); color: var(--app-danger); }
.fi-xls { background: var(--app-success-soft); color: var(--app-success); }
.fi-doc, .fi-mail { background: var(--app-info-soft); color: var(--app-info); }
.fi-img { background: var(--app-warning-soft); color: var(--app-warning); }
.fi-zip, .fi-other { background: var(--app-neutral-soft); color: var(--app-neutral); }
.file-main { flex: 1 1 auto; }
/* Barra de la lista de archivos: cantidad + vista Tarjetas / Lista (se recuerda en el navegador para todas las pantallas) */
.file-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.file-view-toggle .btn { padding: 2px 9px; line-height: 1.4; }
.file-view-toggle .btn.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.file-col, .file-list-head { display: none; }
/* Vista de lista: una fila por archivo con columnas Nombre, Fecha, Tamaño y acciones */
.file-grid.is-list { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--app-border); border-radius: var(--radius); overflow: hidden; }
.file-grid.is-list .file-list-head,
.file-grid.is-list .file-card { display: grid; grid-template-columns: 30px minmax(0, 1fr) 96px 150px 140px; align-items: center; gap: 12px; }
.file-grid.is-list .row-actions { justify-content: flex-end; }
.file-grid.is-list .file-list-head { padding: 7px 12px; background: var(--app-surface-2); border-bottom: 1px solid var(--app-border); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--app-muted); }
.file-grid.is-list .file-card { border: 0; border-bottom: 1px solid var(--app-border); border-radius: 0; padding: 6px 12px; box-shadow: none; }
.file-grid.is-list .file-card:last-child { border-bottom: 0; }
.file-grid.is-list .file-card:hover { background: var(--app-surface-2); }
.file-grid.is-list .file-icon { width: 30px; height: 30px; flex-basis: 30px; font-size: .95rem; border-radius: 7px; }
.file-grid.is-list .file-meta { display: none; }
.file-grid.is-list .file-col { display: block; font-size: .82rem; color: var(--app-text-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 575.98px) {
    .file-grid.is-list .file-list-head, .file-grid.is-list .file-card { grid-template-columns: 30px minmax(0, 1fr) auto; }
    .file-grid.is-list .file-col, .file-grid.is-list .file-list-head span:nth-child(3), .file-grid.is-list .file-list-head span:nth-child(4) { display: none; }
    .file-grid.is-list .file-meta { display: block; }
}
/* Archivos agrupados por tipo (App.files.cards con groupBy): árbol de carpetas, abiertas por defecto */
.file-tree { display: flex; flex-direction: column; gap: 6px; }
.file-folder > summary { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--app-border); border-radius: var(--radius); background: var(--app-surface-2); cursor: pointer; list-style: none; user-select: none; }
.file-folder > summary::-webkit-details-marker { display: none; }
.file-folder > summary:hover { border-color: var(--app-primary); }
.file-folder > summary:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.file-folder-chevron { font-size: .75rem; color: var(--app-muted); transition: transform .15s ease; }
.file-folder[open] > summary .file-folder-chevron { transform: rotate(90deg); }
.file-folder-icon { color: var(--app-primary); font-size: 1.05rem; }
.file-folder.is-otros .file-folder-icon { color: var(--app-muted); }
.file-folder-name { font-weight: 700; font-size: .86rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-folder-count { margin-left: auto; min-width: 26px; padding: 1px 8px; border-radius: 999px; background: var(--app-surface); border: 1px solid var(--app-border); font-size: .74rem; font-weight: 700; text-align: center; color: var(--app-text-2); }
.file-folder-body { margin: 6px 0 4px 15px; padding-left: 14px; border-left: 2px solid var(--app-border); }
.file-folder.is-empty > summary { background: var(--app-surface); }
.file-folder.is-empty .file-folder-name, .file-folder.is-empty .file-folder-count { color: var(--app-muted); font-weight: 600; }
.file-folder-empty { display: block; padding: 2px 0 4px; color: var(--app-muted); font-style: italic; }
/* ---------- Gestión de Archivos (explorador de OneDrive) ---------- */
.fx { display: flex; flex-direction: column; height: calc(100vh / var(--ui-zoom) - 210px); min-height: 520px; overflow: hidden; }
.fx-bar, .fx-actions { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--app-border); flex-wrap: wrap; }
.fx-actions { padding-top: 8px; padding-bottom: 8px; background: var(--app-surface-2); }
.fx-nav .btn, .fx-view .btn { padding: 5px 10px; }
.fx .btn-soft:disabled { border-color: var(--app-border); color: var(--app-muted); background: var(--app-surface); opacity: .5; }
.fx-view .btn.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.fx-crumbs { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: thin;
    border: 1px solid var(--app-border); border-radius: 8px; padding: 3px 6px; background: var(--app-surface); }
.fx-crumb { border: 0; background: none; padding: 3px 7px; border-radius: 6px; color: var(--app-text-2); font-weight: 600; font-size: .86rem; }
.fx-crumb:hover { background: var(--app-primary-soft); color: var(--app-primary); }
.fx-crumb.is-current { color: var(--app-text); }
.fx-crumb-sep { font-size: .65rem; color: var(--app-muted); }
.fx-search { position: relative; flex: 0 1 300px; min-width: 200px; }
.fx-search > i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--app-muted); }
.fx-search .form-control { padding-left: 32px; }
.fx-sep { width: 1px; align-self: stretch; background: var(--app-border); margin: 0 4px; }
.fx-selbar { display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 8px; background: var(--app-primary-soft); }
.fx-selcount { font-weight: 700; font-size: .84rem; color: var(--app-primary); margin-right: 4px; }
.fx-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.fx-tree { border-right: 1px solid var(--app-border); overflow: auto; padding: 8px 4px; background: var(--app-surface); scrollbar-width: thin; }
.fx-tree ul { list-style: none; margin: 0; padding: 0; }
.fx-tree li > ul { display: none; }
.fx-tree li.is-open > ul { display: block; }
.fx-tnode { display: flex; align-items: center; gap: 2px; padding-left: calc(var(--d) * 14px); border-radius: 6px; }
.fx-tnode:hover { background: var(--app-surface-2); }
.fx-tnode.is-current { background: var(--app-primary-soft); }
.fx-tnode.is-current .fx-tlabel { color: var(--app-primary); font-weight: 700; }
.fx-twist { border: 0; background: none; width: 20px; height: 24px; padding: 0; color: var(--app-muted); font-size: .7rem; flex: 0 0 20px; }
.fx-twist i { transition: transform .15s; display: inline-block; }
li.is-open > .fx-tnode .fx-twist i { transform: rotate(90deg); }
li.is-leaf > .fx-tnode .fx-twist { visibility: hidden; }
.fx-tlabel { border: 0; background: none; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 4px; font-size: .84rem; color: var(--app-text); text-align: left; }
.fx-tloading { padding: 4px 0 4px 34px; color: var(--app-muted); }
.fx-main { position: relative; overflow: auto; padding: 12px 14px; outline: none; scrollbar-width: thin; }
.fx-banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius); border: 1px solid var(--app-border); background: var(--app-surface-2); }
.fx-banner > i { font-size: 1.3rem; color: var(--app-primary); }
.fx-banner strong { display: block; }
.fx-banner small { color: var(--app-text-2); }
.fx-banner.is-files { background: var(--app-primary-soft); border-color: var(--app-primary-soft-2); }
.fx-banner.is-system > i { color: var(--app-muted); }
.fx-ic-folder { color: #e3a008; }
.fx-ic-linked { color: var(--app-primary); }
.fx-ic-system { color: var(--app-muted); }
/* Colores por tipo de carpeta: cliente, documentos generales, póliza, siniestro, cuota, carpeta propia, principal y anterior */
[data-bs-theme="light"] .fx, [data-bs-theme="light"] .fx-locate-results, [data-bs-theme="light"] .fx-chips {
    --fx-cli: #2563eb; --fx-docs: #0f8a7e; --fx-pol: #7c3aed; --fx-sin: #dc2626; --fx-cuo: #15803d; --fx-free: #d97706; --fx-root: #1f3b64; --fx-old: #64748b;
    --fx-pdf: #dc2626; --fx-img: #d97706; --fx-mail: #0284c7; --fx-office: #15803d; --fx-other: #64748b; }
[data-bs-theme="dark"] .fx, [data-bs-theme="dark"] .fx-locate-results, [data-bs-theme="dark"] .fx-chips {
    --fx-cli: #60a5fa; --fx-docs: #2dd4bf; --fx-pol: #a78bfa; --fx-sin: #f87171; --fx-cuo: #4ade80; --fx-free: #fbbf24; --fx-root: #93c5fd; --fx-old: #94a3b8;
    --fx-pdf: #f87171; --fx-img: #fbbf24; --fx-mail: #38bdf8; --fx-office: #4ade80; --fx-other: #94a3b8; }
.fx-c-cli, .fx-t-cli { --c: var(--fx-cli); } .fx-c-docs, .fx-t-docs { --c: var(--fx-docs); } .fx-c-pol, .fx-t-pol { --c: var(--fx-pol); }
.fx-c-sin, .fx-t-sin { --c: var(--fx-sin); } .fx-c-cuo, .fx-t-cuo { --c: var(--fx-cuo); } .fx-c-free, .fx-t-free { --c: var(--fx-free); }
.fx-c-root, .fx-t-root { --c: var(--fx-root); } .fx-c-old, .fx-t-old { --c: var(--fx-old); }
.fx-t-f-pdf { --c: var(--fx-pdf); } .fx-t-f-img { --c: var(--fx-img); } .fx-t-f-mail { --c: var(--fx-mail); } .fx-t-f-office { --c: var(--fx-office); } .fx-t-f-other { --c: var(--fx-other); }
[class*="fx-c-"] { color: var(--c); }
.fx-ic[class*="fx-c-"] { background: transparent; font-size: 1.45rem; }
.fx-type { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
    color: var(--c, var(--app-muted)); background: color-mix(in srgb, var(--c, var(--app-muted)) 14%, transparent); border-radius: 999px; padding: 1px 8px 1px 6px; }
.fx-type.is-missing { opacity: .7; text-decoration: line-through; }
.fx-typeline { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 2px; }
.fx-linktext { font-size: .78rem; font-weight: 600; color: var(--app-text-2); min-width: 0; }
.fx-banner-ic { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem;
    color: var(--c, var(--app-primary)); background: color-mix(in srgb, var(--c, var(--app-primary)) 15%, transparent); }
.fx-banner[class*="fx-b-"] { border-left: 4px solid var(--c, var(--app-border)); }
.fx-b-cli { --c: var(--fx-cli); } .fx-b-docs { --c: var(--fx-docs); } .fx-b-pol { --c: var(--fx-pol); } .fx-b-sin { --c: var(--fx-sin); }
.fx-b-cuo { --c: var(--fx-cuo); } .fx-b-free { --c: var(--fx-free); } .fx-b-root { --c: var(--fx-root); } .fx-b-old { --c: var(--fx-old); }
.fx-banner small .fx-type { margin-right: 6px; }
.fx-tile-kind { position: absolute; left: -4px; bottom: 0; font-size: .8rem; color: var(--c); background: var(--app-surface); border-radius: 999px; padding: 2px 3px; line-height: 1; }
.fx-tile[class*="fx-tile-t-"] .fx-tile-sub { color: var(--c); font-weight: 600; }
.fx-tile-t-cli { --c: var(--fx-cli); } .fx-tile-t-docs { --c: var(--fx-docs); } .fx-tile-t-pol { --c: var(--fx-pol); } .fx-tile-t-sin { --c: var(--fx-sin); }
.fx-tile-t-cuo { --c: var(--fx-cuo); } .fx-tile-t-free { --c: var(--fx-free); } .fx-tile-t-root { --c: var(--fx-root); } .fx-tile-t-old { --c: var(--fx-old); }
/* Ubicar + chips de tipo */
.fx-filters { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--app-border); flex-wrap: wrap; }
.fx-locate { display: flex; gap: 6px; flex: 0 1 460px; min-width: 280px; }
.fx-locate .form-select { flex: 0 0 120px; }
.fx-locate-input { position: relative; flex: 1 1 auto; }
.fx-locate-input > i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--app-muted); }
.fx-locate-input .form-control { padding-left: 32px; }
.fx-locate-results { position: absolute; top: calc(100% + 4px); left: 0; right: auto; width: max(100%, 460px); max-height: 380px; overflow: auto; z-index: 1060; padding: 4px; }
.fx-loc-item { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 6px 8px; white-space: normal; }
.fx-loc-item .fx-banner-ic { flex-basis: 32px; width: 32px; height: 32px; font-size: 1rem; }
.fx-badge-none { background: var(--app-warning-soft); color: var(--app-warning); }
.fx-badge-old { background: var(--app-neutral-soft); color: var(--app-neutral); }
.fx-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fx-chipbtn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--app-border); background: var(--app-surface); color: var(--app-text-2);
    border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 600; }
.fx-chipbtn i { color: var(--c, inherit); }
.fx-chipbtn span { font-size: .72rem; color: var(--app-muted); font-variant-numeric: tabular-nums; }
.fx-chipbtn:hover { border-color: var(--c, var(--app-primary)); }
.fx-chipbtn.active { background: var(--c, var(--app-primary)); border-color: var(--c, var(--app-primary)); color: #fff; }
.fx-chipbtn.active i, .fx-chipbtn.active span { color: #fff; }
/* Lista */
.fx-list.is-list { border: 1px solid var(--app-border); border-radius: var(--radius); overflow: hidden; }
.fx-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 140px 96px 104px; align-items: center; gap: 10px; padding: 6px 10px;
    border-bottom: 1px solid var(--app-border); cursor: default; user-select: none; }
.fx-row:last-child { border-bottom: 0; }
.fx-row:hover { background: var(--app-surface-2); }
.fx-row.is-selected { background: var(--app-primary-soft); }
.fx-head { position: sticky; top: -12px; z-index: 2; background: var(--app-surface-2); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--app-muted); }
.fx-head:hover { background: var(--app-surface-2); }
.fx-head button { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; }
.fx-head button.text-end { text-align: right; }
.fx-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fx-ic { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 1rem; background: var(--app-surface-2); }
.fx-ic.fx-ic-folder, .fx-ic.fx-ic-linked, .fx-ic.fx-ic-system { background: transparent; font-size: 1.45rem; }
.fx-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .88rem; min-width: 0; }
.fx-title .fx-lock, .fx-title .fx-badge { flex: 0 0 auto; }
.fx-lock { color: var(--app-muted); font-size: .75rem; }
.fx-badge { font-size: .66rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--app-success-soft); color: var(--app-success); text-transform: uppercase; letter-spacing: .03em; }
.fx-chip { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; font-size: .74rem; font-weight: 600; color: var(--app-primary); background: var(--app-primary-soft);
    border-radius: 999px; padding: 1px 8px 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-chip.is-files { background: var(--app-info-soft); color: var(--app-info); }
.fx-chip.is-missing { background: var(--app-warning-soft); color: var(--app-warning); }
.fx-where { display: block; color: var(--app-muted); }
.fx-col-date, .fx-col-size { font-size: .82rem; color: var(--app-text-2); font-variant-numeric: tabular-nums; }
.fx-row-actions { display: flex; justify-content: flex-end; gap: 4px; opacity: .25; transition: opacity .12s; }
.fx-row:hover .fx-row-actions, .fx-row.is-selected .fx-row-actions { opacity: 1; }
.fx-row .fx-check { margin: 0; }
/* Íconos */
.fx-list.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.fx-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 10px; border-radius: var(--radius); border: 1px solid transparent; text-align: center; user-select: none; min-width: 0; }
.fx-tile:hover { background: var(--app-surface-2); border-color: var(--app-border); }
.fx-tile.is-selected { background: var(--app-primary-soft); border-color: var(--app-primary-soft-2); }
.fx-tile .fx-check { position: absolute; top: 8px; left: 8px; opacity: 0; }
.fx-tile:hover .fx-check, .fx-tile.is-selected .fx-check { opacity: 1; }
.fx-tile-icon { position: relative; width: 56px; height: 56px; display: grid; place-items: center; font-size: 2.6rem; border-radius: 12px; }
.fx-tile-icon.fi-pdf, .fx-tile-icon.fi-xls, .fx-tile-icon.fi-doc, .fx-tile-icon.fi-img, .fx-tile-icon.fi-zip, .fx-tile-icon.fi-other, .fx-tile-icon.fi-mail { font-size: 1.7rem; }
.fx-tile-icon .fx-lock { position: absolute; right: -2px; bottom: 2px; font-size: .8rem; background: var(--app-surface); border-radius: 999px; padding: 1px 3px; }
.fx-tile-name { font-size: .82rem; font-weight: 600; width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.fx-tile-sub { font-size: .72rem; color: var(--app-muted); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-tile .fx-badge { position: absolute; top: 8px; right: 8px; }
.fx-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--app-muted); font-weight: 600; }
.fx-status { display: flex; align-items: center; gap: 18px; padding: 6px 14px; border-top: 1px solid var(--app-border); background: var(--app-surface-2); font-size: .8rem; color: var(--app-text-2); flex-wrap: wrap; }
/* Soltar archivos */
.fx-drop { position: absolute; inset: 8px; display: none; align-items: center; justify-content: center; border: 2px dashed var(--app-primary); border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--app-primary-soft) 88%, transparent); z-index: 5; pointer-events: none; }
.fx-drop.is-on { display: flex; }
.fx-drop > div { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--app-primary); }
.fx-drop i { font-size: 2.6rem; }
.fx-drop.is-blocked { border-color: var(--app-danger); background: var(--app-danger-soft); }
.fx-drop.is-blocked > div { color: var(--app-danger); }
/* Menú contextual */
.fx-context { position: fixed; z-index: 1080; min-width: 240px; display: none; }
.fx-context.show { display: block; }
.fx-context .fx-note { font-size: .78rem; white-space: normal; }
/* Cola de subida */
.fx-uploads { position: fixed; right: 18px; bottom: 18px; z-index: 1070; width: 380px; max-width: calc(100vw - 36px); background: var(--app-surface); border: 1px solid var(--app-border);
    border-radius: var(--radius-lg); box-shadow: 0 16px 40px rgba(16, 24, 40, .18); overflow: hidden; }
.fx-uploads-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: var(--app-primary); color: #fff; }
.fx-uploads-head strong { flex: 1; font-size: .88rem; }
.fx-uploads-head .icon-btn { color: #fff; }
.fx-uploads-body { max-height: 320px; overflow: auto; padding: 6px 10px; }
.fx-uploads.is-collapsed .fx-uploads-body { display: none; }
.fx-up { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--app-border); font-size: .84rem; }
.fx-up:last-child { border-bottom: 0; }
.fx-up .progress { height: 4px; margin: 4px 0 2px; }
.fx-up.is-error .fx-up-msg { color: var(--app-danger); }
.fx-up.is-done .fx-up-msg { color: var(--app-success); }
.fx-up.is-skipped { opacity: .6; }
/* Selector de carpetas (Mover) y actividad */
.fx-picker { display: grid; gap: 4px; max-height: 50vh; overflow: auto; }
.fx-pick { display: flex; align-items: center; gap: 8px; border: 1px solid var(--app-border); background: var(--app-surface); border-radius: 8px; padding: 7px 10px; text-align: left; min-width: 0; }
.fx-pick:hover { border-color: var(--app-primary); background: var(--app-primary-soft); }
.fx-activity { list-style: none; margin: 0; padding: 0; }
.fx-activity li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--app-border); font-size: .85rem; }
.fx-act-ic { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--app-primary-soft); color: var(--app-primary); }
.fx-act-path { font-weight: 600; word-break: break-all; }
.fx-code { font-size: .8rem; word-break: break-all; }
.fx-ficha { font-weight: 600; white-space: nowrap; }
@media (max-width: 991.98px) {
    .fx { height: auto; min-height: 0; }
    .fx-body { grid-template-columns: 1fr; }
    .fx-tree { display: none; }
    .fx-row { grid-template-columns: 30px minmax(0, 1fr) 76px 70px; }
    .fx-col-date, .fx-head button:nth-of-type(2) { display: none; }
    .fx-row-actions { opacity: 1; }
}

/* Vista previa (lupa): PDF e imágenes sobre la ventana actual */
.file-viewer { position: fixed; inset: 0; width: calc(100vw / var(--ui-zoom)); height: calc(100vh / var(--ui-zoom)); z-index: 2000; display: flex; flex-direction: column; background: rgba(15, 23, 42, .86); }
.file-viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--app-surface); border-bottom: 1px solid var(--app-border); min-width: 0; }
.file-viewer-bar .file-icon { width: 32px; height: 32px; flex-basis: 32px; font-size: 1rem; }
.file-viewer-body { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.file-viewer-body iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
.file-viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.file-viewer-error { color: #fff; text-align: center; }

/* ---------- Pólizas, endosos y pre registros ---------- */
.toolbar-contratante { flex: 0 1 300px; min-width: 220px; }
.grid-toolbar .grid-search:has(~ .segmented) { flex: 1 1 240px; }
.row-link { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--app-primary); background: var(--app-primary-soft); }
.row-link:hover { background: var(--app-primary); color: #fff; }
.sub-table.is-clickable tbody tr, .sub-table tbody tr[data-poliza], .sub-table tbody tr[data-pf-open] { cursor: pointer; }
.sub-heading { display: flex; align-items: center; gap: 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--app-muted); font-weight: 800; margin-bottom: 10px; }
.sub-heading i { color: var(--app-primary); font-size: .95rem; }
.detail-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-grid-3 .span-2 { grid-column: span 2; }
@media (max-width: 767.98px) { .detail-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Ficha de cliente de solo lectura: detalle completo de un registro al hacer clic en su fila */
.cf-detail-row > td { background: var(--app-surface-2); padding: 8px 12px; }
.cf-detail-row:hover > td { background: var(--app-surface-2); }
tr.is-open > td { background: var(--app-surface-2); }
.sum-chip.is-success strong { color: var(--app-success); }
.sum-chip.is-warning strong { color: var(--app-warning); }
.sum-chip.is-danger { border-color: var(--app-danger-soft); background: var(--app-danger-soft); }
.sum-chip.is-danger strong, .sum-chip.is-danger small { color: var(--app-danger); }
/* Totales que filtran (vista previa de cargas) */
.sum-chip-btn { text-align: left; color: inherit; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sum-chip-btn:hover { border-color: var(--app-primary); }
.sum-chip-btn.is-active { border-color: var(--app-primary); box-shadow: inset 0 0 0 1px var(--app-primary); }
.poliza-avatar { background: var(--app-primary); }
.poliza-avatar.is-endoso { background: var(--app-accent); }
.info-note.is-warning { background: var(--app-warning-soft); color: var(--app-warning); }
.info-note a { color: inherit; text-decoration: underline; }

/* Línea de renovaciones */
.renewal-line { list-style: none; padding: 0; margin: 0 0 6px; position: relative; }
.renewal-line::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--app-border-strong); }
.renewal-line li { position: relative; display: flex; gap: 12px; padding: 8px 10px 8px 0; border-radius: 8px; cursor: pointer; }
.renewal-line li:hover:not(.is-current) { background: var(--app-surface-2); }
.renewal-line li.is-current { cursor: default; }
.renewal-line .dot { flex: 0 0 16px; height: 16px; border-radius: 50%; margin-top: 2px; background: var(--app-surface); border: 3px solid var(--app-border-strong); position: relative; z-index: 1; }
.renewal-line li.is-current .dot { border-color: var(--app-primary); background: var(--app-primary); }

/* Ficha de póliza sobre otra ventana (p.ej. ficha del cliente) */
.modal.is-stacked { z-index: 1070; }
.modal-backdrop.is-stacked { z-index: 1065; }

/* Matriz de contactos del pre registro de contratante */
.contact-matrix { display: grid; gap: 6px; }
.contact-matrix .cm-head, .contact-matrix .cm-row { display: grid; grid-template-columns: 84px 1.2fr 1.3fr .9fr; gap: 6px; align-items: start; }
.contact-matrix .cm-head span { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); }
.contact-matrix .cm-row > span { font-size: .8rem; font-weight: 800; color: var(--app-text-2); padding-top: 6px; }
@media (max-width: 575.98px) { .contact-matrix .cm-head { display: none; } .contact-matrix .cm-row { grid-template-columns: 1fr; } }

/* Lista de pre registros pendientes (ficha del cliente) */
.pre-menu { width: 380px; max-height: 340px; overflow-y: auto; padding: 6px; }
.pre-menu .dropdown-item { white-space: normal; border-radius: 7px; padding: 8px 10px; }
.pre-menu .dropdown-item strong { display: block; font-size: .84rem; }
.pre-menu .dropdown-item small { color: var(--app-muted); font-size: .74rem; font-weight: 600; }

.sub-table tr.is-muted-row > td { color: var(--app-muted); text-decoration: line-through; text-decoration-color: var(--app-border-strong); }
.sub-table tr.is-muted-row > td .pill { text-decoration: none; }

/* Formularios en consulta */
form.is-readonly .segmented button { cursor: default; opacity: .75; }
form.is-readonly .segmented button.active { opacity: 1; }

/* ---------- Seguridad › Menús y Roles */
.menu-admin-tree { max-height: 68vh; overflow: auto; font-size: .9rem; }
.menu-admin-tree ul { list-style: none; margin: 0; padding-left: 1.1rem; }
.menu-admin-tree > ul { padding-left: 0; }
.menu-admin-tree .mt-node { display: flex; align-items: center; gap: .4rem; padding: .22rem .45rem; border-radius: .45rem; cursor: pointer; }
.menu-admin-tree .mt-node:hover { background: var(--app-hover, rgba(0,0,0,.04)); }
.menu-admin-tree .mt-node.is-selected { background: var(--app-primary-soft, rgba(31,59,100,.12)); font-weight: 700; }
.menu-admin-tree .mt-node.is-off { opacity: .55; }
.menu-admin-tree .mt-node .mt-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-admin-tree .mt-node .badge { font-weight: 600; }
.icon-pick { display: flex; flex-wrap: wrap; gap: .25rem; max-height: 118px; overflow: auto; }
.icon-pick button { width: 34px; height: 30px; border: 1px solid var(--app-border, #dfe3ea); border-radius: .4rem; background: transparent; }
.icon-pick button:hover, .icon-pick button.active { border-color: var(--app-primary, #1f3b64); background: var(--app-primary-soft, rgba(31,59,100,.12)); }
.perm-table td, .perm-table th { vertical-align: middle; }
.perm-table .perm-col { width: 78px; text-align: center; }


/* Portal de clientes: cabecera de grupo (quiebre por ramo) y barras del Resumen */
.app-table tr.group-row td { background: var(--app-primary-soft); color: var(--app-text); font-size: .9rem; border-bottom: 1px solid var(--app-border); cursor: default; }
#resumenBody .progress { height: .6rem; background: var(--app-neutral-soft); }
#resumenBody .progress-bar { background: var(--app-primary); }.file-grid.is-wide { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); }
