/* CÓDICE ERP 0.1.0 · Un sistema desarrollado por CISTI */
:root{
  --navy:#0E1B33;--navy-2:#16284A;--navy-3:#22375F;--cyan:#0EA5E9;--cyan-2:#38BDF8;--gold:#F2B33D;
  --purple:#6D28D9;--purple-2:#5B21B6;--red:#DC2626;--green:#16A34A;--amber:#D97706;--blue:#2563EB;
  --bg:#F4F6FA;--surface:#FFFFFF;--surface-2:#F8FAFC;--border:#E2E8F0;--border-2:#CBD5E1;
  --text:#0E1B33;--text-2:#475569;--muted:#64748B;--ring:rgba(14,165,233,.35);
  --shadow:0 1px 2px rgba(14,27,51,.06),0 4px 16px rgba(14,27,51,.06);
  --radius:14px;--btn-r:10px;--side:264px;
  --font:"Inter","Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="claro"]){--bg:#0B1324;--surface:#111C33;--surface-2:#0F1930;--border:#22314F;--border-2:#2E4166;--text:#E6ECF5;--text-2:#B6C2D6;--muted:#8A9AB5;--shadow:0 1px 2px rgba(0,0,0,.4);color-scheme:dark}}
:root[data-theme="oscuro"]{--bg:#0B1324;--surface:#111C33;--surface-2:#0F1930;--border:#22314F;--border-2:#2E4166;--text:#E6ECF5;--text-2:#B6C2D6;--muted:#8A9AB5;--shadow:0 1px 2px rgba(0,0,0,.4);color-scheme:dark}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;font:14px/1.5 var(--font);color:var(--text);background:var(--bg)}
a{color:var(--cyan);text-decoration:none}a:hover{text-decoration:underline}
h1,h2,h3{margin:0;line-height:1.25}
code{background:var(--surface-2);border:1px solid var(--border);border-radius:6px;padding:1px 6px;font-size:.9em}
.cx-skip{position:absolute;left:-999px}.cx-skip:focus{left:8px;top:8px;z-index:99;background:#fff;padding:8px;border-radius:8px}
:focus-visible{outline:3px solid var(--ring);outline-offset:2px}
.cx-muted{color:var(--muted)}.cx-small{font-size:12.5px}.cx-pad{padding:12px 0}.cx-red{color:var(--red)}.cx-green{color:var(--green)}.cx-blue{color:var(--blue)}.cx-break{word-break:break-all}
[hidden]{display:none!important}

/* Marca */
.cx-wm{white-space:nowrap;display:inline-block}
.cx-word{font-weight:900;letter-spacing:.5px;font-size:20px;color:inherit;position:relative}
.cx-i{position:relative;display:inline-block}
.cx-i::before{content:"";position:absolute;left:calc(50% - 1px);top:-6px;width:7px;height:7px;transform:translateX(-50%);background:var(--cyan);clip-path:polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%)}
.cx-erp{display:inline-block;margin-left:6px;background:var(--cyan);color:#fff;font-weight:800;font-size:10px;letter-spacing:.8px;border-radius:5px;padding:2px 6px;vertical-align:4px}

/* Botones CISTI: fondo blanco, radio 10, alto 40, icono a la izquierda */
.cx-btn{display:inline-flex;align-items:center;gap:8px;height:40px;padding:0 16px;border-radius:var(--btn-r);border:1px solid var(--border-2);background:#fff;color:#0E1B33;font:600 14px var(--font);cursor:pointer;white-space:nowrap;text-decoration:none!important;transition:background .15s,border-color .15s,box-shadow .15s}
.cx-btn:hover{border-color:var(--cyan);box-shadow:0 0 0 3px rgba(14,165,233,.12)}
.cx-btn i{font-size:15px}
.cx-btn-primary{background:var(--purple);border-color:var(--purple);color:#fff}
.cx-btn-primary:hover{background:var(--purple-2);border-color:var(--purple-2);box-shadow:0 0 0 3px rgba(109,40,217,.2)}
.cx-btn-danger{color:var(--red);border-color:#FCA5A5}.cx-btn-danger:hover{background:#FEF2F2;border-color:var(--red);box-shadow:0 0 0 3px rgba(220,38,38,.12)}
.cx-btn-ia{color:var(--purple);border-color:#C4B5FD}.cx-btn-ia i{color:var(--purple)}
.cx-btn-sm{height:32px;padding:0 12px;font-size:13px}
.cx-btn-icon{width:40px;padding:0;justify-content:center}.cx-btn-icon.cx-btn-sm{width:32px}
.cx-btn-block{width:100%;justify-content:center}
.cx-btn[disabled]{opacity:.55;cursor:not-allowed}
.cx-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* Plantilla */
.cx-app{display:flex;min-height:100vh}
.cx-side{position:fixed;inset:0 auto 0 0;width:var(--side);background:var(--navy);color:#DCE6F5;display:flex;flex-direction:column;z-index:40;transition:transform .2s}
.cx-brand{display:flex;align-items:center;gap:10px;padding:18px 18px 12px;color:#fff;text-decoration:none!important}
.cx-brand-t{display:flex;flex-direction:column;line-height:1.1}.cx-brand-t small{color:#8FA3C4;font-size:11px;margin-top:4px}
.cx-emp{margin:0 14px 8px;padding:8px 10px;border-radius:10px;background:var(--navy-2);font-size:12.5px;display:flex;gap:8px;align-items:center;color:#B9C7DD}
.cx-nav{flex:1;overflow:auto;padding:6px 10px}
.cx-nav-i,.cx-nav-gh{display:flex;align-items:center;gap:11px;width:100%;padding:9px 12px;border-radius:10px;color:#C9D5E8;background:none;border:0;font:500 14px var(--font);cursor:pointer;text-align:left;text-decoration:none!important}
.cx-nav-i i,.cx-nav-gh i:first-child{width:18px;text-align:center;color:#7F95B9}
.cx-nav-i:hover,.cx-nav-gh:hover{background:var(--navy-2);color:#fff}
.cx-nav-i.cur{background:var(--navy-3);color:#fff}.cx-nav-i.cur i{color:var(--cyan-2)}
.cx-nav-gh span{flex:1}.cx-caret{font-size:11px;transition:transform .2s}
.cx-nav-g.open .cx-caret{transform:rotate(180deg)}
.cx-nav-sub{display:none;padding:2px 0 6px 41px}.cx-nav-g.open .cx-nav-sub{display:block}
.cx-nav-sub a{display:block;padding:6px 10px;border-radius:8px;color:#AFC0DA;font-size:13.5px;text-decoration:none!important}
.cx-nav-sub a:hover{color:#fff;background:var(--navy-2)}.cx-nav-sub a.cur{color:#fff;background:var(--navy-3);box-shadow:inset 3px 0 0 var(--cyan)}
.cx-count{margin-left:auto;background:var(--cyan);color:#fff;border-radius:999px;font-size:11px;padding:1px 7px;font-weight:700}
.cx-side-f{padding:12px 16px;font-size:11.5px;color:#7F95B9;border-top:1px solid var(--navy-2);display:flex;gap:6px;align-items:center}
.cx-side-f a{color:#C9D5E8}
.cx-wrap{flex:1;margin-left:var(--side);min-width:0;display:flex;flex-direction:column}
.cx-top{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:12px;padding:12px 24px;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(8px);border-bottom:1px solid var(--border)}
.cx-menu-btn{display:none}
.cx-search{flex:1;max-width:720px;position:relative;display:flex;align-items:center}
.cx-search>i{position:absolute;left:14px;color:var(--muted)}
.cx-search input{width:100%;height:42px;border-radius:12px;border:1px solid var(--border-2);background:var(--surface);color:var(--text);padding:0 44px 0 40px;font:14px var(--font)}
.cx-search input:focus{outline:0;border-color:var(--cyan);box-shadow:0 0 0 3px var(--ring)}
.cx-search kbd{position:absolute;right:12px;font:11px var(--font);border:1px solid var(--border-2);border-radius:5px;padding:1px 6px;color:var(--muted)}
.cx-sugg{position:absolute;top:48px;left:0;right:0;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow);overflow:hidden;max-height:70vh;overflow-y:auto}
.cx-sugg a{display:flex;gap:10px;padding:10px 14px;color:var(--text);text-decoration:none!important;border-bottom:1px solid var(--border)}
.cx-sugg a:hover,.cx-sugg a.sel{background:var(--surface-2)}
.cx-sugg a i{color:var(--cyan);width:18px;margin-top:3px}.cx-sugg small{display:block;color:var(--muted)}
.cx-sugg .cx-sugg-t{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px}
.cx-top-actions{display:flex;gap:8px;align-items:center;margin-left:auto}
.cx-bell{position:relative}.cx-dot{position:absolute;top:-5px;right:-5px;background:var(--red);color:#fff;border-radius:999px;font-size:10px;min-width:18px;height:18px;display:grid;place-items:center;padding:0 4px}
.cx-user{position:relative}.cx-avatar{width:26px;height:26px;border-radius:50%;background:var(--navy);color:#fff;display:grid;place-items:center;font-size:12px}
.cx-pop{position:absolute;right:0;top:48px;min-width:260px;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow);padding:6px;z-index:50}
.cx-pop a,.cx-pop button{display:flex;gap:10px;align-items:center;width:100%;padding:9px 10px;border-radius:8px;color:var(--text);background:none;border:0;font:14px var(--font);cursor:pointer;text-decoration:none!important}
.cx-pop a:hover,.cx-pop button:hover{background:var(--surface-2)}
.cx-pop-h{padding:8px 10px;border-bottom:1px solid var(--border);margin-bottom:4px}.cx-pop-h small{display:block;color:var(--muted)}
.cx-notif{position:fixed;right:24px;top:62px;width:380px;max-height:70vh;overflow:auto}
.cx-notif .cx-n{display:flex;gap:10px;padding:10px;border-radius:8px}.cx-notif .cx-n.new{background:rgba(14,165,233,.08)}
.cx-notif .cx-n i{color:var(--cyan);margin-top:3px}.cx-notif small{display:block;color:var(--muted)}
.cx-main{padding:24px;max-width:1480px;width:100%}
.cx-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;margin-bottom:18px;flex-wrap:wrap}
.cx-head h1{font-size:24px;font-weight:800}.cx-sub{margin:4px 0 0;color:var(--text-2)}
.cx-head-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.cx-crumbs{display:flex;gap:8px;align-items:center;font-size:12.5px;margin-bottom:4px}.cx-crumbs i{font-size:9px;color:var(--muted)}
.cx-foot{padding:16px 24px;color:var(--muted);font-size:12px;border-top:1px solid var(--border);margin-top:auto}
.cx-foot a,.cx-credit a{color:var(--text-2);font-weight:600}

/* Tarjetas y componentes */
.cx-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);margin-bottom:16px;min-width:0}
.cx-card-h{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--border)}
.cx-card-h h2{font-size:15px;font-weight:700;display:flex;gap:9px;align-items:center}.cx-card-h h2 i{color:var(--cyan)}
.cx-card-actions{display:flex;gap:6px}
.cx-card-b{padding:16px 18px}
.cx-cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));gap:16px;align-items:start}
.cx-cols-2-1{grid-template-columns:2fr 1fr}
.cx-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin-bottom:16px}
.cx-kpi{display:flex;gap:14px;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;box-shadow:var(--shadow);color:var(--text);text-decoration:none!important}
.cx-kpi-ic{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;font-size:18px;flex:none}
.cx-kpi-v{font-size:22px;font-weight:800;line-height:1.1}.cx-kpi-l{color:var(--text-2);font-size:13px}.cx-kpi-h{color:var(--muted);font-size:12px}
.cx-tone-azul .cx-kpi-ic{background:rgba(14,165,233,.12);color:var(--cyan)}
.cx-tone-verde .cx-kpi-ic{background:rgba(22,163,74,.12);color:var(--green)}
.cx-tone-ambar .cx-kpi-ic{background:rgba(217,119,6,.12);color:var(--amber)}
.cx-tone-rojo .cx-kpi-ic{background:rgba(220,38,38,.12);color:var(--red)}
.cx-tone-morado .cx-kpi-ic{background:rgba(109,40,217,.12);color:var(--purple)}
.cx-tone-oro .cx-kpi-ic{background:rgba(242,179,61,.18);color:#B7791F}
.cx-badge{display:inline-flex;align-items:center;gap:4px;border-radius:999px;padding:2px 10px;font-size:12px;font-weight:600;background:#EEF2F7;color:#334155;white-space:nowrap}
.cx-badge-verde{background:#DCFCE7;color:#166534}.cx-badge-ambar{background:#FEF3C7;color:#92400E}.cx-badge-rojo{background:#FEE2E2;color:#991B1B}
.cx-badge-azul{background:#E0F2FE;color:#075985}.cx-badge-morado{background:#EDE9FE;color:#5B21B6}.cx-badge-gris{background:#EEF2F7;color:#475569}
.cx-alert{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border-radius:12px;margin-bottom:14px;border:1px solid}
.cx-alert-ok{background:#F0FDF4;border-color:#BBF7D0;color:#14532D}.cx-alert-error{background:#FEF2F2;border-color:#FECACA;color:#7F1D1D}.cx-alert-info{background:#EFF6FF;border-color:#BFDBFE;color:#1E3A8A}
.cx-alert i{margin-top:3px}
.cx-empty{text-align:center;padding:36px 16px;color:var(--text-2)}.cx-empty>i{font-size:34px;color:var(--border-2);margin-bottom:10px}.cx-empty h3{font-size:16px;margin-bottom:6px;color:var(--text)}
.cx-table-wrap{overflow-x:auto}
.cx-table{width:100%;border-collapse:collapse;font-size:13.5px}
.cx-table th{text-align:left;font-size:12px;text-transform:uppercase;letter-spacing:.4px;color:var(--muted);font-weight:700;padding:10px;border-bottom:1px solid var(--border);white-space:nowrap}
.cx-table td{padding:10px;border-bottom:1px solid var(--border);vertical-align:middle}
.cx-table tr:hover td{background:var(--surface-2)}
.cx-table .r{text-align:right;white-space:nowrap}
.cx-list{list-style:none;margin:0;padding:0}
.cx-list li{display:flex;gap:12px;align-items:flex-start;padding:10px 0;border-bottom:1px solid var(--border)}.cx-list li:last-child{border:0}
.cx-list li>a,.cx-list li>div{flex:1;min-width:0;color:var(--text);text-decoration:none!important}
.cx-list small{display:block;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cx-list time{font-size:12px;color:var(--muted);white-space:nowrap}
.cx-list li>i{margin-top:4px;width:18px;text-align:center}
.cx-unread strong{color:var(--cyan)}
.cx-ch-whatsapp{color:#16A34A}.cx-ch-correo{color:var(--blue)}.cx-ch-interno{color:var(--purple)}.cx-ch-nota{color:var(--amber)}.cx-ch-llamada{color:var(--navy-3)}
.cx-tabs{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:16px;border-bottom:1px solid var(--border)}
.cx-tabs a{padding:9px 14px;color:var(--text-2);font-weight:600;border-bottom:2px solid transparent;text-decoration:none!important;display:flex;gap:7px;align-items:center}
.cx-tabs a.cur{color:var(--text);border-color:var(--cyan)}
.cx-chip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border-2);background:var(--surface);color:var(--text);border-radius:999px;padding:6px 12px;font:13px var(--font);cursor:pointer;margin:3px}
.cx-chip:hover{border-color:var(--purple);color:var(--purple)}

/* Formularios */
.cx-field{display:flex;flex-direction:column;gap:5px;margin-bottom:12px;min-width:0}
.cx-field label{font-weight:600;font-size:13px;color:var(--text-2)}
.cx-field input,.cx-field select,.cx-field textarea,.cx-composer select,.cx-composer input,.cx-composer textarea,.cx-input{width:100%;height:40px;border:1px solid var(--border-2);border-radius:10px;background:var(--surface);color:var(--text);padding:0 12px;font:14px var(--font)}
.cx-field textarea,.cx-composer textarea{height:auto;padding:10px 12px;resize:vertical}
.cx-field input[type=file]{padding:7px 10px}
.cx-field input:focus,.cx-field select:focus,.cx-field textarea:focus,.cx-composer :is(input,select,textarea):focus,.cx-input:focus{outline:0;border-color:var(--cyan);box-shadow:0 0 0 3px var(--ring)}
.cx-check label{display:flex;gap:8px;align-items:center;font-weight:500;color:var(--text)}.cx-check input{width:18px;height:18px}
.cx-hint{color:var(--muted);font-size:12px}.cx-req{color:var(--red)}
.cx-grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 14px}.cx-grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 14px}
.cx-wide{grid-column:1/-1}
.cx-details{margin:4px 0 12px}.cx-details summary{cursor:pointer;font-weight:600;color:var(--text-2);margin-bottom:10px}
.cx-steps{padding-left:18px}.cx-steps li{margin-bottom:6px}
.cx-secret{font-size:14px;letter-spacing:1px;word-break:break-all}
.cx-logo-prev{max-height:70px;border:1px solid var(--border);border-radius:8px;padding:6px;background:#fff}

/* Acceso e instalador */
.cx-bare{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;background:radial-gradient(1200px 600px at 10% -10%,rgba(14,165,233,.16),transparent),radial-gradient(900px 500px at 110% 110%,rgba(242,179,61,.14),transparent),var(--bg)}
.cx-auth-card{width:100%;max-width:420px;background:var(--surface);border:1px solid var(--border);border-radius:18px;box-shadow:0 10px 40px rgba(14,27,51,.12);padding:28px}
.cx-wide-card{max-width:680px}
.cx-auth-card h1{font-size:20px;margin:18px 0 12px}
.cx-auth-logo{display:flex;align-items:center;gap:12px}.cx-auth-logo .cx-wm{white-space:nowrap;display:inline-block}
.cx-word{font-size:26px}.cx-auth-logo small{display:block;color:var(--muted);font-size:12px;letter-spacing:.3px}
.cx-lema{text-align:center;color:var(--muted);font-size:12px;margin:16px 0 0}
.cx-credit{margin-top:18px;color:var(--muted);font-size:12px;text-align:center}

/* Tablero */
.cx-dash{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:16px}
.cx-dash-i{grid-column:span 6;min-width:0}.cx-dash-i .cx-card{height:100%;margin:0}
.cx-w-s{grid-column:span 4}.cx-w-m{grid-column:span 6}.cx-w-l{grid-column:span 8}.cx-w-xl{grid-column:1/-1}
.cx-bars{display:flex;align-items:flex-end;gap:6px;height:160px;padding-top:10px}
.cx-bars div{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:4px;min-width:0}
.cx-bars b{display:block;width:100%;max-width:38px;border-radius:6px 6px 2px 2px;background:var(--cyan)}
.cx-bars div.cur b{background:var(--purple)}
.cx-bars small{font-size:11px;color:var(--muted)}
.cx-progress{height:10px;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;overflow:hidden}.cx-progress b{display:block;height:100%;background:linear-gradient(90deg,var(--cyan),var(--purple))}
.cx-ai-hint{margin-bottom:14px}

/* Mensajes */
.cx-inbox{display:grid;grid-template-columns:340px 1fr;gap:0;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);height:calc(100vh - 250px);min-height:520px;overflow:hidden}
.cx-threads{border-right:1px solid var(--border);overflow:auto}
.cx-thread{display:flex;gap:10px;padding:12px 14px;border-bottom:1px solid var(--border);color:var(--text);text-decoration:none!important}
.cx-thread:hover{background:var(--surface-2)}.cx-thread.cur{background:rgba(14,165,233,.08);box-shadow:inset 3px 0 0 var(--cyan)}
.cx-thread>div{flex:1;min-width:0}.cx-thread small{display:block;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cx-thread>i{margin-top:3px;font-size:16px}
.cx-thread-m{display:flex;flex-direction:column;align-items:flex-end;gap:4px}.cx-thread-m time{font-size:11px;color:var(--muted);white-space:nowrap}
.cx-conv{display:flex;flex-direction:column;min-width:0}
.cx-conv-h{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border);flex-wrap:wrap}
.cx-conv-acts{display:flex;gap:6px;flex-wrap:wrap}
.cx-conv-ctx{padding:10px 16px;border-bottom:1px solid var(--border);background:var(--surface-2);font-size:13px}
.cx-conv-log{flex:1;overflow:auto;padding:16px;display:flex;flex-direction:column;gap:8px;background:linear-gradient(180deg,var(--surface-2),var(--surface))}
.cx-day{align-self:center;font-size:11.5px;color:var(--muted);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:2px 10px;margin:6px 0}
.cx-bubble{max-width:74%;padding:9px 12px;border-radius:14px;box-shadow:0 1px 1px rgba(0,0,0,.04)}
.cx-in{align-self:flex-start;background:var(--surface);border:1px solid var(--border);border-top-left-radius:4px}
.cx-out{align-self:flex-end;background:#DCF3FF;color:#0E1B33;border-top-right-radius:4px}
.cx-note{align-self:center;background:#FFF7E0;color:#5C4400;border:1px dashed #F2B33D}
.cx-bubble .cx-meta{display:block;text-align:right;color:#64748B;font-size:11px;margin-top:3px}
.cx-subj{display:block;margin-bottom:4px}
.cx-att{display:inline-flex;gap:6px;align-items:center;margin-top:6px;font-size:13px}
.cx-composer{border-top:1px solid var(--border);padding:12px 16px;display:flex;flex-direction:column;gap:8px}
.cx-composer-row{display:flex;gap:8px;align-items:center}.cx-composer-row select{width:170px;flex:none}
.cx-composer-b{justify-content:space-between}.cx-composer-b>div{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.cx-atts span{font-size:12px;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:3px 8px;margin-right:4px}

/* Buscador y ayuda */
.cx-results{list-style:none;margin:0;padding:0}.cx-results li{padding:10px 0;border-bottom:1px solid var(--border)}.cx-results li:last-child{border:0}
.cx-results p{margin:3px 0 0;color:var(--text-2);font-size:13px}mark{background:rgba(242,179,61,.35);color:inherit;border-radius:3px;padding:0 2px}
.cx-help-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.cx-help-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px;color:var(--text);display:flex;flex-direction:column;gap:6px;text-decoration:none!important;box-shadow:var(--shadow)}
.cx-help-card i{font-size:22px;color:var(--cyan)}.cx-help-card small{color:var(--muted)}
.cx-help{display:grid;grid-template-columns:240px 1fr;gap:20px;align-items:start}
.cx-help-toc{position:sticky;top:80px;display:flex;flex-direction:column;gap:2px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:12px}
.cx-help-toc a{padding:6px 8px;border-radius:8px;color:var(--text-2)}.cx-help-toc a:hover{background:var(--surface-2)}
.cx-md{padding:20px 24px;line-height:1.65}.cx-md h2{font-size:20px;margin:0 0 10px}.cx-md h3{font-size:16px;margin:18px 0 6px}.cx-md blockquote{margin:10px 0;padding:8px 14px;border-left:3px solid var(--cyan);background:var(--surface-2);border-radius:0 8px 8px 0}

/* Asistente IA */
.cx-ia{position:fixed;right:0;top:0;bottom:0;width:420px;max-width:100%;background:var(--surface);border-left:1px solid var(--border);box-shadow:-10px 0 40px rgba(14,27,51,.15);z-index:60;display:flex;flex-direction:column}
.cx-ia header{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid var(--border)}
.cx-ia header>div{display:flex;gap:8px;align-items:center}
.cx-ia-log{flex:1;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:10px}
.cx-ia-hello p{margin:0 0 8px;color:var(--text-2)}
.cx-ia-msg{padding:10px 12px;border-radius:12px;max-width:92%;white-space:pre-wrap;word-wrap:break-word}
.cx-ia-msg.u{align-self:flex-end;background:var(--purple);color:#fff;border-bottom-right-radius:4px}
.cx-ia-msg.a{align-self:flex-start;background:var(--surface-2);border:1px solid var(--border);border-bottom-left-radius:4px}
.cx-ia-msg.err{border-color:#FECACA;background:#FEF2F2;color:#7F1D1D}
.cx-ia-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;white-space:normal}
.cx-ia-pend{border:1px solid #C4B5FD;background:#F5F3FF;color:#3B0764;border-radius:12px;padding:10px 12px;white-space:normal}
.cx-ia-pend .cx-row{margin-top:8px}
.cx-ia-f{display:flex;gap:8px;padding:12px;border-top:1px solid var(--border)}.cx-ia-f textarea{flex:1;border:1px solid var(--border-2);border-radius:10px;padding:9px 12px;font:14px var(--font);resize:none;background:var(--surface);color:var(--text)}
.cx-ia-note{padding:0 14px 12px;color:var(--muted);font-size:11.5px}
.cx-typing{display:inline-flex;gap:4px}.cx-typing b{width:6px;height:6px;border-radius:50%;background:var(--muted);animation:cxb 1s infinite}.cx-typing b:nth-child(2){animation-delay:.15s}.cx-typing b:nth-child(3){animation-delay:.3s}
@keyframes cxb{0%,80%,100%{opacity:.25}40%{opacity:1}}

/* Celular */
@media (max-width:1100px){.cx-cols-2-1{grid-template-columns:1fr}.cx-w-s,.cx-w-m,.cx-w-l{grid-column:span 12}.cx-dash-i{grid-column:span 12}}
@media (max-width:860px){
  .cx-side{transform:translateX(-100%)}.cx-side.open{transform:none;box-shadow:0 0 0 100vmax rgba(0,0,0,.4)}
  .cx-wrap{margin-left:0}.cx-menu-btn{display:inline-flex}.cx-top{padding:10px 12px}.cx-main{padding:16px}
  .cx-hide-s,.cx-btn-ia span,.cx-search kbd{display:none}
  .cx-inbox{grid-template-columns:1fr;height:auto}.cx-threads{max-height:280px;border-right:0;border-bottom:1px solid var(--border)}
  .cx-conv-log{min-height:300px}.cx-help{grid-template-columns:1fr}.cx-help-toc{position:static}
  .cx-grid2,.cx-grid3{grid-template-columns:1fr}.cx-notif{left:12px;right:12px;width:auto}
  .cx-table thead{display:none}.cx-table tr{display:block;border-bottom:1px solid var(--border);padding:6px 0}.cx-table td{display:flex;justify-content:space-between;gap:12px;border:0;padding:5px 4px;text-align:right}
  .cx-table td::before{content:attr(data-label);font-weight:600;color:var(--muted);text-align:left}
  .cx-bubble{max-width:90%}.cx-composer-row{flex-wrap:wrap}.cx-composer-row select{width:100%}
}
@media print{.cx-side,.cx-top,.cx-foot,.cx-ia,.cx-head-actions{display:none!important}.cx-wrap{margin:0}.cx-card{box-shadow:none}}
/* Editor de partidas: columnas numéricas con ancho fijo */
.cx-items input[type=number]{min-width:84px}
.cx-items td:nth-child(3) input{min-width:110px}
.cx-items td:first-child input{min-width:240px}
/* Indicadores compactos en teléfono: dos por fila */
@media (max-width:560px){
.cx-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.cx-kpi{flex-direction:column;align-items:flex-start;gap:8px;padding:12px}
.cx-kpi-ic{width:34px;height:34px;font-size:15px;border-radius:10px}
.cx-kpi-v{font-size:17px;word-break:break-word}.cx-kpi-l{font-size:12px}.cx-kpi-h{font-size:11px}
}
.cx-pre{max-height:420px;overflow:auto;background:var(--bg-2,#f6f5fb);border:1px solid var(--line,#e5e3ef);border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.45;white-space:pre;tab-size:4}

/* Subir actualización (barra superior, solo administradores) */
.cx-up-btn i{color:var(--purple)}
.cx-upm{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:16px}.cx-upm[hidden]{display:none}
.cx-upm-bg{position:absolute;inset:0;background:rgba(15,23,42,.55);backdrop-filter:blur(2px)}
.cx-upm-box{position:relative;width:min(520px,100%);background:var(--surface);color:var(--text);border-radius:16px;box-shadow:0 30px 70px rgba(0,0,0,.35);overflow:hidden}
.cx-upm-box header{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border)}
.cx-upm-box h3{margin:0;font-size:16px;display:flex;gap:8px;align-items:center}
.cx-upm-x{border:0;background:none;font-size:24px;line-height:1;cursor:pointer;color:inherit;opacity:.6}
.cx-upm-drop{margin:18px;display:grid;justify-items:center;gap:6px;text-align:center;padding:28px 18px;border:2px dashed var(--border-2);border-radius:14px;cursor:pointer;position:relative}
.cx-upm-drop i{font-size:34px;color:var(--purple)}.cx-upm-drop small{color:var(--muted);max-width:40ch}
.cx-upm-drop input{position:absolute;width:1px;height:1px;opacity:0}
.cx-upm-drop.is-over,.cx-upm-drop.is-set{border-color:var(--purple);background:color-mix(in srgb,var(--purple) 6%,transparent)}
.cx-upm-bar{position:relative;margin:0 18px 14px;height:22px;border-radius:999px;background:color-mix(in srgb,var(--purple) 10%,transparent);overflow:hidden}.cx-upm-bar[hidden]{display:none}
.cx-upm-bar span{position:absolute;inset:0 auto 0 0;width:0;background:var(--purple);transition:width .2s}
.cx-upm-bar em{position:relative;display:block;text-align:center;font:600 12px/22px system-ui,sans-serif;font-style:normal;mix-blend-mode:difference;color:#fff}
.cx-upm.is-busy .cx-upm-x,.cx-upm.is-busy .cx-upm-bg{pointer-events:none}.cx-upm.is-busy .cx-upm-x{opacity:.2}
.cx-upm-box footer{display:flex;gap:8px;align-items:center;justify-content:flex-end;flex-wrap:wrap;padding:12px 18px;border-top:1px solid var(--border)}.cx-upm-box footer .cx-muted{margin-right:auto;font-size:12px}
.cx-hr{border:0;border-top:1px solid var(--border);margin:16px 0}.cx-h3{font-size:14px;margin:0 0 8px;display:flex;gap:6px;align-items:center}
.cx-legal{max-width:760px;line-height:1.6}.cx-legal h2{font-size:16px;margin:22px 0 6px}.cx-legal p{margin:0 0 10px}
