/* Zendera Factoring — estilo base inspirado en Pruff, paleta negro + amarillo. */
:root {
    --pf-black: #3D1806;
    --pf-black-2: #4D2410;
    --pf-black-3: #5E3320;
    --pf-yellow: #BBC0FF;
    --pf-yellow-dark: #9AA0F0;
    --pf-yellow-soft: rgba(187,192,255, .14);
    --pf-bg: #f5f5f3;
    --pf-surface: #ffffff;
    --pf-border: #e6e6e3;
    --pf-border-2: #efefec;
    --pf-text: #1d1d1b;
    --pf-muted: #7a7a75;
    --pf-ok: #27ae60;
    --pf-danger: #eb5757;
    --pf-warn: #f2994a;
    --pf-info: #2D9CDB;
    --sidebar-w: 248px;
    --zoom: 1;   /* tamaño del sistema (100 %): antes se dibujaba al 86 % y la letra quedaba muy chica. Cada persona lo ajusta con «Tamaño de letra» (menú de su usuario) */
}

html { zoom: var(--zoom); }

* { -webkit-font-smoothing: antialiased; }
body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--pf-bg);
    color: var(--pf-text);
    font-size: .875rem;
}
a { color: var(--pf-text); }
.text-muted { color: var(--pf-muted) !important; }

/* ── Marca ────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: .04em; font-size: .95rem; }
.brand b { color: var(--pf-yellow); font-weight: 800; margin-left: 2px; }
.brand-mark {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
    background: var(--pf-yellow); color: var(--pf-black); font-weight: 800; font-size: .85rem;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    background: var(--pf-black); color: #bdbdb8;
    display: flex; flex-direction: column; padding: 20px 14px;
    transition: transform .2s ease;
}
.sidebar .brand { color: #fff; margin: 0 8px 26px; }
.sidebar nav { flex: 1; overflow-y: auto; }
.nav-grupo { margin: 0; }
.nav-grupo summary { list-style: none; cursor: pointer; }
.nav-grupo summary::-webkit-details-marker { display: none; }
.nav-seccion {
    display: flex; align-items: center; gap: 6px;
    font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--pf-yellow); font-weight: 700; margin: 16px 12px 6px;
    padding: 2px 0; user-select: none;
}
.nav-seccion:hover { color: #ffd033; }
.nav-seccion i { margin-left: auto; font-size: .6rem; opacity: .8; color: var(--pf-yellow); transition: transform .15s ease; }
.nav-grupo[open] > .nav-seccion i { transform: rotate(180deg); }
.nav-grupo:not([open]) { margin-bottom: 2px; }
.sidebar nav a, .nav-pronto {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: 8px; color: #cfcfca; text-decoration: none; margin-bottom: 2px; font-weight: 600;
}
.sidebar nav a i, .nav-pronto i { width: 18px; text-align: center; opacity: .75; }
.sidebar nav a:hover { background: var(--pf-black-3); color: #fff; }
.sidebar nav a.active { background: var(--pf-yellow); color: var(--pf-black); }
.sidebar nav a.active i { opacity: 1; }
.nav-pronto { color: #5e5e59; cursor: default; }
.nav-pronto em { margin-left: auto; font-style: normal; font-size: .6rem; text-transform: uppercase; letter-spacing: .06em; border: 1px solid #3a3a36; border-radius: 999px; padding: 0 6px; }
.sidebar-empresa { border-top: 1px solid var(--pf-black-3); padding: 14px 10px 0; color: #e8e8e3; }
.sidebar-backdrop { display: none; }

/* ── Shell / topbar ───────────────────────────────────── */
.shell { margin-left: var(--sidebar-w); min-height: calc(100vh / var(--zoom)); }
.topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: 14px;
    background: var(--pf-surface); border-bottom: 1px solid var(--pf-border);
    padding: 12px 28px; min-height: 64px;
}
.topbar-title h1 { font-size: 1.2rem; font-weight: 800; margin: 0; }
.topbar-sub { color: var(--pf-muted); font-size: .78rem; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.main { padding: 24px 28px 48px; }

.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; font-weight: 600; color: var(--pf-text); padding: 4px 6px; border-radius: 8px; }
.user-btn:hover { background: var(--pf-bg); }
.btn-icon { border: 1px solid var(--pf-border); background: #fff; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .nav-open .sidebar { transform: none; }
    .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
    .shell { margin-left: 0; }
    .topbar { padding: 10px 16px; }
    .main { padding: 16px; }
}

