:root { --mfn-primary:#2d3f91; --mfn-primary-strong:#203276; --mfn-primary-soft:#edf1ff; --mfn-green:#8bc53f; --mfn-orange:#f15a24; --mfn-bg:#f5f7fb; --mfn-surface:#fff; --mfn-surface-soft:#f9fbff; --mfn-line:#e2e7f0; --mfn-ink:#17213d; --mfn-muted:#75809a; --mfn-shadow:0 18px 48px rgba(31,52,115,.12); --mfn-radius:16px; --mfn-sidebar-width:284px; --font:"Segoe UI",Inter,system-ui,-apple-system,sans-serif; }
* { box-sizing:border-box; }
html,body { min-height:100%; }
body { margin:0; color:var(--mfn-ink); background:var(--mfn-bg); font-family:var(--font); font-size:14px; -webkit-font-smoothing:antialiased; }
button,input { font:inherit; }
/* Global: todo dxPopup scrollea su contenido en vez de recortarlo */
.dx-popup-content { overflow-y:auto; overflow-x:hidden; }
.mfn-muted { color:var(--mfn-muted); }
.mfn-login { position:fixed; inset:0; z-index:100; display:grid; grid-template-columns:minmax(0,1.1fr) minmax(390px,.9fr); overflow:auto; background:linear-gradient(135deg,#1f2e73 0%,#2d3f91 54%,#1b7caf 100%); }
.mfn-login__brand { position:relative; display:flex; align-items:center; justify-content:center; min-height:100vh; padding:64px; overflow:hidden; color:#fff; }
.mfn-login__brand::before,.mfn-login__brand::after { position:absolute; border-radius:50%; content:""; pointer-events:none; }
.mfn-login__brand::before { width:520px; height:520px; right:-210px; top:-160px; border:1px solid rgba(255,255,255,.18); box-shadow:0 0 0 36px rgba(255,255,255,.04),0 0 0 72px rgba(255,255,255,.03); }
.mfn-login__brand::after { width:340px; height:340px; left:-170px; bottom:-150px; background:rgba(139,197,63,.16); }
.mfn-login__brand-content { position:relative; z-index:1; width:min(100%,620px); }
.mfn-login__logo-wrap { display:inline-flex; align-items:center; justify-content:center; width:190px; height:190px; margin-bottom:36px; padding:18px; border-radius:32px; background:#fff; box-shadow:0 20px 42px rgba(9,22,73,.24); }
.mfn-login__logo-wrap img { display:block; width:100%; height:100%; object-fit:contain; }
.mfn-login__eyebrow { margin:0 0 12px; color:#cfe6ff; font-size:12px; font-weight:700; letter-spacing:1.8px; text-transform:uppercase; }
.mfn-login__brand h2 { max-width:560px; margin:0 0 18px; font-size:clamp(32px,4vw,56px); font-weight:700; letter-spacing:-1.8px; line-height:1.05; }
.mfn-login__brand p { max-width:520px; margin:0; color:rgba(255,255,255,.78); font-size:17px; line-height:1.65; }
.mfn-login__panel { display:flex; align-items:center; justify-content:center; min-height:100vh; padding:40px; background:rgba(255,255,255,.97); }
#loginCard { width:min(100%,430px); padding:42px; border:1px solid rgba(226,231,240,.9); border-radius:24px; background:var(--mfn-surface); box-shadow:var(--mfn-shadow); }
.mfn-login__mobile-logo { display:none; }
#loginCard h1 { margin:0 0 8px; color:var(--mfn-ink); font-size:28px; letter-spacing:-.7px; }
#loginCard p { margin:0 0 30px; color:var(--mfn-muted); line-height:1.5; }
#loginForm .dx-field-label { color:var(--mfn-ink); font-weight:600; }
#loginForm .dx-texteditor { border-radius:10px; }
#loginForm .dx-texteditor.dx-state-focused { box-shadow:0 0 0 3px rgba(45,63,145,.12); }
.mfn-login__hint { margin-top:20px; color:var(--mfn-muted); font-size:12px; line-height:1.5; text-align:center; }
.mfn-login__hint strong { color:var(--mfn-primary); }
#loginErr { min-height:20px; margin:16px 0 8px; color:#b2392d; font-size:13px; line-height:1.45; text-align:center; }
#btnEntrar .dx-button { width:100%; min-height:48px; border:0; border-radius:10px; background:var(--mfn-primary); box-shadow:0 10px 22px rgba(45,63,145,.22); font-size:15px; font-weight:700; }
#btnEntrar .dx-button:hover { background:var(--mfn-primary-strong); }
.mfn-shell { display:none; min-height:100vh; background:var(--mfn-bg); }
#drawer,#drawer .dx-drawer-wrapper,#drawer .dx-drawer-panel-content { min-height:100vh; }
#drawer .dx-drawer-panel-content { width:var(--mfn-sidebar-width); border:0; background:var(--mfn-surface); box-shadow:10px 0 30px rgba(26,43,91,.04); }
#drawer .dx-drawer-content { min-width:0; background:var(--mfn-bg); }
.mfn-sidebar { display:flex; flex-direction:column; min-height:100vh; padding:22px 16px 16px; }
.mfn-sidebar__brand { display:flex; align-items:center; gap:12px; padding:0 10px 25px; }
.mfn-sidebar__brand img { width:44px; height:44px; padding:4px; border-radius:12px; object-fit:contain; background:#fff; box-shadow:0 6px 16px rgba(45,63,145,.13); }
.mfn-sidebar__brand-copy { min-width:0; }
.mfn-sidebar__brand-name { color:var(--mfn-primary); font-size:17px; font-weight:800; letter-spacing:-.35px; }
.mfn-sidebar__brand-subtitle { color:var(--mfn-muted); font-size:11px; }
.mfn-sidebar__label { margin:0 10px 8px; color:var(--mfn-muted); font-size:10px; font-weight:800; letter-spacing:1.4px; text-transform:uppercase; }
#nav { min-height:0; flex:1; }
#nav .dx-treeview { background:transparent; color:var(--mfn-ink); }
#nav .dx-treeview-node { padding:2px 0; }
#nav .dx-treeview-item { min-height:42px; padding:10px 12px; border-radius:10px; font-size:13px; }
#nav .dx-treeview-item-without-checkbox.dx-state-hover { background:var(--mfn-surface-soft); }
#nav .dx-treeview-item-without-checkbox.dx-state-focused { background:var(--mfn-primary-soft); }
#nav .dx-treeview-item-without-checkbox.dx-state-selected { background:var(--mfn-primary); color:#fff; }
#nav .dx-treeview-item-without-checkbox.dx-state-selected .dx-icon,#nav .dx-treeview-item-without-checkbox.dx-state-selected .dx-treeview-toggle-item-visibility { color:#fff; }
#nav .dx-treeview-toggle-item-visibility { color:var(--mfn-muted); }
#nav .dx-treeview-node-is-leaf>.dx-treeview-item { margin-left:22px; }
#nav .dx-treeview-node-is-leaf>.dx-treeview-item .dx-treeview-item-content { font-weight:500; }
#nav .dx-treeview-node:not(.dx-treeview-node-is-leaf)>.dx-treeview-item .dx-treeview-item-content { font-weight:700; }
.mfn-sidebar__footer { display:flex; align-items:center; gap:10px; margin-top:18px; padding:12px 10px 2px; border-top:1px solid var(--mfn-line); }
.mfn-sidebar__footer-mark { display:grid; width:31px; height:31px; flex:0 0 auto; place-items:center; border-radius:50%; background:var(--mfn-primary-soft); color:var(--mfn-primary); font-size:12px; font-weight:800; }
.mfn-sidebar__footer-copy { min-width:0; }
.mfn-sidebar__footer-name { overflow:hidden; color:var(--mfn-ink); font-size:12px; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.mfn-sidebar__footer-role { color:var(--mfn-muted); font-size:11px; }
.mfn-main { display:flex; min-width:0; min-height:100vh; flex:1; flex-direction:column; }
.mfn-topbar { display:flex; align-items:center; gap:12px; min-height:76px; padding:14px 28px; border-bottom:1px solid var(--mfn-line); background:rgba(255,255,255,.92); backdrop-filter:blur(14px); }
#btnMenu { display:none; }
#btnMenu .dx-button,#btnSalir .dx-button { border-radius:9px; }
.mfn-topbar__heading { min-width:180px; flex:1; }
.mfn-topbar__eyebrow { margin-bottom:2px; color:var(--mfn-muted); font-size:11px; }
#secTitulo { color:var(--mfn-ink); font-size:21px; font-weight:750; letter-spacing:-.5px; }
#globalSearch { width:min(260px,24vw); }
#globalSearch .dx-texteditor { border:1px solid var(--mfn-line); border-radius:10px; background:var(--mfn-surface-soft); }
#globalSearch .dx-texteditor-input { font-size:12px; }
#cajaTema { width:154px; }
#cajaTema .dx-texteditor { border-radius:9px; }
.mfn-user { display:flex; align-items:center; gap:9px; min-width:0; max-width:190px; }
.mfn-user__avatar { display:grid; width:34px; height:34px; flex:0 0 auto; place-items:center; border-radius:50%; background:linear-gradient(135deg,var(--mfn-primary),#4a68cc); color:#fff; font-size:12px; font-weight:800; }
.mfn-user__copy { min-width:0; }
.mfn-user__name { overflow:hidden; color:var(--mfn-ink); font-size:12px; font-weight:700; text-overflow:ellipsis; white-space:nowrap; }
.mfn-user__role { overflow:hidden; color:var(--mfn-muted); font-size:11px; text-overflow:ellipsis; white-space:nowrap; }
.mfn-content { min-width:0; flex:1; padding:30px 32px 40px; }
.mfn-page-intro { margin-bottom:24px; }
.mfn-page-intro h2 { margin:0 0 6px; color:var(--mfn-ink); font-size:25px; letter-spacing:-.6px; }
.mfn-page-intro p { margin:0; color:var(--mfn-muted); line-height:1.55; }
.mfn-panel { border:1px solid var(--mfn-line); border-radius:var(--mfn-radius); background:var(--mfn-surface); box-shadow:0 8px 26px rgba(31,52,115,.04); }
.mfn-dashboard__welcome { position:relative; display:flex; align-items:center; justify-content:space-between; gap:24px; min-height:185px; margin-bottom:24px; padding:30px 34px; overflow:hidden; border-radius:20px; background:linear-gradient(110deg,#25377f,#2e4caa 62%,#1b7eae); color:#fff; box-shadow:0 18px 32px rgba(37,55,127,.2); }
.mfn-dashboard__welcome::after { position:absolute; right:38px; width:190px; height:190px; border:24px solid rgba(139,197,63,.35); border-radius:50%; content:""; }
.mfn-dashboard__welcome-copy { position:relative; z-index:1; }
.mfn-dashboard__welcome-copy .eyebrow { margin-bottom:8px; color:#cce7ff; font-size:11px; font-weight:800; letter-spacing:1.2px; text-transform:uppercase; }
.mfn-dashboard__welcome h2 { margin:0 0 8px; font-size:clamp(24px,3vw,34px); letter-spacing:-.9px; }
.mfn-dashboard__welcome p { max-width:610px; margin:0; color:rgba(255,255,255,.78); line-height:1.55; }
.mfn-dashboard__welcome .dx-button { position:relative; z-index:2; border:0; border-radius:9px; background:#fff; color:var(--mfn-primary); font-weight:700; }
.mfn-dashboard__grid { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(300px,.7fr); gap:24px; }
.mfn-dashboard__section { padding:24px; }
.mfn-dashboard__section h3 { margin:0 0 5px; color:var(--mfn-ink); font-size:17px; }
.mfn-dashboard__section>p { margin:0 0 18px; color:var(--mfn-muted); font-size:13px; }
.mfn-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.mfn-actions .dx-button { min-height:60px; justify-content:flex-start; border:1px solid var(--mfn-line); border-radius:12px; background:var(--mfn-surface-soft); color:var(--mfn-ink); text-align:left; }
.mfn-actions .dx-button:hover { border-color:var(--mfn-primary); background:var(--mfn-primary-soft); color:var(--mfn-primary); }
.mfn-actions .dx-button .dx-button-content { justify-content:flex-start; gap:10px; }
.mfn-actions .dx-icon { color:var(--mfn-primary); }
.mfn-module-list .dx-list-item { border-bottom:1px solid var(--mfn-line); }
.mfn-module-list .dx-list-item:last-child { border-bottom:0; }
.mfn-module-item { display:flex; align-items:center; gap:12px; padding:10px 2px; }
.mfn-module-item__icon { display:grid; width:34px; height:34px; place-items:center; border-radius:10px; background:var(--mfn-primary-soft); color:var(--mfn-primary); }
.mfn-module-item__copy { min-width:0; }
.mfn-module-item__name { display:block; color:var(--mfn-ink); font-weight:700; }
.mfn-module-item__hint { display:block; color:var(--mfn-muted); font-size:12px; }
.mfn-grid-panel { padding:18px; }
.mfn-grid-panel .dx-datagrid { border:0; }
.mfn-grid-panel .dx-datagrid-headers { border-radius:10px 10px 0 0; background:var(--mfn-surface-soft); }
.mfn-grid-panel .dx-datagrid-rowsview { border-radius:0 0 10px 10px; }
.mfn-grid-toolbar-title { color:var(--mfn-ink); font-size:17px; font-weight:750; }
.mfn-loading { color:var(--mfn-primary); font-size:14px; }
@media (max-width:1100px) { .mfn-topbar{padding-inline:20px}.mfn-content{padding-inline:22px}#globalSearch{width:190px}.mfn-dashboard__grid{grid-template-columns:1fr} }
@media (max-width:820px) { .mfn-login{display:block}.mfn-login__brand{display:none}.mfn-login__panel{min-height:100vh;padding:22px}.mfn-login__mobile-logo{display:block;width:105px;height:105px;margin:0 auto 22px;padding:10px;border-radius:22px;background:#fff;box-shadow:var(--mfn-shadow)}.mfn-login__mobile-logo img{width:100%;height:100%;object-fit:contain}#loginCard{padding:30px 24px}#drawer .dx-drawer-panel-content{width:min(86vw,284px)}.mfn-topbar{min-height:68px;padding:12px 14px}#btnMenu{display:block}.mfn-topbar__heading{min-width:0}#secTitulo{font-size:18px}#globalSearch,#cajaTema{display:none}.mfn-user{display:none}.mfn-content{padding:20px 14px 30px}.mfn-dashboard__welcome{align-items:flex-start;flex-direction:column;min-height:240px;padding:25px}.mfn-dashboard__welcome::after{right:-50px;bottom:-78px} }
@media (max-width:520px) { .mfn-actions{grid-template-columns:1fr}.mfn-login__panel{padding:14px}#loginCard{border-radius:18px} }

/* Permisos por tipo documental en la ficha de usuario */
.mfn-user-doctypes { margin-top:8px; }
.mfn-user-doctypes .dx-datagrid { border-radius:10px; }
.mfn-user-doctypes .dx-datagrid-headers { font-size:12px; }
.mfn-user-doctypes.dx-state-disabled, .mfn-user-doctypes .dx-state-disabled { opacity:.5; }

.mfn-user-popup .dx-popup-content > * { min-width:0; }
.mfn-user-popup .mfn-form-section-title { margin:18px 0 4px; }
.mfn-user-popup .mfn-user-permissions { display:grid; gap:10px; }
/* La barra de botones del popup es fija: sin este colchon tapa las ultimas filas */
.mfn-user-popup .dx-popup-content { padding-bottom:18px; }
.mfn-user-popup .mfn-user-doctypes { margin-bottom:8px; }
