/* Portal CoNext: misma paleta y tipografía que conext.work */
@font-face { font-family: Inter; src: url(fuentes/inter400.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(fuentes/inter600.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(fuentes/inter700.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: Inter; src: url(fuentes/inter800.ttf); font-weight: 800; font-display: swap; }

:root {
  --ink: #152540; --muted: #5a6b87; --line: #e2e9f4; --line-soft: #edf2f9;
  --bg: #f4f7fc; --ice: #eef4fc; --white: #fff;
  --navy: #16305b; --navy-deep: #0f2447; --blue: #2e5aa8; --blue-bright: #3b6fd4; --sky-soft: #c9daf1;
  --ok: #1f7a4d; --ok-bg: #e7f5ee; --warn: #9a5b00; --warn-bg: #fff4e0; --bad: #b42318; --bad-bg: #fdecea;
  --a: #1f7a4d; --b: #2e5aa8; --c: #7a869a;
  --radius: 14px; --shadow: 0 1px 2px #16305b0d, 0 4px 14px #16305b0f;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg);
       font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
.num, td.n, .tabular { font-variant-numeric: tabular-nums; }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.lateral { background: var(--navy-deep); color: #c9daf1; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px;
           position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lateral .marca { display: flex; flex-direction: column; gap: 6px; padding: 0 10px; }
.lateral .marca img { width: 120px; filter: brightness(0) invert(1); }
.lateral .marca small { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #8fb6ff; }
.lateral nav { display: flex; flex-direction: column; gap: 2px; }
.lateral nav a { color: #dce6f5; padding: 9px 12px; border-radius: 9px; font-weight: 600; display: flex; justify-content: space-between; }
.lateral nav a:hover { background: #ffffff14; text-decoration: none; }
.lateral nav a.activo { background: var(--blue); color: #fff; }
.lateral nav a .candado { font-size: 11px; opacity: .6; font-weight: 400; }
.lateral nav a .badge-aviso { background: var(--blue-bright); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 99px; padding: 0 7px; min-width: 18px; text-align: center; line-height: 18px; }
.lateral .sep { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #6a92cc; padding: 0 12px; margin-top: 6px; }
.lateral .pie { margin-top: auto; font-size: 12px; padding: 0 10px; display: flex; flex-direction: column; gap: 8px; }
.lateral .pie b { color: #fff; display: block; }
.lateral .pie form button { background: none; border: 0; color: #8fb6ff; padding: 0; cursor: pointer; font: inherit; }
.contenido { padding: 28px 32px 60px; max-width: 1240px; width: 100%; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.cabecera { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.cabecera .sub { color: var(--muted); margin-top: 4px; }
.etiqueta { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--blue); }

/* ---------- piezas ---------- */
.tarjeta { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
           display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tarjeta > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rejilla { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.rejilla.dos { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.cifras { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cifra { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.cifra span { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cifra b { display: block; font-size: 26px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.cifra small { color: var(--muted); }
.vacio { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; background: var(--white); }
.nota { background: var(--ice); border-radius: 10px; padding: 12px 14px; color: var(--ink); }
.muted { color: var(--muted); }
.peq { font-size: 12px; }
.fila { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fila.fin { justify-content: flex-end; }
.pila { display: flex; flex-direction: column; gap: 10px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
        background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.azul { background: #e8eef9; color: var(--blue); }
.prio { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-weight: 800; font-size: 12px; color: #fff; }
.prio.A { background: var(--a); } .prio.B { background: var(--b); } .prio.C { background: var(--c); }
.prio.none { background: var(--line); color: var(--muted); }

/* ---------- tablas ---------- */
.tabla-env { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700;
     padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td .sec { display: block; color: var(--muted); font-size: 12px; }
td.min { width: 1%; white-space: nowrap; }
tbody tr:hover { background: #f8fafd; }

/* barras de reparto */
.barras { display: flex; flex-direction: column; gap: 7px; }
.barra { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 4px 10px; align-items: center; font-size: 13px; }
.barra .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.barra .b { grid-column: 1 / -1; height: 6px; border-radius: 9px; background: var(--line-soft); overflow: hidden; }
.barra .b i { display: block; height: 100%; background: var(--blue); border-radius: 9px; }

/* embudo */
.embudo { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.embudo a, .embudo div { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--white); color: inherit; }
.embudo a:hover { border-color: var(--blue); text-decoration: none; }
.embudo .activo { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.embudo span { font-size: 12px; color: var(--muted); display: block; }
.embudo b { font-size: 22px; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---------- formularios ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--white); border: 1px solid #c9d5e8; border-radius: 9px;
                          padding: 9px 11px; width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; accent-color: var(--blue); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-bright); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
.campos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.campos .ancho { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border-radius: 9px;
       padding: 9px 16px; border: 1px solid var(--blue); background: var(--blue); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--navy); border-color: var(--navy); text-decoration: none; }
.btn.sec { background: var(--white); color: var(--blue); border-color: #c9d5e8; }
.btn.sec:hover { border-color: var(--blue); background: var(--ice); }
.btn.peligro { background: var(--white); color: var(--bad); border-color: #f1c4bf; }
.btn.peq { padding: 5px 10px; font-size: 13px; }
.filtros { display: flex; flex-direction: row; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filtros label { flex: 1 1 150px; }
.filtros .q { flex: 3 1 240px; }

.aviso { border-radius: 10px; padding: 12px 14px; font-weight: 500; overflow-wrap: anywhere; }
.aviso.ok { background: var(--ok-bg); color: var(--ok); }
.aviso.error { background: var(--bad-bg); color: var(--bad); }
.aviso.enlace { background: #fffbe6; border: 1px solid #f0d78c; color: #5c4400; display: flex; flex-direction: column; gap: 8px; }
.aviso.enlace code { background: #fff; border: 1px solid #f0d78c; padding: 6px 8px; border-radius: 6px; user-select: all; font-size: 12px; }

.pestanas { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.pestanas a { padding: 8px 14px; border-radius: 9px 9px 0 0; color: var(--muted); font-weight: 600; }
.pestanas a.activo { color: var(--blue); box-shadow: inset 0 -2px 0 var(--blue); }

.paginas { display: flex; gap: 6px; align-items: center; justify-content: center; }

/* ficha de prospecto (portal del cliente) */
.fichas { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.ficha { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ficha header { display: flex; gap: 10px; align-items: flex-start; }
.ficha header div { min-width: 0; flex: 1; }
.ficha h3 { font-size: 15px; }
.ficha .cargo { color: var(--muted); font-size: 13px; }
.ficha dl { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 13px; }
.ficha dt { color: var(--muted); font-size: 12px; }
.ficha dd { margin: 0; overflow-wrap: anywhere; }

/* acceso */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
          background: radial-gradient(1200px 600px at 10% -10%, #dce6f5 0, transparent 60%), var(--bg); }
.acceso .caja { width: min(100%, 400px); background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px;
                box-shadow: 0 8px 20px #16305b1a, 0 32px 80px #16305b14; display: flex; flex-direction: column; gap: 18px; }
.acceso img { width: 130px; }
.acceso form { display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; padding: 14px 16px; gap: 12px; }
  .lateral nav { flex-direction: row; flex-wrap: wrap; }
  .lateral .pie { flex-direction: row; justify-content: space-between; align-items: center; }
  .contenido { padding: 20px 16px 48px; }
}
.confirmar-aviso { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; width: max-content; max-width: 300px; font-size: 12px;
                   color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; box-shadow: var(--shadow); }

/* embudo CONNECT Enterprise (SVG server-side, P7) */
.embudo-svg { display: block; max-width: 420px; margin: 4px auto; }
.embudo-svg .barra { fill: var(--blue); }
.embudo-svg .eti { fill: #fff; font-size: 11px; font-weight: 600; font-family: inherit; }
.cifra b.na { color: var(--muted); font-weight: 700; }
.aviso.dato-incompleto { background: var(--warn-bg); color: var(--warn); }
.bandeja { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }

/* embudo del RECORRIDO con conversion (Mejora 7): SVG server-side, sin JS */
.embudo-rec { display: block; max-width: 460px; margin: 4px auto; }
.embudo-rec .barra { fill: var(--blue); }
.embudo-rec .eti { fill: #fff; font-size: 11px; font-weight: 600; font-family: inherit; }
.embudo-rec .num { fill: #fff; font-size: 17px; font-weight: 800; font-family: inherit; font-variant-numeric: tabular-nums; }
.embudo-rec .conv { fill: var(--muted); font-size: 11px; font-weight: 600; font-family: inherit; }
.embudo-frases { margin: 10px 0 0; padding-left: 1.1rem; color: var(--ink); display: grid; gap: 4px; }
.embudo-frases li { line-height: 1.45; }

/* tablero por etapas (Kanban) del pipeline `seguimiento` (Mejora 7) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kanban .col { background: var(--ice); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kanban .col > header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; color: var(--navy); font-size: 13px; }
.kanban .col > header .cuenta { font-variant-numeric: tabular-nums; background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 1px 9px; font-size: 12px; color: var(--muted); }
.kanban .ficha-mini { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; color: inherit; }
.kanban .ficha-mini:hover { border-color: var(--blue); text-decoration: none; box-shadow: var(--shadow); }
.kanban .ficha-mini b { color: var(--navy); display: block; font-size: 13px; }
.kanban .ficha-mini span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban .ficha-mini .nota { color: var(--ink); white-space: normal; font-size: 11px; margin-top: 3px; }
.kanban .col .vacia { color: var(--muted); font-size: 12px; padding: 6px 2px; }

/* linea de tiempo (timeline) de actividades de un prospecto (Mejora 7) */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--line); }
.timeline .cuando { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .que { color: var(--ink); }
.timeline .tipo { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--blue); }

/* Popup "Añadir al calendario" (app.js lo abre con los enlaces del proveedor + .ics). */
.cal-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(21, 37, 64, .45); backdrop-filter: blur(2px); }
.cal-modal[hidden] { display: none; }
.cal-caja { position: relative; width: min(100%, 380px); background: var(--white); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 22px 20px; box-shadow: 0 18px 50px rgba(21, 37, 64, .25); }
.cal-caja h3 { margin: 0 0 6px; font-size: 17px; }
.cal-caja #cal-nota { margin: 0 0 16px; }
.cal-opciones { display: flex; flex-direction: column; gap: 9px; }
.cal-opciones .btn { width: 100%; }
.cal-cerrar { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 2px 6px; }
.cal-cerrar:hover { color: var(--ink); }

/* Integraciones: tarjetas con beneficio (rediseño 2026-10-20). */
.integ-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin-bottom: 14px; }
.integ-card { display: flex; gap: 14px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.integ-card.conectada { border-color: #bfe0c6; }
.integ-card.alerta { border-color: #f1c4bf; }
.integ-ico { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  color: var(--c, var(--blue)); background: color-mix(in srgb, var(--c, var(--blue)) 12%, var(--white)); }
.integ-cuerpo { min-width: 0; flex: 1; }
.integ-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.integ-top b { font-size: 15px; }
.integ-benef { color: var(--muted); margin: 6px 0 8px; line-height: 1.45; }
.integ-cuenta { font-size: 12px; margin: 0 0 12px; color: var(--ink); }
.integ-cuenta.alerta { color: var(--bad); }
.integ-acc .btn, .integ-acc form { width: 100%; }
.integ-acc .btn { width: 100%; }
.integ-pie { max-width: 640px; }

/* Modal de bienvenida (primer ingreso del cliente). Reutiliza el overlay de .cal-modal. */
.bienv-caja { position: relative; width: min(100%, 440px); background: var(--white); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 26px 22px; box-shadow: 0 18px 50px rgba(21, 37, 64, .25); }
.bienv-caja h2 { margin: 0 0 4px; font-size: 20px; }
.bienv-caja > p { color: var(--muted); margin: 0 0 16px; }
.bienv-pasos { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.bienv-pasos li { display: flex; gap: 12px; align-items: flex-start; }
.bienv-pasos .n { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff;
  font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.bienv-pasos b { display: block; }
.bienv-pasos span { color: var(--muted); font-size: 13px; }
.bienv-caja .cerrar-x { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 22px;
  line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; }

.cal-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-banner .btn { white-space: nowrap; }