/* ── Pill conexión SII ────────────────────────────────── */
.sii-pill {
    display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 5px 12px;
    font-size: .75rem; font-weight: 700; border: 1px solid var(--pf-border); background: #fff; color: var(--pf-muted);
}
.sii-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #c4c4bf; }
.sii-conectado { border-color: rgba(39,174,96,.35); background: rgba(39,174,96,.08); color: #1e8c4d; }
.sii-conectado .dot { background: var(--pf-ok); box-shadow: 0 0 0 3px rgba(39,174,96,.18); }
.sii-error { border-color: rgba(235,87,87,.4); background: rgba(235,87,87,.08); color: #c83a3a; }
.sii-error .dot { background: var(--pf-danger); }
.sii-conectando { border-color: rgba(187,192,255,.6); background: var(--pf-yellow-soft); color: #8a6a00; }
.sii-conectando .dot { background: var(--pf-yellow); animation: latido 1s infinite; }
@keyframes latido { 50% { opacity: .3; } }

/* ── Botones / formularios ────────────────────────────── */
.btn-pf { background: var(--pf-yellow); border: 0; border-radius: 999px; color: var(--pf-black); font-weight: 700; }
.btn-pf:hover, .btn-pf:focus { background: var(--pf-black-3); color: var(--pf-yellow); }
.btn-dark-pf { background: var(--pf-black); color: #fff; font-weight: 700; border: 1px solid var(--pf-black); }
.btn-dark-pf:hover { background: var(--pf-black-3); color: #fff; }
.btn-ghost { background: var(--pf-yellow); border: 0; color: var(--pf-black); padding: 4px 9px; border-radius: 999px; }
.btn-ghost:hover { background: var(--pf-black-3); color: var(--pf-yellow); }
.btn-ghost.text-danger { background: rgba(235,87,87,.15); color: #d63c3c !important; }
.btn-ghost.text-danger:hover { background: #d63c3c; color: #fff !important; }
/* Lápiz de editar: botón redondo con el mismo estilo */
.btn-ghost:has(> .fa-pen), .btn-ghost:has(> .fa-pencil) { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: .8rem; }
/* Todos los botones secundarios (btn-light) con el estilo de los botones: píldora amarilla, letra negra; hover gris oscuro con letra amarilla. */
.btn-light { --bs-btn-color: var(--pf-black); --bs-btn-bg: var(--pf-yellow); --bs-btn-border-color: transparent; --bs-btn-hover-color: var(--pf-yellow); --bs-btn-hover-bg: var(--pf-black-3); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--pf-yellow); --bs-btn-active-bg: var(--pf-black-3); --bs-btn-active-border-color: transparent; --bs-btn-disabled-color: var(--pf-black); --bs-btn-disabled-bg: var(--pf-yellow); --bs-btn-disabled-border-color: transparent;
    --bs-btn-border-radius: 999px; font-weight: 700; }
.btn-light.border { border: 0 !important; }
.btn-light.text-danger { --bs-btn-bg: rgba(235,87,87,.15); --bs-btn-hover-bg: #d63c3c; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #d63c3c; --bs-btn-active-color: #fff; color: #d63c3c !important; }
.btn-light.text-danger:hover { color: #fff !important; }
.form-label { font-size: .78rem; font-weight: 700; color: #4a4a46; margin-bottom: 4px; }
.form-control, .form-select { border-color: var(--pf-border); font-size: .875rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--pf-yellow); box-shadow: 0 0 0 .2rem var(--pf-yellow-soft); }
.form-check-input:checked { background-color: var(--pf-black); border-color: var(--pf-black); }

/* ── Cards ────────────────────────────────────────────── */
.card-pf { background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: 10px; padding: 20px; }
.card-pf > h2, .card-titulo { font-size: .95rem; font-weight: 800; margin: 0 0 14px; }
.card-pf.p-0 { overflow: hidden; }
.seccion-form { border-top: 1px solid var(--pf-border-2); padding-top: 18px; margin-top: 18px; }

/* ── KPIs ─────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }
.kpi { position: relative; }
.kpi .kpi-label { color: var(--pf-muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.kpi .kpi-valor { font-size: 1.6rem; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { color: var(--pf-muted); font-size: .75rem; }
.kpi .kpi-icon { position: absolute; top: 18px; right: 18px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--pf-yellow-soft); color: #9a7600; }
.kpi.kpi-dark { background: var(--pf-black); border-color: var(--pf-black); color: #fff; }
.kpi.kpi-dark .kpi-label, .kpi.kpi-dark .kpi-sub { color: #a5a5a0; }
.kpi.kpi-dark .kpi-icon { background: var(--pf-yellow); color: var(--pf-black); }

/* ── Auth ─────────────────────────────────────────────── */
.auth-body { min-height: calc(100vh / var(--zoom)); background: var(--pf-black); display: grid; place-items: center; padding: 16px; }
.auth-panel { display: grid; grid-template-columns: 1fr 1fr; width: min(880px, 100%); background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.auth-brand { background: var(--pf-black-2); color: #fff; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; gap: 14px;
    background-image: radial-gradient(circle at 100% 100%, rgba(187,192,255,.22), transparent 55%); }
.auth-brand .brand { font-size: 1.15rem; }
.auth-brand p { color: #b5b5b0; margin: 0; max-width: 280px; }
.auth-empresa { display: inline-block; align-self: flex-start; border: 1px solid rgba(187,192,255,.5); color: var(--pf-yellow); border-radius: 999px; padding: 3px 12px; font-size: .75rem; font-weight: 700; }
.auth-card { padding: 44px 40px; }
@media (max-width: 720px) { .auth-panel { grid-template-columns: 1fr; } .auth-brand, .auth-card { padding: 28px 24px; } }

/* ── Avatares ─────────────────────────────────────────── */
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: .66rem; font-weight: 700; flex: none; }
.avatar-lg { width: 44px; height: 44px; font-size: .9rem; }
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.punto-online { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; }
.punto-online.en-linea { background: #27ae60; }
.punto-online.desconectado { background: #eb5757; }

/* ── Chips / pills ────────────────────────────────────── */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; line-height: 1.4; }
.chip-cedida  { background: rgba(45,156,219,.2);  color: #2D9CDB; }
.chip-violet  { background: rgba(155,81,224,.15); color: #9b51e0; }
.chip-ok      { background: rgba(39,174,96,.15);  color: #1e8c4d; }
.chip-danger  { background: rgba(235,87,87,.15);  color: #d63c3c; }
.chip-warn    { background: rgba(242,153,74,.18); color: #c26a17; }
.chip-info    { background: rgba(45,156,219,.12); color: #1b7fb8; }
.chip-neutral { background: #eeeeea; color: #4b4b47; }
.chip-muted   { background: #f3f3f0; color: #a0a09a; }
.chip-select { display: inline-block; width: auto; border: 0; font-weight: 700; font-size: .72rem; padding: 4px 26px 4px 10px; border-radius: 999px; }
.chip-select:disabled { opacity: .8; background-image: none; }
.chip-yellow  { background: var(--pf-yellow-soft); color: #8a6a00; }

/* Pill Activo / Inactivo (outline, como Pruff) */
.pill-estado { display: inline-block; min-width: 110px; text-align: center; border-radius: 999px; padding: 2px 12px; font-size: .75rem; font-weight: 600; border: 1px solid; }
.pill-activo   { background: #e3f6e3; border-color: #7fcf8f; color: #2c8a45; }
.pill-inactivo { background: #fde4e4; border-color: #f08a8a; color: #c93d3d; }
.pill-pendiente { background: #fff6d6; border-color: #f0cf5a; color: #8a6a00; }

/* ── Tabla estilo Pruff ───────────────────────────────── */
.tabla-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--pf-border-2); }
.tabla-toolbar .buscar { position: relative; flex: 0 1 280px; }
.tabla-toolbar .buscar i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--pf-muted); font-size: .8rem; }
.tabla-toolbar .buscar input { padding-left: 32px; }
.table-wrap { overflow-x: auto; }
.table-pf { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.table-pf thead th { padding: 6px 4px; background: #fafaf8; border-bottom: 1px solid var(--pf-border); white-space: nowrap; }
.table-pf thead th .th-box {
    display: flex; align-items: center; gap: 6px; justify-content: space-between;
    border: 1px solid var(--pf-border); border-radius: 8px; background: #fff; padding: 7px 10px;
    color: #57574f; font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
}
.table-pf thead th .th-box a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; flex: 1; justify-content: space-between; }
.table-pf thead th .th-box .sort { color: #b9b9b3; font-size: .7rem; }
.table-pf thead th .th-box .sort.on { color: var(--pf-black); }
.table-pf thead th.th-plain { color: #57574f; font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; }
.table-pf tbody td { padding: 10px 12px; border-bottom: 1px solid var(--pf-border-2); vertical-align: middle; }
.table-pf tbody tr:nth-child(even) { background: #fcfcfb; }
.table-pf tbody tr:hover { background: #fffbea; }
.table-pf .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-pf .acciones { white-space: nowrap; text-align: right; width: 1%; }
.celda-usuario { display: flex; align-items: center; gap: 10px; }
.copiable { display: inline-flex; align-items: center; gap: 6px; }
.copiable button { background: none; border: 0; padding: 0; color: #8d8d87; font-size: .78rem; }
.copiable button:hover { color: var(--pf-black); }
.rut { font-variant-numeric: tabular-nums; color: var(--pf-muted); font-size: .72rem; }
.tabla-pie { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--pf-border); background: #fafaf8; font-size: .8rem; color: var(--pf-muted); }
.tabla-pie .ms-auto { display: flex; align-items: center; gap: 16px; }
.tabla-pie .form-select { width: auto; border: 0; background-color: transparent; font-weight: 700; padding-right: 26px; }
.pag-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border: 0; border-radius: 999px; background: var(--pf-yellow); color: var(--pf-black); text-decoration: none; }
.pag-btn:hover { background: var(--pf-black-3); color: var(--pf-yellow); }
.pag-btn.disabled { opacity: .4; pointer-events: none; }

/* ── Tabs / filtros (cartera) ─────────────────────────── */
.tabs-pf { display: flex; gap: 4px; border-bottom: 1px solid var(--pf-border); margin-bottom: 14px; }
.tabs-pf a { padding: 8px 14px; color: var(--pf-muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 700; }
.tabs-pf a.active { color: var(--pf-black); border-color: var(--pf-yellow); }
.tabs-pf .count { background: #eeeeea; border-radius: 999px; padding: 1px 7px; font-size: .7rem; margin-left: 6px; }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filtros .form-select, .filtros .form-control { width: auto; min-width: 150px; font-size: .8rem; }

/* ── Gauges ───────────────────────────────────────────── */
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .gauges { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .gauges { grid-template-columns: 1fr; } }
.gauge-card { text-align: center; }
.gauge-card h2 { text-align: left; }
.gauge-svg { width: 100%; max-width: 190px; }
.gauge-valor { font-size: 1.5rem; font-weight: 800; margin-top: -34px; }
.gauge-sub { color: var(--pf-muted); font-size: .75rem; }
.ranking { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; font-size: .75rem; }
.ranking li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px dashed var(--pf-border); }
.ranking li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Varios ───────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--pf-muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.aviso-amarillo { background: var(--pf-yellow-soft); border: 1px solid rgba(187,192,255,.45); border-radius: 10px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.aviso-amarillo i { color: #9a7600; font-size: 1.1rem; }
.lista-actividad { list-style: none; margin: 0; padding: 0; }
.lista-actividad li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--pf-border-2); font-size: .8rem; }
.lista-actividad li:last-child { border-bottom: 0; }
.pf-toast { background: var(--pf-black); color: #fff; border: 0; }
.modal-content { border: 0; border-radius: 12px; }
.modal-header { border-bottom-color: var(--pf-border-2); }
.modal-footer { border-top-color: var(--pf-border-2); }
.permiso-check { display: flex; align-items: center; gap: 10px; border: 1px solid var(--pf-border); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; cursor: pointer; }
.permiso-check:has(input:checked) { border-color: var(--pf-yellow); background: var(--pf-yellow-soft); }

/* ── Sincronizar ──────────────────────────────────────── */
.paso { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--pf-black); color: var(--pf-yellow); font-size: .72rem; margin-right: 8px; vertical-align: 1px; }
.progress { height: 8px; background: #eeeeea; }
.progress-bar { background-color: var(--pf-yellow); transition: width .4s; }

/* Tabla Mi cartera — igual a Pruff: encabezado gris, texto normal, todo a la izquierda */
.table-cartera { font-size: .85rem; }
.table-cartera thead th { background: #f2f2f0; border-bottom: 1px solid var(--pf-border); padding: 11px 12px; text-align: left; font-weight: 600; color: var(--pf-text); white-space: nowrap; }
.table-cartera thead th a { color: inherit; text-decoration: none; }
.table-cartera thead th a:hover { color: #000; }
.table-cartera thead th i { font-size: .75rem; color: #6b6b66; margin-left: 4px; }
.table-cartera tbody td { text-align: left; padding: 10px 12px; }
.table-cartera tbody tr:nth-child(even) { background: transparent; }
.table-cartera .rut { font-size: .75rem; }
.table-cartera .monto { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip-pill { min-width: 110px; text-align: center; border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 35%, transparent); font-weight: 600; }
/* ── Mi cartera: cabecera estilo Pruff ────────────────── */
.subnav { display: flex; gap: 4px; background: #fff; border: 1px solid var(--pf-border); border-radius: 10px; padding: 0 14px; margin-bottom: 18px; overflow-x: auto; }
.subnav a { padding: 13px 16px; color: var(--pf-muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--pf-text); }
.subnav a.active { color: var(--pf-black); border-color: var(--pf-yellow); }
.subnav .count { background: #eeeeea; border-radius: 999px; padding: 1px 7px; font-size: .7rem; margin-left: 4px; color: var(--pf-muted); }
.subnav a.active .count { background: var(--pf-yellow-soft); color: #8a6a00; }

.cartera-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--pf-border); }
.cartera-titulo { display: flex; align-items: center; gap: 12px; }
.cartera-titulo h2 { font-size: 1.3rem; font-weight: 600; margin: 0; }
.cartera-icono { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--pf-yellow-soft); color: #9a7600; font-size: 1.05rem; }
.cartera-controles { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seg-toggle { display: inline-flex; background: #ecece9; border-radius: 9px; padding: 3px; }
.seg-toggle a { padding: 7px 14px; border-radius: 7px; font-size: .78rem; font-weight: 600; color: var(--pf-muted); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.seg-toggle a.active { background: #fff; color: var(--pf-black); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg-toggle a.active i { color: #b38900; }
/* Selector de mes propio (reemplaza el calendario nativo) */
.mes-picker { position: relative; }
.mes-label { position: absolute; top: -8px; left: 10px; z-index: 1; background: var(--pf-bg); padding: 0 4px; font-size: .68rem; font-weight: 600; color: var(--pf-muted); pointer-events: none; }
.mes-btn { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-width: 230px; height: 42px; padding: 0 14px; background: #fff; border: 1px solid #cfcfca; border-radius: 8px; font-size: .95rem; font-weight: 600; color: var(--pf-text); transition: border-color .15s, box-shadow .15s; }
.mes-btn i { color: var(--pf-muted); }
.mes-btn:hover { border-color: #a9a9a3; }
.mes-picker.abierto .mes-btn, .mes-btn:focus-visible { border-color: var(--pf-yellow); box-shadow: 0 0 0 3px var(--pf-yellow-soft); outline: 0; }
.mes-picker.abierto .mes-label { color: #8a6a00; }
.mes-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 1050; width: 288px; background: #fff; border: 1px solid var(--pf-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 12px; animation: mesIn .12s ease-out; }
@keyframes mesIn { from { opacity: 0; transform: translateY(-4px); } }
.mes-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mes-anio { font-weight: 800; font-size: 1rem; }
.mes-nav { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--pf-text); }
.mes-nav:hover:not(:disabled) { background: var(--pf-bg); }
.mes-nav:disabled { opacity: .3; }
.mes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mes-celda { position: relative; display: grid; place-items: center; height: 40px; border-radius: 8px; font-size: .85rem; font-weight: 600; color: var(--pf-text); text-decoration: none; border: 1px solid transparent; }
a.mes-celda:hover { background: var(--pf-yellow-soft); }
a.mes-celda:focus-visible { outline: 2px solid var(--pf-yellow); outline-offset: 1px; }
.mes-celda.hoy { border-color: var(--pf-black); }
.mes-celda.sel { background: var(--pf-yellow); color: var(--pf-black); border-color: var(--pf-yellow); }
.mes-celda.off { color: #c9c9c4; }
.mes-dot { position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--pf-yellow-dark); }
.mes-celda.sel .mes-dot { background: var(--pf-black); }
.mes-pop-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--pf-border-2); }
.mes-pop-foot a { font-size: .78rem; font-weight: 700; color: var(--pf-muted); text-decoration: none; padding: 4px 6px; border-radius: 6px; }
.mes-pop-foot a:hover, .mes-pop-foot a.on { color: var(--pf-black); background: var(--pf-bg); }

.semi-card { text-align: center; padding: 16px 16px 10px; }
.semi-card h3 { font-size: .88rem; font-weight: 600; margin: 0 0 6px; }
.semi-svg { width: 100%; max-width: 250px; display: block; margin: 0 auto; }
.semi-svg path { transition: opacity .15s; cursor: default; }
.semi-svg:hover path { opacity: .55; }
.semi-svg path:hover { opacity: 1; }
.semi-num { font-size: 22px; font-weight: 400; fill: var(--pf-text); font-family: 'DM Sans', sans-serif; }
.semi-sub { font-size: 9px; fill: var(--pf-muted); font-family: 'DM Sans', sans-serif; }

.dona-svg { width: 100%; max-width: 220px; display: block; margin: 0 auto; }
.dona-svg path { transition: opacity .15s; cursor: default; }
.dona-svg:hover path { opacity: .55; }
.dona-svg path:hover { opacity: 1; }
.dona-num { font-size: 26px; font-weight: 800; fill: var(--pf-text); font-family: 'DM Sans', sans-serif; }
.dona-sub { font-size: 10px; fill: var(--pf-muted); font-family: 'DM Sans', sans-serif; }
.dona-leyenda { display: flex; flex-direction: column; gap: 8px; }
.dona-leyenda .item { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.dona-leyenda .punto { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dona-leyenda .valor { margin-left: auto; font-weight: 700; }
.barra-gestion { margin-bottom: 14px; }
.barra-gestion .cab { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 600; margin-bottom: 4px; }
.barra-gestion .track { height: 8px; border-radius: 999px; background: #f0f0eb; overflow: hidden; }
.barra-gestion .fill { height: 100%; border-radius: 999px; }
.kpi-delta { font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.kpi-delta.up { background: rgba(39,174,96,.15); color: #1e8c4d; }
.kpi-delta.down { background: rgba(235,87,87,.15); color: #d63c3c; }
.tabla-pivote th, .tabla-pivote td { text-align: center; }
.tabla-pivote th:first-child, .tabla-pivote td:first-child { text-align: left; }
.tabla-pivote tfoot td { font-weight: 800; background: #faf9f5; }

.grupo-gestion-titulo { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--pf-muted); margin: 0 4px 10px; }
.tarjeta-gestion { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--pf-border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.icono-gestion { width: 34px; height: 34px; border-radius: 10px; background: var(--pf-yellow-soft); color: #9a7600; display: grid; place-items: center; flex: none; }
.tarjeta-gestion.hecha { opacity: .6; }
.tarjeta-gestion.hecha .icono-gestion { background: #eeeeea; color: #8a8a85; }
.tarjeta-gestion.hecha > div > div:first-child, .tarjeta-gestion.hecha > div > div:nth-child(2) { text-decoration: line-through; }
.check-gestion { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--pf-border); background: #fff; color: transparent; flex: none; display: grid; place-items: center; }
.check-gestion:hover { border-color: #27ae60; color: #27ae60; }
.check-gestion.on { background: #27ae60; border-color: #27ae60; color: #fff; }

.calendario-barra { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--pf-border); flex-wrap: wrap; }
.calendario-leyenda { display: flex; gap: 14px; font-size: .76rem; color: var(--pf-muted); }
.calendario-leyenda span { display: flex; align-items: center; gap: 5px; }
.calendario-leyenda i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.calendario-grilla { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendario-grilla.es-mes { grid-auto-rows: minmax(110px, auto); }
.calendario-cab { text-align: center; font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--pf-muted); padding: 8px 0; border-bottom: 1px solid var(--pf-border); }
.calendario-dia { border-right: 1px solid var(--pf-border); border-bottom: 1px solid var(--pf-border); padding: 8px; min-height: 140px; }
.calendario-dia:nth-child(7n) { border-right: 0; }
.calendario-dia.es-hoy { background: var(--pf-yellow-soft); }
.calendario-dia.fuera-mes { background: #faf9f5; opacity: .55; }
.calendario-fecha { font-size: .82rem; margin-bottom: 8px; display: flex; align-items: baseline; gap: 5px; }
.tarjeta-cal { display: block; background: #fff; border: 1px solid var(--pf-border); border-left: 3px solid; border-radius: 6px; padding: 5px 8px; margin-bottom: 6px; text-decoration: none; color: var(--pf-text); }
.tarjeta-cal .tipo { font-size: .62rem; font-weight: 800; text-transform: uppercase; color: var(--pf-muted); }
.tarjeta-cal .nombre { font-size: .78rem; font-weight: 600; line-height: 1.2; }
@media (max-width: 900px) { .calendario-grilla { grid-template-columns: 1fr; } .calendario-dia { border-right: 0; } }

.periodo-card { padding: 14px 18px; }
.periodo-head { display: flex; align-items: center; gap: 10px; }
.periodo-head h3 { font-size: .88rem; font-weight: 600; margin: 0; }
.periodo-body { margin-top: 14px; }
.barras { display: flex; align-items: flex-end; gap: 16px; height: 190px; padding: 0 6px; }
.barra-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.barra-valor { font-size: .75rem; font-weight: 700; margin-bottom: 4px; white-space: nowrap; }
.barra-track { flex: 1; width: 100%; max-width: 80px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--pf-border); }
.barra { width: 100%; background: var(--pf-yellow); border-radius: 6px 6px 0 0; min-height: 2px; transition: height .4s; }
.barra-col:hover .barra { background: var(--pf-yellow-dark); }
.barra-label { font-size: .7rem; color: var(--pf-muted); margin-top: 6px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.docs-head { display: flex; align-items: center; gap: 16px; padding: 16px 18px; flex-wrap: wrap; }
.docs-head h2 { font-size: 1.25rem; font-weight: 400; margin: 0; flex: none; }
.docs-filtros { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.filtro-pf > .form-select, .filtro-pf > .form-control { height: 52px; min-height: 52px; border-color: #cfcfca; border-radius: 6px; font-size: .88rem; }
.filtro-pf > label { color: var(--pf-muted); font-size: .88rem; }
.docs-resumen { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 18px; border-top: 1px solid var(--pf-border-2); font-size: .78rem; color: var(--pf-muted); }
.docs-resumen b { color: var(--pf-text); }
.docs-resumen a { color: var(--pf-muted); text-decoration: none; font-weight: 700; }
.docs-resumen a:hover { color: var(--pf-black); }

/* Encabezados ordenables: ícono tenue en todas, flecha marcada en la activa */
.table-cartera thead th a { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.table-cartera thead th a i.fa-sort { color: #c4c4bf; opacity: .6; transition: opacity .15s, color .15s; }
.table-cartera thead th:hover { background: #e9e9e6; }
.table-cartera thead th:hover a i.fa-sort { opacity: 1; color: #6b6b66; }
.table-cartera thead th.orden-activo { background: var(--pf-yellow-soft); }
.table-cartera thead th.orden-activo a i { color: var(--pf-black); }

/* Clientes: barra de asignación masiva */
.barra-masiva { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: var(--pf-yellow-soft); border-bottom: 1px solid rgba(187,192,255,.4); font-size: .82rem; }
.barra-masiva .form-select { width: auto; min-width: 190px; }
.table-cartera td .chip-pill { min-width: 70px; }

/* Fila Total + pie de tabla estilo Pruff */
.table-cartera tfoot .fila-total td { padding: 13px 12px; border-top: 1px solid var(--pf-border); border-bottom: 0; font-weight: 600; color: var(--pf-text); background: #fff; }
.table-cartera tfoot .fila-total td:first-child { font-weight: 700; }
.table-cartera tfoot .fila-total td.monto { font-weight: 700; }
.tabla-pie { background: #efefed; border-top: 1px solid var(--pf-border); padding: 10px 18px; min-height: 54px; color: var(--pf-text); font-size: .82rem; border-radius: 0 0 10px 10px; }
.tabla-pie .pag-btn { width: 34px; height: 34px; border: 0; background: transparent; color: #57574f; border-radius: 8px; font-size: 1rem; }
.tabla-pie .pag-btn:hover { background: rgba(0,0,0,.06); color: var(--pf-black); }
.tabla-pie .pag-btn.disabled { opacity: .3; }
.tabla-pie .ms-auto { gap: 26px; }
.tabla-pie .form-select { color: var(--pf-muted); }

/* ── Módulo DTE SII ───────────────────────────────────── */
.cargando-sii { position: fixed; inset: 0; z-index: 2000; background: rgba(245,245,243,.82); backdrop-filter: blur(2px); display: grid; place-items: center; text-align: center; color: var(--pf-text); }
.cargando-sii .spinner-border { color: var(--pf-yellow); width: 2.6rem; height: 2.6rem; }
.form-consulta { display: grid; grid-template-columns: 1.3fr 1fr .8fr auto; gap: 10px; align-items: end; }
@media (max-width: 760px) { .form-consulta { grid-template-columns: 1fr 1fr; } }
.dte-cabecera { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.dte-cabecera .dte-icono { width: 48px; height: 48px; border-radius: 12px; background: var(--pf-yellow-soft); color: #9a7600; display: grid; place-items: center; font-size: 1.3rem; }
.dte-cabecera h2 { font-size: 1.15rem; font-weight: 800; margin: 0; }
.dte-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 18px; }
@media (max-width: 900px) { .dte-grid { grid-template-columns: repeat(2, 1fr); } }
.dte-dato .l { color: var(--pf-muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dte-dato .v { font-weight: 700; margin-top: 2px; }
.dte-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--pf-border); }
.timeline li { position: relative; padding: 0 0 18px 14px; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--pf-yellow); }
.timeline li.ev-danger::before { border-color: var(--pf-danger); }
.timeline li.ev-ok::before { border-color: var(--pf-ok); }
.timeline .t-fecha { font-size: .72rem; color: var(--pf-muted); }
.timeline .t-desc { font-weight: 700; }
.certificado { max-width: 860px; }
.certificado .partes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .certificado .partes { grid-template-columns: 1fr; } }
.certificado .parte { border: 1px solid var(--pf-border); border-radius: 10px; padding: 12px; }
.certificado .parte .rol { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #9a7600; }
@media print {
    .sidebar, .topbar, .no-print, .toast-container, .sidebar-backdrop { display: none !important; }
    .shell { margin-left: 0 !important; } .main { padding: 0 !important; }
    .card-pf { border: 0 !important; }
}

/* Barra de acciones (RCV): misma altura y borde que el selector de mes */
.estado-sync { display: inline-flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 600; color: var(--pf-muted); white-space: nowrap; }
.estado-sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pf-ok); box-shadow: 0 0 0 3px rgba(39,174,96,.15); }
.grupo-acciones { display: inline-flex; height: 42px; border: 1px solid #cfcfca; border-radius: 8px; background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn-accion { display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border: 0; background: transparent; color: var(--pf-text); font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.btn-accion + .btn-accion { border-left: 1px solid #e3e3df; }
.btn-accion i { color: #b38900; font-size: .9rem; transition: transform .3s; }
.btn-accion:hover { background: var(--pf-yellow-soft); color: var(--pf-black); }
.btn-accion:hover .fa-rotate { transform: rotate(180deg); }
.btn-accion:focus-visible { outline: 2px solid var(--pf-yellow); outline-offset: -2px; }
.btn-accion.activo { background: var(--pf-black); color: #fff; }
.btn-accion.activo i { color: var(--pf-yellow); }
@media (max-width: 600px) { .btn-accion span { display: none; } .btn-accion { padding: 0 14px; } }
.chip-pagada { background: rgba(26,188,156,.15); color: #138a72; }
.modal-seccion { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--pf-muted); margin-bottom: 8px; }

/* ── Perfil y enrolamiento ────────────────────────────── */
.perfil-nav a, .perfil-nav .deshabilitado { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 8px; text-decoration: none; color: var(--pf-text); font-weight: 600; }
.perfil-nav a.active { background: var(--pf-yellow-soft); color: var(--pf-black); }
.perfil-nav a.active i { color: #9a7600; }
.perfil-nav i { width: 18px; text-align: center; color: var(--pf-muted); }
.perfil-nav .deshabilitado { color: #a8a8a2; cursor: default; }
.perfil-nav .deshabilitado em { margin-left: auto; font-style: normal; font-size: .62rem; text-transform: uppercase; border: 1px solid var(--pf-border); border-radius: 999px; padding: 0 6px; }
.avatar-perfil { width: 58px; height: 58px; font-size: 1.1rem; background: var(--pf-yellow-soft); color: #8a6a00; }
.link-copiable { display: flex; align-items: center; gap: 6px; background: var(--pf-bg); border: 1px solid var(--pf-border-2); border-radius: 8px; padding: 6px 10px; min-width: 0; }
.link-copiable a { color: var(--pf-muted); text-decoration: none; font-size: .82rem; min-width: 0; }
.link-copiable a:hover { color: var(--pf-black); }
.enrol-panel { width: min(940px, 100%); }
.enrol-ejecutivo { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.06); }
.enrol-ejecutivo .avatar { width: 38px; height: 38px; background: var(--pf-yellow); color: var(--pf-black); font-size: .8rem; }
.enrol-ok { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: rgba(39,174,96,.12); color: var(--pf-ok); }
.enrol-trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ficha-enrol { border: 1px dashed rgba(187,192,255,.6); background: rgba(187,192,255,.06); border-radius: 10px; padding: 12px 14px; }
.ficha-enrol .kv { grid-template-columns: 110px 1fr; font-size: .82rem; }

/* ── Indicadores económicos (Dashboard) ───────────────── */
.ind-cabecera { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ind-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1300px) { .ind-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .ind-grid { grid-template-columns: repeat(2, 1fr); } }
.ind-card { position: relative; background: #fff; border: 1px solid var(--pf-border); border-radius: 10px; padding: 12px 14px 10px; overflow: hidden; }
.ind-nombre { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--pf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ind-valor { font-size: 1.2rem; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ind-pie { display: flex; justify-content: space-between; align-items: center; font-size: .72rem; margin-top: 2px; position: relative; z-index: 1; }
.ind-var { font-weight: 700; color: var(--pf-muted); }
.ind-var.sube { color: #1e8c4d; }
.ind-var.baja { color: #d63c3c; }
.ind-valor { padding-right: 72px; }
.ind-spark { position: absolute; right: 12px; top: 36px; width: 64px; height: 24px; }

/* ── Tablero Kanban (Prospectos) ───────────────── */
.tablero-kanban { display: flex; gap: 12px; padding: 14px; overflow-x: auto; align-items: flex-start; }
.kanban-col { flex: 0 0 260px; width: 260px; background: var(--pf-bg); border: 1px solid var(--pf-border-2); border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh / var(--zoom) - 320px); min-height: 200px; }
.kanban-col-cab { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px; font-size: .84rem; }
.kanban-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kanban-dot.chip-ok { background: var(--pf-ok); }
.kanban-dot.chip-danger { background: var(--pf-danger); }
.kanban-dot.chip-warn { background: var(--pf-warn); }
.kanban-dot.chip-info { background: var(--pf-info); }
.kanban-dot.chip-neutral { background: #a0a09a; }
.kanban-dot.chip-muted { background: #c7c7c1; }
.kanban-count { background: #fff; border: 1px solid var(--pf-border); border-radius: 999px; font-size: .68rem; font-weight: 700; color: var(--pf-muted); padding: 1px 7px; }
.kanban-col-body { flex: 1; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; transition: background .15s ease; }
.kanban-col-body.destino { background: var(--pf-yellow-soft); border-radius: 8px; }
.kanban-card { display: block; background: #fff; border: 1px solid var(--pf-border); border-radius: 8px; padding: 10px 12px; text-decoration: none; color: var(--pf-text); cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.kanban-card:hover { border-color: var(--pf-yellow); }
.kanban-card.arrastrando { opacity: .4; }
.kanban-card-titulo { font-weight: 700; font-size: .85rem; }
.kanban-monto { font-size: .78rem; font-weight: 700; color: #1e8c4d; margin-top: 2px; }
.kanban-card-pie { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: .68rem; color: var(--pf-muted); flex-wrap: wrap; }
.kanban-ejec { white-space: nowrap; }
.kanban-gestion { white-space: nowrap; }
.kanban-vacio { text-align: center; padding: 18px 0; }

/* ── Página de error (403, etc.) ───────────────── */
.error-body { min-height: calc(100vh / var(--zoom)); background: radial-gradient(circle at 50% 0%, var(--pf-black-2), var(--pf-black) 60%); display: grid; place-items: center; padding: 16px; }
.error-card { width: min(420px, 100%); background: rgba(53,53,58,.55); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.08); border-radius: 18px; padding: 40px 32px 30px; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.error-icono { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; background: rgba(187,192,255,.14); color: var(--pf-yellow); display: grid; place-items: center; font-size: 1.5rem; }
.error-label { font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--pf-yellow); margin-bottom: 10px; }
.error-titulo { color: #fff; font-weight: 800; font-size: 1.4rem; margin-bottom: 10px; }
.error-desc { color: #b5b5b0; font-size: .88rem; margin-bottom: 22px; }
.error-btn { padding: 8px 22px; }
.error-footer { margin-top: 24px; font-size: .72rem; color: #8a8a85; text-transform: uppercase; letter-spacing: .06em; }
.error-footer b { color: var(--pf-yellow); }

/* ── Tabs del CRM (Oportunidades / Prospectos) ───────────────── */
.tabs-crm { display: flex; gap: 4px; border-bottom: 1px solid var(--pf-border); }
.tab-crm { padding: 10px 16px; font-weight: 700; font-size: .88rem; color: var(--pf-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-crm:hover { color: var(--pf-text); }
.tab-crm.activo { color: var(--pf-black); border-bottom-color: var(--pf-yellow); }

/* ── Oportunidades (Prospectos) ───────────────── */
.oportunidad { border-bottom: 1px solid var(--pf-border-2); padding: 14px 16px; }
.oportunidad:last-child { border-bottom: 0; }
.oportunidad-fila { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.oportunidad-cliente .l, .oportunidad-monto .l { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pf-muted); font-weight: 700; }
.oportunidad-cliente .v { display: block; font-weight: 800; font-size: .96rem; text-decoration: none; color: var(--pf-text); }
.oportunidad-cliente .v:hover { color: var(--pf-yellow-dark); }
.oportunidad-cliente .ejec { font-size: .76rem; color: var(--pf-muted); margin-top: 2px; }
.oportunidad-monto { text-align: right; }
.oportunidad-monto .v { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.btn-expandir { background: none; border: 0; padding: 2px 0; color: var(--pf-muted); font-size: .76rem; font-weight: 700; cursor: pointer; }
.btn-expandir i { transition: transform .15s ease; margin-left: 2px; }
.oportunidad.abierta .btn-expandir i { transform: rotate(180deg); }
.oportunidad-pie { display: flex; align-items: center; gap: 22px; margin-top: 10px; font-size: .78rem; color: var(--pf-text); flex-wrap: wrap; }
.oportunidad-pie .l { text-transform: uppercase; font-size: .66rem; letter-spacing: .05em; color: var(--pf-muted); font-weight: 700; margin-right: 4px; }
.oportunidad-detalle { display: none; margin-top: 12px; border-top: 1px dashed var(--pf-border-2); padding-top: 10px; }
.oportunidad.abierta .oportunidad-detalle { display: block; }
.btn-copiar { background: none; border: 0; padding: 0 0 0 4px; color: var(--pf-muted); cursor: pointer; font-size: .7rem; }
.btn-copiar:hover { color: var(--pf-yellow-dark); }
.sim-resultado { display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.sim-resultado > div { display: flex; justify-content: space-between; align-items: center; }
.sim-resultado .total { border-top: 1px solid var(--pf-border-2); padding-top: 8px; margin-top: 2px; font-size: 1.05rem; }
.sim-resultado .total b { color: var(--pf-ok, #1e8c4d); font-size: 1.2rem; }
.oportunidad-seleccion { display: flex; align-items: center; gap: 10px; padding: 4px 0 10px; font-size: .82rem; color: var(--pf-muted); }
.oportunidad-seleccion .n-sel, .oportunidad-seleccion .monto-sel { color: var(--pf-text); }
.oportunidad-detalle .chk-factura, .oportunidad-detalle .chk-todos { width: 16px; height: 16px; cursor: pointer; }

/* ── Simular (página dedicada) ───────────────── */
.sim-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .sim-layout { grid-template-columns: 1fr; } }
.sim-bulk { display: flex; align-items: end; gap: 10px; background: var(--pf-bg); border: 1px solid var(--pf-border-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.sim-linea { display: flex; align-items: center; gap: 12px; border-left: 3px solid var(--pf-yellow); background: var(--pf-bg); border-radius: 0 8px 8px 0; padding: 10px 12px; margin-bottom: 8px; }
.sim-linea-info { flex: 1; min-width: 0; }
.sim-linea input[type="date"] { width: 160px; }
.sim-preview { position: sticky; top: 16px; }
.sim-condiciones-ver { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; font-size: .86rem; }
.sim-condiciones-ver > div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--pf-border-2); padding-bottom: 4px; }
.sim-condiciones-ver span { color: var(--pf-muted); }

/* ── Cupos (Riesgo y Cupos) ───────────────── */
.cupo-barra { width: 110px; height: 5px; border-radius: 3px; background: var(--pf-border-2); margin-top: 3px; overflow: hidden; }
.cupo-barra-fill { height: 100%; background: var(--pf-yellow); border-radius: 3px; }

/* ── Ficha del cliente en pestañas (estilo Pruff) ─────────────────── */
.ficha-tabs { gap: 4px; border-bottom: 1px solid var(--pf-border); margin-bottom: 16px; flex-wrap: nowrap; overflow-x: auto; }
.ficha-tabs .nav-link { color: var(--pf-muted); font-weight: 700; background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 12px 20px; white-space: nowrap; }
.ficha-tabs .nav-link:hover { color: var(--pf-black); }
.ficha-tabs .nav-link.active { color: var(--pf-black); border-bottom-color: var(--pf-yellow); background: none; }
.ficha-sub { display: inline-flex; gap: 4px; padding: 4px; background: #efefec; border-radius: 10px; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
.ficha-sub .nav-link { color: var(--pf-muted); font-weight: 600; font-size: .85rem; background: none; border: 0; border-radius: 8px; padding: 6px 16px; white-space: nowrap; }
.ficha-sub .nav-link.active { background: var(--pf-surface); color: var(--pf-black); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 36px; }
.info-col h3 { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--pf-muted); font-weight: 800; margin: 0 0 16px; }
.info-item { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.info-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pf-yellow-soft); color: #9a7600; font-size: .8rem; }
.info-item small { display: block; font-size: .72rem; color: var(--pf-muted); }
.info-item b { font-weight: 600; font-size: .9rem; word-break: break-word; }
.info-vacio { font-style: italic; font-weight: 400; color: var(--pf-muted); }

/* Dato destacado de una ficha (valor grande con etiqueta y nota), p. ej. Antecedentes tributarios del SII */
.dato-kpi { background: var(--pf-bg); border: 1px solid var(--pf-border-2); border-radius: 10px; padding: 12px 14px; height: 100%; }
.dato-kpi .k { font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--pf-muted); }
.dato-kpi .v { font-size: 1.4rem; font-weight: 800; margin-top: 3px; }
.dato-kpi .s { font-size: .75rem; color: var(--pf-muted); margin-top: 2px; }

/* ── Resumen SII (gráfico + cifras, estilo Pruff) ─────────── */
.titulo-barra { font-size: 1rem !important; font-weight: 700; border-left: 3px solid var(--pf-yellow); padding-left: 10px; line-height: 1.1; }
.seg { display: inline-flex; background: var(--pf-bg); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; font-weight: 700; font-size: .78rem; color: var(--pf-muted); }
.seg button.activo { background: var(--pf-surface); color: var(--pf-text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.mini-kpi { flex: 1; display: flex; align-items: center; gap: 12px; background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: 10px; padding: 10px 14px; }
.mini-kpi-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--pf-yellow-soft); color: #9a7600; font-size: .85rem; }
.mini-kpi small { display: block; color: var(--pf-muted); font-size: .72rem; font-weight: 600; }
.mini-kpi b { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.mini-kpi .sub { display: block; color: var(--pf-muted); font-size: .68rem; }

/* ── Ventana de usuario (Editar / Invitar): en pestañas, compacta ── */
.usr-modal .modal-header.usr-head { align-items: center; gap: 12px; border-bottom: 0; padding: 18px 22px 8px; }
.usr-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--pf-yellow-soft); color: #9a7600; font-weight: 800; flex: none; }
.usr-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--pf-border); overflow-x: auto; }
.usr-tabs button { border: 0; background: none; padding: 9px 14px; font-weight: 700; font-size: .84rem; color: var(--pf-muted); border-bottom: 3px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.usr-tabs button:hover { color: var(--pf-text); }
.usr-tabs button.active { color: var(--pf-black); border-bottom-color: var(--pf-yellow); }
.usr-cont:not(:empty) { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--pf-yellow-soft); color: #9a7600; font-size: .7rem; line-height: 18px; text-align: center; }
.usr-body { padding: 18px 22px; min-height: 270px; }
.usr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 575px) { .usr-grid { grid-template-columns: 1fr; } }
.usr-tile { display: flex; align-items: center; gap: 10px; border: 1px solid var(--pf-border); border-radius: 10px; padding: 9px 12px; cursor: pointer; margin: 0; transition: border-color .12s, background .12s; }
.usr-tile:hover { border-color: #d9d9d4; }
.usr-tile:has(input:checked) { border-color: var(--pf-yellow); background: var(--pf-yellow-soft); }
.usr-tile:has(input:disabled) { opacity: .75; cursor: default; }
.usr-tile .usr-ico { width: 18px; text-align: center; color: var(--pf-muted); }
.usr-tile:has(input:checked) .usr-ico { color: #9a7600; }
.usr-txt { min-width: 0; line-height: 1.25; font-size: .84rem; }
.usr-txt .small { font-size: .72rem; }
.usr-nota { background: var(--pf-bg); border-radius: 8px; padding: 10px 12px; font-size: .78rem; color: var(--pf-muted); }
.usr-foot { border-top: 1px solid var(--pf-border); padding: 12px 22px; }

/* Botones de acción de la ficha (cabecera): mismo formato y colores que los chips de estado (píldora suave). */
.ficha-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ficha-acciones .btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: 4px 14px; border-radius: 999px; border: 0;
    font-size: .78rem; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.ficha-acciones .btn i { margin: 0 !important; font-size: .9em; }
.ficha-acciones .btn:hover { filter: brightness(.95); }
.ficha-acciones .btn-p-yellow, .ficha-acciones .btn-p-warn, .ficha-acciones .btn-p-ok { background: var(--pf-yellow); color: var(--pf-black); }
.ficha-estados { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

/* Botones en píldora (cualquier pantalla): fondo amarillo y letra negra como el menú lateral; solo rechazar/eliminar va en rojo. */
.btn-p-yellow, .btn-p-warn, .btn-p-ok, .btn-p-danger { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: 4px 14px; border-radius: 999px; border: 0;
    font-size: .78rem; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.btn-p-yellow i, .btn-p-warn i, .btn-p-ok i, .btn-p-danger i { margin: 0 !important; font-size: .9em; }
.btn-p-yellow:hover, .btn-p-warn:hover, .btn-p-ok:hover, .btn-p-danger:hover { filter: brightness(.95); }
.btn-p-yellow, .btn-p-warn, .btn-p-ok { background: var(--pf-yellow); color: var(--pf-black); }
.btn-p-danger { background: rgba(235,87,87,.15); color: #d63c3c; }
.btn-p-yellow:hover, .btn-p-warn:hover, .btn-p-ok:hover, .ficha-acciones .btn-p-yellow:hover, .ficha-acciones .btn-p-warn:hover, .ficha-acciones .btn-p-ok:hover { background: var(--pf-black-3); color: var(--pf-yellow); filter: none; } .btn-p-danger:hover { color: #d63c3c; }


/* Simulación que usa el sobregiro o excede la línea: el resumen queda en rojo. */
.mx-alerta { border: 2px solid #d63c3c; border-radius: 12px; background: rgba(235,87,87,.06); padding: 12px; }

/* Condiciones comerciales: tarjetas compactas, en una sola fila que fluye (no se estiran en pantallas anchas). */
.cond-compacta > .row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.cond-compacta > .row > [class*="col-"] { flex: 0 1 190px; width: auto; max-width: 230px; padding: 0; margin: 0; }
.cond-compacta .dato-kpi { padding: 6px 10px; border-radius: 6px; background: var(--pf-bg); text-align: center; }
.cond-compacta .dato-kpi .small { font-size: .66rem !important; line-height: 1.25; }
.cond-compacta .dato-kpi > .small.text-muted:first-child { font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.cond-compacta .dato-kpi .fs-4, .cond-compacta .dato-kpi .fs-5 { font-size: .95rem !important; font-weight: 700 !important; line-height: 1.3; }
.cond-compacta .dato-kpi .fw-semibold { font-size: .82rem; }
.cond-compacta .dato-kpi .fs-6 { font-size: .8rem !important; }

/* Información de la Empresa compacta: todos los datos en una sola grilla (sin los títulos de sección) y ítems más chicos. */
.info-compacta .info-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 24px; }
.info-compacta .info-col { display: contents; }
.info-compacta .info-col h3 { display: none; }
.info-compacta .info-item { gap: 10px; margin-bottom: 10px; }
.info-compacta .info-item small { font-size: .68rem; }
.info-compacta .info-item b { font-size: .84rem; }
.info-compacta .info-ico { width: 28px; height: 28px; flex: 0 0 28px; font-size: .75rem; }

/* Botón principal deshabilitado: sigue amarillo, atenuado (Bootstrap lo dejaba transparente). */
.btn-pf:disabled, .btn-pf.disabled, fieldset:disabled .btn-pf { background: var(--pf-yellow); color: var(--pf-black); opacity: .5; }

/* Condiciones comerciales: comentarios e historial de cambios con letra legible. */
.cond-compacta .lista-actividad li, .cond-compacta .lista-actividad li .small { font-size: .95rem !important; }
.cond-compacta .lista-actividad li .text-muted { font-size: .88rem; }
.cond-compacta .lista-actividad li { padding: 11px 0; }
.cond-compacta .fw-semibold.small, .cond-compacta summary.small { font-size: 1rem !important; }
.cond-compacta > .small.text-muted, .cond-compacta > div > .small.text-muted { font-size: .88rem !important; }
.cond-compacta .input-group-sm > .form-control, .cond-compacta .input-group-sm > .btn { font-size: .95rem; }

/* Datos de uso interno bajo el resumen de una simulación (tasa real, plazo promedio, utilidad). */
.sim-interno { font-size: .82rem; color: var(--pf-muted); background: var(--pf-bg); border: 1px dashed var(--pf-border-2); border-radius: 8px; padding: 7px 12px; }
.sim-interno b { color: var(--pf-text); }

/* Fecha de vencimiento corrida por caer en fin de semana: borde y icono del calendario en rojo (el aviso va en el title del campo). */
input[type="date"].venc-aviso { border-color: #d63c3c; }
input[type="date"].venc-aviso::-webkit-calendar-picker-indicator { filter: invert(27%) sepia(95%) saturate(4500%) hue-rotate(345deg) brightness(92%); cursor: pointer; }

/* Cupo visual en la lista de clientes: línea del cliente y barra de lo utilizado. */
.cupo-celda { min-width: 190px; }
.cupo-barra { height: 6px; border-radius: 999px; background: var(--pf-border-2); overflow: hidden; margin: 4px 0 3px; }
.cupo-barra span { display: block; height: 100%; border-radius: 999px; }
.cupo-barra .cupo-verde { background: #27ae60; } .cupo-barra .cupo-ambar { background: #f2994a; } .cupo-barra .cupo-rojo { background: #eb5757; }

/* Pestaña Línea: Condiciones comerciales + Mantención de línea + estado forman UN solo item (tarjeta única con secciones separadas por una línea) */
.card-unico .card-pf { background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
.card-unico #condiciones { margin-bottom: 0 !important; }
.card-unico #mantencion-linea, .card-unico #estado-linea { margin-top: 1.25rem !important; padding-top: 1.25rem !important; border-top: 1px solid var(--pf-border) !important; }
