:root{
  --surface-ground:#f4f6f9; --surface-card:#fff; --surface-border:#e2e8f0;
  --text:#1f2937; --text-muted:#64748b; --brand:#2563eb; --brand-dark:#1d4ed8;
  --thead:#858c99;
}
html{font-size:14px}
body{font-family:'Lato','Segoe UI',system-ui,sans-serif;background:var(--surface-ground);
     color:var(--text);line-height:1.35;-webkit-font-smoothing:antialiased;margin:0}
*:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:4px}
a{text-decoration:none;color:inherit}

/* ---------- barra del shell ---------- */
.shellbar{background:#fff;border-bottom:1px solid var(--surface-border)}
.shellbar .navlink{font-size:13px;color:#475569;padding:.4rem .7rem;border-radius:.375rem}
.shellbar .navlink:hover{background:#f1f5f9;color:#0f172a}
.shellbar .navlink.on{background:#eff6ff;color:var(--brand-dark);font-weight:700}

/* ---------- ribbon (calcado de tskl-ribbon) ---------- */
.ribbon-head{background:#fff;border-bottom:1px solid #e5e7eb;padding:.375rem .75rem;
  display:flex;align-items:center;gap:1rem;flex-wrap:wrap}
.ribbon-tabs{display:flex;gap:.25rem;background:#f3f4f6;border-radius:.5rem;padding:.125rem}
.ribbon-tab{padding:.25rem .75rem;font-size:12px;font-weight:600;border-radius:.375rem;color:#4b5563;
  display:inline-flex;align-items:center;gap:.3rem;border:0;background:transparent;cursor:pointer}
.ribbon-tab:hover{background:#e5e7eb}
.ribbon-tab.on{background:#fff;color:var(--brand-dark);box-shadow:0 1px 2px rgba(0,0,0,.08)}
.ribbon-panels{background:#f9fafb;border-bottom:1px solid #e5e7eb}
.ribbon-panel{display:flex;align-items:stretch;padding:.5rem;gap:.25rem;flex-wrap:wrap}
.ribbon-group{display:flex;flex-direction:column;justify-content:space-between;
  padding:0 .75rem;border-right:2px solid #e5e7eb}
.ribbon-group:last-child{border-right:0}
.ribbon-group .row{display:flex;align-items:center;gap:.25rem;margin-bottom:.25rem}
.ribbon-group .lbl{font-size:10px;color:#9ca3af;text-align:center;text-transform:uppercase;
  letter-spacing:.05em;margin-top:auto}
.ribbon-group .lbl{color:#6b7280}
.rbtn{display:flex;flex-direction:column;align-items:center;gap:.1rem;padding:.25rem .55rem;
  border-radius:.375rem;color:#4b5563;border:0;background:transparent;cursor:pointer;min-width:56px}
.rbtn:hover{background:#f1f5f9}
.rbtn span{font-size:10px;line-height:1.1;text-align:center}
.rbtn.acc{color:var(--brand-dark)} .rbtn.acc:hover{background:#eff6ff}
.rbtn[aria-disabled="true"]{color:#cbd5e1;cursor:not-allowed}

/* ---------- superficies ---------- */
.card{background:#fff;border:1px solid var(--surface-border);border-radius:.75rem;
  box-shadow:0 1px 2px rgba(15,23,42,.04)}
.sect-title{display:flex;align-items:center;gap:.5rem;font-size:13px;font-weight:700;color:#334155;
  border-bottom:1px solid var(--surface-border);padding-bottom:.4rem;margin-bottom:.75rem}
.sect-title svg{color:#94a3b8}

/* ---------- tabla (calcada de app-tskl-table, densidad compacta) ---------- */
.ptable{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px}
.ptable thead th{background:var(--thead);color:#fff;font-weight:700;font-size:11px;
  text-transform:uppercase;letter-spacing:.04em;padding:6px 8px;text-align:left;
  white-space:nowrap;border-bottom:1px solid #374151;vertical-align:bottom}
.ptable thead th.sub{background:#5b6573;font-weight:600;text-transform:none;letter-spacing:0;font-size:10.5px}
.ptable tbody td{padding:5px 8px;border-bottom:1px solid #eef2f7;vertical-align:middle;
  color:#334155;white-space:nowrap}
.ptable tbody tr:hover td{background:#f8fafc}
.ptable tbody tr.zebra td{background:#f6f8fb}
.ptable tbody tr:hover td,.ptable tbody tr.zebra:hover td{background:#eff6ff}
.ptable .num{text-align:right;font-variant-numeric:tabular-nums}
.ptable .lnum{font-variant-numeric:tabular-nums}
/* Tailwind pierde por especificidad contra `.ptable thead th`: se repite aca. */
.ptable thead th.text-right{text-align:right}
.ptable thead th.text-center{text-align:center}
.ptable .grp td{background:#eef2ff;color:#3730a3;font-weight:700;font-size:11px;
  text-transform:uppercase;letter-spacing:.04em}
.ptable tbody tr:last-child td{border-bottom:0}
.tbl-wrap{background:#fff;border:1px solid var(--surface-border);border-radius:.5rem;overflow:auto}
.tfoot{display:flex;align-items:center;justify-content:space-between;padding:.4rem .75rem;
  border-top:1px solid var(--surface-border);font-size:11.5px;color:var(--text-muted);background:#fcfdfe}

/* ---------- chips / tags (p-tag Aura) ---------- */
.tag{display:inline-flex;align-items:center;gap:.25rem;border-radius:.375rem;padding:.1rem .4rem;
  font-size:11px;font-weight:700;line-height:1.4;white-space:nowrap}
.tag svg{width:12px;height:12px}
.t-ok{background:#dcfce7;color:#15803d}
.t-warn{background:#fef3c7;color:#92400e}
.t-err{background:#fee2e2;color:#b91c1c}
.t-info{background:#dbeafe;color:#1d4ed8}
.t-sec{background:#eef2f7;color:#475569}
.t-tbc{background:#fff7ed;color:#c2410c;border:1px dashed #fdba74}

/* ---------- botones (p-button Aura) ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.4rem;border-radius:.375rem;
  font-size:12.5px;font-weight:700;padding:.4rem .75rem;border:1px solid transparent;cursor:pointer;
  line-height:1.25;min-height:32px}
.btn-p{background:var(--brand);color:#fff}.btn-p:hover{background:var(--brand-dark)}
.btn-s{background:#fff;color:#334155;border-color:#cbd5e1}.btn-s:hover{background:#f8fafc}
.btn-t{background:transparent;color:#475569}.btn-t:hover{background:#f1f5f9}
.btn-d{background:#fff;color:#b91c1c;border-color:#fca5a5}.btn-d:hover{background:#fef2f2}
.btn-ok{background:#16a34a;color:#fff}.btn-ok:hover{background:#15803d}
.btn:disabled,.btn[aria-disabled="true"]{opacity:.5;cursor:not-allowed}
.btn-sm{font-size:11.5px;padding:.25rem .55rem;min-height:26px}
.iconbtn{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;
  border-radius:.375rem;color:#64748b;border:0;background:transparent;cursor:pointer}
.iconbtn:hover{background:#f1f5f9;color:#1e293b}

/* ---------- formularios ---------- */
.fld{display:flex;flex-direction:column;gap:.25rem}
.fld > label,.fld > .lbl{font-size:12px;font-weight:700;color:#334155;display:flex;
  align-items:center;gap:.4rem}
.req{color:#dc2626}
.inp{width:100%;border:1px solid #cbd5e1;border-radius:.375rem;padding:.4rem .55rem;
  font-size:13px;color:#1f2937;background:#fff;font-family:inherit}
.inp::placeholder{color:#7d8ba1}
.inp:focus{outline:2px solid var(--brand);outline-offset:0;border-color:var(--brand)}
.inp[readonly],.inp:disabled{background:#f8fafc;color:#475569}
.inp.bad{border-color:#dc2626;background:#fef2f2}
.hint{font-size:11px;color:#64748b}
.errtx{font-size:11px;color:#b91c1c;font-weight:700;display:flex;align-items:center;gap:.25rem}
.lockmsg{font-size:11px;color:#b45309}
/* autocompletar de catalogo (p-autocomplete con dropdown) */
.pac{display:flex;width:100%}
.pac .inp{border-top-right-radius:0;border-bottom-right-radius:0;border-right:0}
.pac .drop{display:inline-flex;align-items:center;justify-content:center;width:32px;
  border:1px solid #cbd5e1;border-top-right-radius:.375rem;border-bottom-right-radius:.375rem;
  background:#f8fafc;color:#475569;cursor:pointer}
.pac .drop:hover{background:#f1f5f9}
.pac.bad .inp,.pac.bad .drop{border-color:#dc2626}
.pac.bad .inp{background:#fef2f2}
/* seleccion multiple tipo p-multiselect con chips */
.chipbox{display:flex;flex-wrap:wrap;gap:.3rem;border:1px solid #cbd5e1;border-radius:.375rem;
  padding:.35rem .45rem;background:#fff;min-height:34px;align-items:center}
.chipbox .tag{background:#eff6ff;color:#1d4ed8}
.chk{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;
  border:1.5px solid #94a3b8;border-radius:4px;background:#fff;flex:none}
.chk.on{background:var(--brand);border-color:var(--brand);color:#fff}
.chk.on svg{width:12px;height:12px}

/* ---------- mensajes (p-message) ---------- */
.msg{display:flex;gap:.6rem;border-radius:.5rem;padding:.6rem .75rem;font-size:12.5px;
  border:1px solid transparent;align-items:flex-start}
.msg svg{flex:none;margin-top:1px}
.m-err{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.m-warn{background:#fffbeb;border-color:#fde68a;color:#92400e}
.m-info{background:#eff6ff;border-color:#bfdbfe;color:#1e40af}
.m-ok{background:#f0fdf4;border-color:#bbf7d0;color:#166534}

/* ---------- dialogo (p-dialog) ---------- */
.dlg-mask{background:rgba(15,23,42,.45)}
.dlg{background:#fff;border-radius:.75rem;box-shadow:0 20px 50px rgba(15,23,42,.35);overflow:hidden}
.dlg-head{display:flex;align-items:center;gap:.65rem;padding:.7rem 1rem;border-bottom:1px solid var(--surface-border)}
.dlg-head .ico{width:32px;height:32px;border-radius:.5rem;display:flex;align-items:center;justify-content:center}
.dlg-foot{display:flex;align-items:center;justify-content:flex-end;gap:.6rem;padding:.7rem 1rem;
  border-top:1px solid var(--surface-border);background:#fcfdfe}

/* ---------- pasos / stepper ---------- */
.step{display:flex;align-items:center;gap:.5rem;font-size:12px}
.step .n{width:22px;height:22px;border-radius:999px;display:flex;align-items:center;justify-content:center;
  font-size:11px;font-weight:700;background:#e2e8f0;color:#475569;flex:none}
.step.done .n{background:#16a34a;color:#fff}
.step.now .n{background:var(--brand);color:#fff}

.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0,0,0,0);white-space:nowrap;border:0}
.skip{position:absolute;left:-999px;top:0;z-index:60;background:#fff;padding:.5rem .9rem;
  border:2px solid var(--brand);border-radius:.375rem;font-weight:700;font-size:13px}
.skip:focus{left:.5rem;top:.5rem}
@media print{.noprint{display:none}}

/* ======================================================================
   Agregados del núcleo (carril A): shell naia, tabla real, modal, toast,
   catálogo, paginador.
   ====================================================================== */
.ptable thead th{background:#858c99;border-bottom:1px solid #6b7280;border-right:1px solid #9aa1ad}
.ptable tbody td{border-bottom:1px solid #e5e7eb;border-right:1px solid #eef0f3}
.ptable thead th:last-child,.ptable tbody td:last-child{border-right:0}

/* --- shell: barra superior y lateral --- */
body.vp-shell{padding-left:48px;padding-top:48px}
.vp-top{position:fixed;top:0;left:0;right:0;height:48px;background:#fff;border-bottom:1px solid #e5e7eb;
  display:flex;align-items:stretch;z-index:50;font-size:13px}
.vp-logo{width:48px;display:flex;align-items:center;justify-content:center;border-right:1px solid #e5e7eb;flex:none}
.vp-brand{display:flex;align-items:center;gap:.5rem;padding:0 .75rem;font-weight:700;color:#0f172a;flex:none}
.vp-brand .ico{width:24px;height:24px;border-radius:.375rem;border:1px solid #c7d2fe;background:#eef2ff;color:#4f46e5;
  display:flex;align-items:center;justify-content:center}
.vp-brand .sep{color:#cbd5e1}
.vp-menu{display:flex;align-items:stretch;gap:0;flex:1;min-width:0;overflow:visible}
.vp-mi{position:relative;display:flex;align-items:stretch}
.vp-mb{display:flex;align-items:center;gap:.4rem;padding:0 .7rem;color:#475569;border:0;background:transparent;
  cursor:pointer;font:inherit;white-space:nowrap;border-bottom:2px solid transparent}
.vp-mb:hover{color:#1d4ed8;background:#f8fafc}
.vp-mb svg{width:15px;height:15px}
.vp-mb .chev{width:12px;height:12px;opacity:.7}
.vp-mi.on>.vp-mb{color:#1d4ed8;background:#eff6ff;border-bottom-color:#2563eb;font-weight:700}
.vp-dd{position:absolute;top:100%;left:0;min-width:230px;background:#fff;border:1px solid #e5e7eb;border-radius:.5rem;
  box-shadow:0 10px 30px rgba(15,23,42,.15);padding:.3rem;display:none;z-index:60}
.vp-mi.open>.vp-dd{display:block}
.vp-dd a,.vp-dd button{display:flex;align-items:center;gap:.5rem;width:100%;text-align:left;padding:.45rem .6rem;
  border-radius:.375rem;color:#334155;font-size:13px;border:0;background:transparent;cursor:pointer;font-family:inherit}
.vp-dd a:hover,.vp-dd button:hover{background:#f1f5f9;color:#1d4ed8}
.vp-dd a.on,.vp-dd button.on{background:#eff6ff;color:#1d4ed8;font-weight:700}
.vp-dd .ext{margin-left:auto;color:#94a3b8;width:12px;height:12px}
.vp-dd .hd{font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:#94a3b8;padding:.35rem .6rem .2rem;font-weight:700}
.vp-right{display:flex;align-items:center;gap:.6rem;padding:0 .75rem;flex:none}
.vp-alc{display:flex;align-items:center;gap:.4rem;border:1px dashed #cbd5e1;border-radius:.375rem;padding:.35rem .7rem;
  color:#475569;background:#fff;cursor:pointer;font:inherit;font-size:13px;max-width:240px}
.vp-alc:hover{background:#f8fafc}
.vp-alc.set{border-style:solid;border-color:#93c5fd;color:#1d4ed8;background:#eff6ff}
.vp-alc span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.vp-av{width:30px;height:30px;border-radius:999px;background:#dbeafe;color:#1d4ed8;font-weight:700;font-size:12px;
  display:flex;align-items:center;justify-content:center;border:0;cursor:pointer}
.vp-pop{position:absolute;top:calc(100% + 4px);right:0;background:#fff;border:1px solid #e5e7eb;border-radius:.5rem;
  box-shadow:0 10px 30px rgba(15,23,42,.15);padding:.3rem;min-width:240px;z-index:60;display:none}
.vp-pop.open{display:block}
.vp-side{position:fixed;top:48px;left:0;bottom:0;width:48px;background:#fff;border-right:1px solid #e5e7eb;
  display:flex;flex-direction:column;align-items:center;padding:.5rem 0;gap:.25rem;z-index:45}
.vp-side a{width:48px;height:40px;display:flex;align-items:center;justify-content:center;color:#64748b;position:relative}
.vp-side a:hover{color:#1d4ed8;background:#f8fafc}
.vp-side a.on{color:#2563eb;background:#eff6ff}
.vp-side a.on::before{content:"";position:absolute;left:0;top:6px;bottom:6px;width:3px;background:#2563eb;border-radius:0 2px 2px 0}
.vp-side svg{width:17px;height:17px}
.vp-side .grow{flex:1}
@media (max-width:900px){.vp-mb .lbl{display:none}.vp-brand .txt{display:none}}

/* --- cabecera de lista (ribbon real) --- */
.vp-lh{background:#fff;margin:.75rem .75rem 0;border:1px solid #e5e7eb;border-radius:.5rem .5rem 0 0}
.vp-lh .ribbon-head{border-radius:.5rem .5rem 0 0}
.vp-lh h1{font-size:15px;font-weight:900;color:#0f172a}
.vp-lh .cnt{font-size:12px;color:#64748b}
.vp-lh .ribbon-panels{border-radius:0}
.vp-lh .rbtn svg{width:18px;height:18px}
.vp-resumen{display:flex;flex-direction:column;justify-content:center;padding:.25rem .9rem;border:1px solid #e5e7eb;
  border-radius:.5rem;background:#fff;min-width:180px;font-size:12px;color:#475569}
.vp-resumen b{color:#0f172a;font-size:14px}

/* --- paginador --- */
.vp-pager{display:flex;align-items:center;gap:.35rem;padding:.5rem .75rem;border-top:1px solid #e5e7eb;background:#fff;
  font-size:13px;color:#475569;flex-wrap:wrap}
.vp-pager .pg{min-width:32px;height:32px;border-radius:999px;border:0;background:transparent;color:#475569;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;font:inherit}
.vp-pager .pg:hover:not(:disabled){background:#f1f5f9}
.vp-pager .pg.on{background:#ecfdf5;color:#047857;font-weight:700}
.vp-pager .pg:disabled{color:#cbd5e1;cursor:default}
.vp-pager select{border:1px solid #cbd5e1;border-radius:.375rem;padding:.3rem .4rem;font:inherit;background:#fff}
.vp-pager .tot{margin-left:auto;font-size:12px;color:#64748b}

/* --- insignias de estado (alias) --- */
.badge{display:inline-flex;align-items:center;gap:.25rem;border-radius:.375rem;padding:.15rem .5rem;font-size:12px;font-weight:700;white-space:nowrap}
.badge svg{width:12px;height:12px}
.b-vigente{background:#dcfce7;color:#15803d}
.b-borrador{background:#eef2f7;color:#475569}
.b-vencido{background:#fee2e2;color:#b91c1c}
.b-porvencer{background:#fef3c7;color:#92400e}
.b-info{background:#dbeafe;color:#1d4ed8}

/* --- modal --- */
.vp-mask{position:fixed;inset:0;background:rgba(15,23,42,.45);display:flex;align-items:center;justify-content:center;padding:1rem}
.vp-dlg{background:#fff;border-radius:.75rem;box-shadow:0 20px 50px rgba(15,23,42,.35);width:100%;max-height:calc(100vh - 2rem);
  display:flex;flex-direction:column;overflow:hidden;animation:vpin .14s ease-out}
.vp-dlg.max{max-width:none!important;width:100%;height:calc(100vh - 2rem)}
.vp-dlg-h{display:flex;align-items:center;gap:.7rem;padding:1rem 1.1rem .6rem}
.vp-dlg-h .ico{width:32px;height:32px;border-radius:999px;background:#9333ea;color:#fff;display:flex;align-items:center;justify-content:center;flex:none}
.vp-dlg-h .ico svg{width:17px;height:17px}
.vp-dlg-h h2{font-size:20px;font-weight:700;color:#9333ea;flex:1}
.vp-dlg-b{padding:.25rem 1.1rem 1rem;overflow:auto;flex:1}
.vp-dlg-f{display:flex;justify-content:flex-end;align-items:center;gap:.6rem;padding:.7rem 1.1rem;border-top:1px solid #f1f5f9}
.vp-dlg-f .btn-cancel{background:transparent;border:0;color:#475569;font-size:14px;padding:.5rem .9rem;cursor:pointer;
  display:inline-flex;align-items:center;gap:.35rem;font-family:inherit;border-radius:.375rem}
.vp-dlg-f .btn-cancel:hover{background:#f1f5f9}
.vp-dlg-f .btn-save{background:#22c55e;color:#fff;border:0;font-size:14px;font-weight:700;padding:.55rem 1.1rem;cursor:pointer;
  border-radius:.375rem;display:inline-flex;align-items:center;gap:.35rem;font-family:inherit}
.vp-dlg-f .btn-save:hover{background:#16a34a}
.vp-errs{margin-bottom:.75rem}
.vp-errs ul{list-style:disc;padding-left:1.1rem;margin-top:.2rem}
.sec{display:flex;align-items:center;gap:.5rem;font-size:13.5px;font-weight:700;color:#1e293b;padding:.4rem 0;
  border-bottom:1px solid #e5e7eb;margin:.6rem 0 .6rem}
@keyframes vpin{from{opacity:0;transform:translateY(6px) scale(.99)}to{opacity:1;transform:none}}

/* --- toast --- */
.vp-toasts{position:fixed;top:58px;right:14px;z-index:9999;display:flex;flex-direction:column;gap:.5rem;width:340px;max-width:calc(100vw - 28px)}
.vp-toast{display:flex;gap:.6rem;align-items:flex-start;background:#fff;border:1px solid #e5e7eb;border-left:4px solid #2563eb;
  border-radius:.5rem;box-shadow:0 8px 24px rgba(15,23,42,.15);padding:.65rem .75rem;font-size:13px;color:#1e293b;animation:vpin .15s ease-out}
.vp-toast svg{width:18px;height:18px;flex:none;margin-top:1px}
.vp-toast.ok{border-left-color:#16a34a}.vp-toast.ok svg{color:#16a34a}
.vp-toast.error{border-left-color:#dc2626}.vp-toast.error svg{color:#dc2626}
.vp-toast.warn{border-left-color:#d97706}.vp-toast.warn svg{color:#d97706}
.vp-toast.info svg{color:#2563eb}
.vp-toast .x{margin-left:auto;border:0;background:transparent;color:#94a3b8;cursor:pointer}

/* --- catálogo (autocompletar) --- */
.vp-cat{position:relative;width:100%}
.vp-cat-list{position:absolute;left:0;right:0;top:calc(100% + 2px);background:#fff;border:1px solid #cbd5e1;border-radius:.375rem;
  box-shadow:0 10px 24px rgba(15,23,42,.14);max-height:220px;overflow:auto;z-index:10000;padding:.2rem;display:none}
.vp-cat-list.open{display:block}
.vp-cat-list div{padding:.4rem .55rem;border-radius:.3rem;cursor:pointer;font-size:13px;color:#334155}
.vp-cat-list div:hover,.vp-cat-list div.act{background:#eff6ff;color:#1d4ed8}
.vp-cat-list div.add{color:#047857;font-weight:700;border-top:1px solid #f1f5f9}
.vp-cat-list div.empty{color:#94a3b8;cursor:default}
/* QA: como máximo 3 avisos visibles */
.vp-toasts .vp-toast:nth-last-child(n+4){display:none}
