:root{
  --bg:#f3f6fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --surface-3:#f1f5f9;
  --ink:#162033;
  --muted:#718096;
  --line:#e2e8f0;
  --line-strong:#cbd5e1;
  --nav:#fff4c7;
  --nav-soft:rgba(255,255,255,.08);
  --primary:#2563eb;
  --primary-hover:#1d4ed8;
  --primary-2:#e8f0ff;
  --good:#07825f;
  --good-bg:#e3f7ef;
  --warn:#c66a04;
  --warn-bg:#fff3dc;
  --bad:#c92828;
  --bad-bg:#feeaea;
  --purple:#6d46d8;
  --purple-bg:#efeafe;
  --shadow:0 16px 42px rgba(15,23,42,.07);
  --shadow-soft:0 6px 20px rgba(15,23,42,.055);
  --radius:18px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:Inter,"Segoe UI",ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,sans-serif;background:var(--bg);color:var(--ink);-webkit-font-smoothing:antialiased}
body{background:radial-gradient(circle at 70% -15%,rgba(37,99,235,.08),transparent 34%),var(--bg)}
button,input,select,textarea{font:inherit}
button:disabled{opacity:.45;cursor:not-allowed;transform:none!important}
.app-shell{min-height:100vh}

/* Navegación */
.sidebar{position:fixed;inset:0 auto 0 0;width:252px;background:#fff3b8!important;color:#263244;padding:24px 16px;display:flex;flex-direction:column;z-index:20;border-right:1px solid #ead68a;box-shadow:5px 0 24px rgba(114,93,24,.06)}
.brand{display:flex;gap:10px;align-items:center;padding:2px 8px 24px;min-width:0}
.brand-mark{width:42px;height:42px;border-radius:13px;display:grid;place-items:center;background:linear-gradient(145deg,#3b82f6,#6366f1);color:#fff;font-weight:850;font-size:20px;box-shadow:0 9px 25px rgba(37,99,235,.34)}
.brand-logo{width:42px;height:42px;border-radius:12px;display:block;object-fit:cover;box-shadow:0 5px 12px rgba(12,43,88,.14);flex:0 0 auto}.sidebar .brand-logo{width:32px!important;height:32px!important;max-width:32px!important;max-height:32px!important;border-radius:8px!important;box-shadow:0 3px 8px rgba(12,43,88,.12)!important;flex:0 0 32px!important}
.brand strong{display:block;font-size:15px;letter-spacing:-.01em}
.brand small{display:block;color:#7c6d37;margin-top:3px;font-size:10.5px}

.brand-copy{min-width:0}.brand-user-line{font-size:10px!important;color:#665820!important;font-weight:750!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:170px}.brand-user-line #sidebarUserRole{text-transform:uppercase;font-size:8.5px;letter-spacing:.04em;color:#8a762b}
.sidebar-user-card{margin:0 8px 20px;padding:12px 13px;border:1px solid #e5d182;background:rgba(255,255,255,.62);border-radius:13px;display:grid;gap:2px;box-shadow:0 4px 12px rgba(111,88,15,.045)}
.sidebar-user-label{font-size:8.5px;font-weight:900;letter-spacing:.11em;color:#9b7e25}
.sidebar-user-card strong{font-size:14px;color:#202a38;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sidebar-user-card small{font-size:10px;color:#796c47;text-transform:uppercase;letter-spacing:.045em}

.main-nav{display:grid;gap:6px}
.nav-item{border:1px solid transparent;background:transparent;color:#536071;padding:11px 13px;border-radius:12px;display:flex;align-items:center;gap:12px;text-align:left;cursor:pointer;transition:.16s ease}
.nav-item:hover{background:rgba(255,255,255,.58);color:#1e293b}
.nav-item.active{background:#ffffff;border-color:#e4cf71;color:#172033;box-shadow:inset 3px 0 0 #d3a600,0 4px 12px rgba(124,98,20,.07)}
.nav-item span{width:21px;text-align:center;font-size:17px}
.sidebar-footer{margin-top:auto;display:grid;gap:5px;border-top:1px solid #e3d28a;padding-top:14px}
.link-button{border:0;background:transparent;color:#6f674d;text-align:left;padding:8px 10px;cursor:pointer;font-size:11.5px;border-radius:9px}
.link-button:hover{color:#263244;background:rgba(255,255,255,.6)}
.file-label{display:block}
.server-pill{font-size:11px;color:#756b49;display:flex;align-items:center;gap:8px;padding:8px 10px;margin-bottom:4px}
.server-dot{width:8px;height:8px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 4px rgba(34,197,94,.1)}

/* Estructura */
.main{margin-left:252px;min-height:100vh;padding:26px 32px 42px}
.topbar{min-height:70px;display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:22px}
.eyebrow{font-size:10.5px;letter-spacing:.14em;color:#8794a8;font-weight:800;margin:0 0 5px}
.topbar h1{font-size:30px;margin:0;letter-spacing:-.04em;font-weight:780}
.top-actions{display:flex;gap:9px}
.view{display:grid;gap:18px}
.card{background:rgba(255,255,255,.97);border:1px solid rgba(219,226,237,.9);border-radius:var(--radius);box-shadow:var(--shadow-soft);overflow:hidden}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:17px 19px;border-bottom:1px solid var(--line)}
.card-head h2{font-size:14.5px;margin:0;letter-spacing:-.01em}
.card-head .meta{color:var(--muted);font-size:11.5px}
.card-body{padding:18px 19px}
.grid-2{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(290px,.85fr);gap:18px}

/* Botones y controles */
.btn{border:0;border-radius:11px;padding:10px 14px;font-weight:700;cursor:pointer;transition:.15s ease;display:inline-flex;align-items:center;justify-content:center;gap:7px;white-space:nowrap}
.btn:hover{transform:translateY(-1px)}
.btn.primary{background:linear-gradient(180deg,#3478f6,#2563eb);color:white;box-shadow:0 8px 18px rgba(37,99,235,.18)}
.btn.primary:hover{background:linear-gradient(180deg,#2d6ee9,#1d4ed8);box-shadow:0 10px 22px rgba(37,99,235,.24)}
.btn.secondary{background:#fff;color:#344054;border:1px solid var(--line);box-shadow:0 1px 2px rgba(15,23,42,.02)}
.btn.secondary:hover{border-color:#cbd5e1;background:#fbfcfe}
.btn.ghost{background:var(--surface-2);color:var(--ink)}
.btn.danger{background:var(--bad-bg);color:var(--bad)}
.btn.small{padding:7px 11px;font-size:11.5px}
.btn-icon{font-size:14px;line-height:1}
.btn.excel-export{background:#fff;color:#215b3d;border:1px solid #c9dfd2;box-shadow:0 1px 2px rgba(15,23,42,.025)}
.btn.excel-export:hover{background:#f2faf5;border-color:#9fc7ad;box-shadow:0 7px 16px rgba(16,124,65,.10)}
.btn.excel-export.icon-only{width:38px;height:34px;padding:5px;gap:0} 
.btn.excel-export.icon-only .excel-app-icon{width:23px;height:23px;flex-basis:23px}
.btn.excel-export.icon-only .excel-app-icon svg{width:23px;height:23px}
.excel-app-icon{width:22px;height:22px;display:inline-grid;place-items:center;flex:0 0 22px}
.excel-app-icon svg{width:22px;height:22px;display:block}
.excel-sheet{fill:#e9f5ee;stroke:#88b89c;stroke-width:1}
.excel-grid{fill:none;stroke:#78a88c;stroke-width:1;stroke-linecap:round;opacity:.8}
.excel-x-box{fill:#107c41}
.excel-x{fill:none;stroke:#fff;stroke-width:2;stroke-linecap:round}
.search{min-width:260px;flex:1;position:relative}
.search input,.field input,.field select,.field textarea,.select{width:100%;border:1px solid var(--line);background:#fff;border-radius:11px;padding:10px 12px;outline:none;color:var(--ink);transition:.14s ease}
.search input:focus,.field input:focus,.field select:focus,.field textarea:focus,.select:focus{border-color:#8bb0fa;box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.select{width:auto}
.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.toolbar-spacer{flex:1}
.count-label{font-size:12px;color:var(--muted);margin-left:auto}
.filters-card{padding:13px 15px}
.companies-toolbar-card{overflow:visible}
.company-result-summary{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:12px;flex-wrap:wrap;min-width:0}
.company-result-summary .company-count{font-size:20px;line-height:1;color:var(--ink);font-weight:800;letter-spacing:-.03em}
.active-filter-count{margin-left:8px;background:#edf3ff;color:#315fae;border:1px solid #dbe7ff;border-radius:999px;padding:4px 8px;font-size:10.5px;font-weight:700}

/* KPIs y dashboard */
.kpi-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.kpi{background:rgba(255,255,255,.98);border:1px solid rgba(219,226,237,.95);border-radius:16px;padding:16px;min-width:0;box-shadow:0 5px 18px rgba(15,23,42,.035)}
.kpi .label{font-size:11.5px;color:var(--muted);margin-bottom:8px;font-weight:600}
.kpi .value{font-size:28px;font-weight:820;letter-spacing:-.045em}
.kpi .sub{font-size:10.5px;color:#8a97aa;margin-top:5px}
.kpi.accent{background:linear-gradient(145deg,#1e56d4,#3478f6);color:#fff;border-color:transparent;box-shadow:0 12px 25px rgba(37,99,235,.2)}
.kpi.accent .label,.kpi.accent .sub{color:#dce9ff}
.task-list{display:grid;gap:8px}
.task{border:1px solid var(--line);border-radius:13px;padding:11px 12px;display:grid;grid-template-columns:auto 1fr auto;gap:11px;align-items:center;cursor:pointer;transition:.14s ease;background:#fff}
.task:hover{background:#fafcff;border-color:#d7e0eb;transform:translateY(-1px)}
.task-date{width:44px;height:44px;border-radius:11px;background:#eef2ff;color:#4338ca;display:grid;place-items:center;text-align:center;font-weight:800;line-height:1}
.task-date small{font-size:9px;text-transform:uppercase}
.task .title{font-weight:750;font-size:12.5px}
.task .desc{font-size:10.5px;color:var(--muted);margin-top:3px;max-width:500px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.task.overdue .task-date{background:var(--bad-bg);color:var(--bad)}
.empty{padding:32px;text-align:center;color:var(--muted);font-size:12.5px}
.funnel{display:grid;gap:12px}.funnel-row{display:grid;grid-template-columns:130px 1fr 60px;gap:12px;align-items:center;font-size:12px}.bar{height:10px;background:#edf1f7;border-radius:999px;overflow:hidden}.bar>span{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#2563eb,#73a5ff)}
.product-sales-summary{display:grid;gap:14px}.product-total-link{width:100%;border:1px solid #cfe0d5;background:linear-gradient(145deg,#f0f9f3,#e6f4ea);border-radius:16px;padding:16px 18px;display:grid;grid-template-columns:1fr auto;grid-template-areas:"label amount" "units amount";gap:3px 18px;align-items:center;text-align:left;cursor:pointer;color:#244433;transition:.14s ease}.product-total-link:hover{border-color:#a9cbb5;background:linear-gradient(145deg,#eaf7ee,#dff0e5);transform:translateY(-1px)}.product-total-link:disabled{cursor:default;opacity:.62;transform:none}.product-total-label{grid-area:label;font-size:11px;font-weight:850;text-transform:uppercase;letter-spacing:.07em;color:#548064}.product-total-amount{grid-area:amount;font-size:34px;line-height:1;font-weight:900;letter-spacing:-.045em;color:#176b3a;white-space:nowrap}.product-total-units{grid-area:units;font-size:11px;color:#648172;font-weight:700}.product-list{display:grid;gap:7px}.product-row{width:100%;border:1px solid transparent;background:transparent;display:grid;grid-template-columns:80px 1fr auto 16px;gap:12px;align-items:center;padding:8px 9px;border-radius:11px;text-align:left;color:inherit;font:inherit}.product-row-link.has-sales{cursor:pointer}.product-row-link.has-sales:hover{background:#f7faf8;border-color:#e1ebe4}.product-row-link.no-sales{opacity:.55;cursor:default}.product-row .money{font-weight:800}.sales-row-arrow{font-size:20px;line-height:1;color:#93a39a}.product-row-link.has-sales:hover .sales-row-arrow{color:#176b3a}.mini-bar{height:7px;border-radius:999px;background:#eef2f7;overflow:hidden;margin-top:5px}.mini-bar span{display:block;height:100%;background:linear-gradient(90deg,#34865b,#80b995)}
.notice{border:1px solid #f0d99c;background:#fffaf0;border-radius:15px;padding:13px 15px;font-size:11.5px;color:#7b560e;display:flex;gap:10px;align-items:flex-start}.notice strong{display:block;color:#64440a;margin-bottom:2px}.notice .icon{font-size:17px}
.stat-boxes{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.stat-box{padding:18px;border-radius:14px;background:var(--surface-2);border:1px solid var(--line)}.stat-box .big{font-size:28px;font-weight:850}.stat-box small{color:var(--muted)}

/* Tablas generales */
.table-wrap{overflow:auto}
.data-table{width:100%;border-collapse:separate;border-spacing:0;font-size:12.5px}
.data-table th{color:#667085;font-size:11px;font-weight:700;text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);white-space:nowrap;background:#f8fafc}
.data-table td{padding:11px 12px;border-bottom:1px solid #edf1f6;vertical-align:middle;background:#fff}
.data-table tbody tr{cursor:pointer}
.data-table tbody tr:hover td{background:#f7faff}
.company-name{font-weight:760;color:#182235}
.company-sub{color:var(--muted);font-size:10.5px;margin-top:2px}
.badge{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:4px 8px;font-size:9.5px;font-weight:800;white-space:nowrap;border:1px solid transparent}
.badge.blue{background:var(--primary-2);color:#2459b3;border-color:#dce8ff}.badge.green{background:var(--good-bg);color:#067355;border-color:#d2f0e5}.badge.orange{background:var(--warn-bg);color:#a75a07;border-color:#f7e5c1}.badge.red{background:var(--bad-bg);color:#b42323;border-color:#f8d9d9}.badge.gray{background:#f0f3f7;color:#667085;border-color:#e5e9ef}.badge.purple{background:var(--purple-bg);color:var(--purple);border-color:#e4dcfb}.badge.teal{background:#e7f7f4;color:#08776d;border-color:#caeee7}.badge.cyan{background:#e6f6fb;color:#0b6e8a;border-color:#c6e9f3}.badge.amber{background:#fff3d9;color:#9a5a00;border-color:#f4dfae}.badge.indigo{background:#eceeff;color:#4d52b6;border-color:#d9dcfb}.badge.rose{background:#fdeef4;color:#a63f68;border-color:#f7d9e6}
.dot{width:7px;height:7px;border-radius:50%;background:currentColor}.muted{color:var(--muted)}.strong{font-weight:800}.right{text-align:right!important}.nowrap{white-space:nowrap}
.pager{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 15px;border-top:1px solid var(--line);font-size:11.5px;color:var(--muted);background:#fbfcfe}.pager.pager-top{border-top:0;border-bottom:1px solid var(--line)}.pager.pager-bottom{border-top:1px solid var(--line)}.pager-left{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.pager-controls{display:flex;gap:7px}.pager-size-picker{display:inline-flex;align-items:center;gap:7px;font-weight:700;color:#64748b}.pager-size-select{height:32px;min-width:82px;border:1px solid #d8e0e9;border-radius:9px;background:#fff;color:#334155;padding:0 28px 0 9px;font:inherit;font-weight:750;cursor:pointer;outline:none}.pager-size-select:focus{border-color:#9db8e8;box-shadow:0 0 0 3px rgba(37,99,235,.09)}

/* Empresas: scroll superior, orden y filtros por lupa */
.companies-card{overflow:hidden;box-shadow:var(--shadow)}
.companies-table-wrap{position:relative;max-width:100%;scrollbar-color:#aeb9c8 #edf1f5;scrollbar-width:thin}
.companies-table{min-width:2050px}
.sortable-table thead{position:sticky;top:0;z-index:5}
.sortable-table thead th{position:relative;padding:0;background:#f8fafc;border-bottom:1px solid #dce3ec}
.column-head{position:relative;min-height:45px;display:flex;align-items:stretch}
.sortable-table .sort-head{flex:1;min-width:0;border:0;background:transparent;color:#536174;font:inherit;font-size:11px;font-weight:750;text-align:left;padding:0 4px 0 12px;cursor:pointer;white-space:nowrap;display:flex;align-items:center;gap:7px;transition:.12s ease}
.sortable-table th.right .sort-head{justify-content:flex-end;text-align:right}
.sortable-table .sort-head:hover{color:#172033;background:#f2f6fb}
.sort-indicator{width:13px;text-align:center;font-size:11px}.sort-indicator.neutral{color:#b5bfcc;font-size:10px}.sort-indicator.active{color:#2563eb;font-weight:900}
.filter-trigger{width:34px;min-width:34px;border:0;border-left:1px solid transparent;background:transparent;color:#9aa6b6;display:grid;place-items:center;cursor:pointer;transition:.14s ease;margin:7px 5px 7px 0;border-radius:8px}
.filter-trigger svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round}
.filter-trigger:hover{background:#eaf1fb;color:#4f6f9e}
.filter-trigger.active{background:#e5efff;color:#2563eb;box-shadow:inset 0 0 0 1px #cbdcff}
.column-filter-popover{position:absolute;z-index:40;top:41px;left:8px;width:240px;padding:12px;background:rgba(255,255,255,.99);border:1px solid #dbe3ed;border-radius:14px;box-shadow:0 18px 45px rgba(15,23,42,.18);text-align:left;animation:filterPop .12s ease-out}
th.right .column-filter-popover{left:auto;right:7px}
@keyframes filterPop{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}
.filter-popover-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}
.filter-popover-head div{display:grid;gap:1px}.filter-popover-head span{font-size:9.5px;color:#8b98aa;font-weight:650}.filter-popover-head strong{font-size:12px;color:#263247;font-weight:780}
.filter-clear-one{border:0;background:transparent;color:#2563eb;font-size:10px;font-weight:700;padding:5px;cursor:pointer;border-radius:7px}.filter-clear-one:hover{background:#edf3ff}
.column-filter{width:100%;min-width:0;border:1px solid #d9e1eb;border-radius:10px;background:#fff;padding:8px 9px;font-size:11.5px;color:var(--ink);outline:none;text-transform:none;letter-spacing:normal;font-weight:450}
.column-filter:focus{border-color:#84aaf5;box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.column-filter.compact{min-width:0}
.table-scroll-top{height:14px;overflow-x:auto;overflow-y:hidden;background:#f8fafc;border-bottom:1px solid #e4e9f0;scrollbar-color:#aeb9c8 #edf1f5;scrollbar-width:thin}
.table-scroll-top-inner{height:1px;min-width:100%}
.table-scroll-top::-webkit-scrollbar,.companies-table-wrap::-webkit-scrollbar,.followup-table-wrap::-webkit-scrollbar,.calls-table-wrap::-webkit-scrollbar{height:10px;width:10px}
.table-scroll-top::-webkit-scrollbar-track,.companies-table-wrap::-webkit-scrollbar-track,.followup-table-wrap::-webkit-scrollbar-track,.calls-table-wrap::-webkit-scrollbar-track{background:#edf1f5;border-radius:999px}
.table-scroll-top::-webkit-scrollbar-thumb,.companies-table-wrap::-webkit-scrollbar-thumb,.followup-table-wrap::-webkit-scrollbar-thumb,.calls-table-wrap::-webkit-scrollbar-thumb{background:#b2bdcb;border-radius:999px;border:2px solid #edf1f5}
.table-scroll-top::-webkit-scrollbar-thumb:hover,.companies-table-wrap::-webkit-scrollbar-thumb:hover,.followup-table-wrap::-webkit-scrollbar-thumb:hover,.calls-table-wrap::-webkit-scrollbar-thumb:hover{background:#919dac}
.companies-table td{white-space:nowrap;transition:background .12s ease}
.companies-table td:nth-child(16){white-space:normal}
.notes-cell{width:420px;max-width:420px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#536174}
.zone-text{font-weight:760;color:#31445e}
.priority-row.priority-green td{background:#f4f9f1}
.priority-row.priority-red td{background:#fff3f3}
.priority-row.priority-green:hover td{background:#edf6e8}
.priority-row.priority-red:hover td{background:#ffeaea}
.priority-row.priority-green td:first-child{box-shadow:inset 3px 0 0 rgba(112,173,71,.42)}
.priority-row.priority-red td:first-child{box-shadow:inset 3px 0 0 rgba(220,38,38,.22)}
.companies-card .pager{position:sticky;left:0}

/* Seguimiento: mismas capacidades de tabla que Empresas */
.followup-card{overflow:hidden;box-shadow:var(--shadow)}
.followup-table-wrap{position:relative;max-width:100%;scrollbar-color:#aeb9c8 #edf1f5;scrollbar-width:thin}
.followup-table{min-width:1280px}
.followup-table td{white-space:nowrap;transition:background .12s ease}
.followup-table td:last-child{white-space:normal}
.followup-notes-cell{width:100%;max-width:460px;white-space:normal;overflow-wrap:anywhere;word-break:break-word;line-height:1.4;color:#536174}
.followup-table tbody tr:hover td{background:#f3f7fc}

/* Llamadas nuevas */
.calls-card{overflow:hidden;box-shadow:var(--shadow)}
.calls-table-wrap{position:relative;max-width:100%;scrollbar-color:#aeb9c8 #edf1f5;scrollbar-width:thin}
.calls-table{min-width:1960px}
.calls-table td{white-space:nowrap;transition:background .12s ease}
.calls-table tbody tr:hover td{background:#f5f8fc}
.calls-notes-cell{width:430px;max-width:430px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#536174}
.edit-column,.edit-cell{width:48px;min-width:48px;text-align:center}
.row-edit-btn,.timeline-edit-btn{border:1px solid #dfe6ef;background:#fff;color:#617087;width:30px;height:30px;border-radius:9px;display:inline-grid;place-items:center;cursor:pointer;transition:.14s ease}
.row-edit-btn:hover,.timeline-edit-btn:hover{background:#edf4ff;border-color:#c8d9f6;color:#2563eb;transform:translateY(-1px)}
.timeline-title-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.timeline-edit-btn{width:27px;height:27px;flex:0 0 27px}
.activity-audit{display:flex;flex-wrap:wrap;gap:8px 18px;padding:10px 12px;border-radius:11px;background:#f8fafc;border:1px solid var(--line);color:#718096;font-size:10.5px}
.activity-audit strong{color:#3b475a;font-weight:750}
.field-help{font-size:10px;color:#8a97aa;margin-top:2px}

/* Selector editable del color de fila */
.row-tone-picker{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.tone-option{position:relative;display:grid;grid-template-columns:auto auto 1fr;gap:9px;align-items:center;border:1px solid var(--line);border-radius:12px;padding:10px 11px;background:#fff;cursor:pointer;transition:.14s ease}
.tone-option:hover{border-color:#c4ceda;transform:translateY(-1px)}
.tone-option input{width:auto;margin:0;accent-color:#2563eb}
.tone-option .tone-swatch{width:24px;height:24px;border-radius:8px;border:1px solid rgba(15,23,42,.08);box-shadow:inset 0 0 0 1px rgba(255,255,255,.45)}
.tone-option.tone-green .tone-swatch{background:#e8f3e2}
.tone-option.tone-red .tone-swatch{background:#fde5e5}
.tone-option.tone-none .tone-swatch{background:linear-gradient(135deg,#fff 0 45%,#d7dee8 46% 54%,#fff 55% 100%)}
.tone-option strong{display:block;font-size:11.5px;color:#2a3548}
.tone-option small{display:block;font-size:9.5px;color:var(--muted);margin-top:2px}
.tone-option:has(input:checked){border-color:#8eb0e9;box-shadow:0 0 0 3px rgba(37,99,235,.08);background:#fbfdff}

/* Formularios y diálogos */
.dialog{width:min(720px,calc(100vw - 28px));max-height:90vh;border:1px solid rgba(255,255,255,.7);border-radius:20px;padding:0;box-shadow:0 32px 90px rgba(15,23,42,.3);overflow:auto}
.dialog::backdrop{background:rgba(15,23,42,.48);backdrop-filter:blur(4px)}
.dialog-head{padding:20px 22px 14px;display:flex;justify-content:space-between;gap:15px;align-items:flex-start;border-bottom:1px solid var(--line);position:sticky;top:0;background:rgba(255,255,255,.97);backdrop-filter:blur(8px);z-index:2}.dialog-head h2{font-size:20px;margin:0;letter-spacing:-.02em}.dialog-head p{margin:4px 0 0;color:var(--muted);font-size:11.5px}.icon-btn{border:0;background:#f1f5f9;width:32px;height:32px;border-radius:10px;cursor:pointer;color:#64748b}.icon-btn:hover{background:#e7edf4;color:#1f2937}.dialog-body{padding:20px 22px}.dialog-actions{padding:14px 22px 20px;display:flex;justify-content:flex-end;gap:9px}.detail-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:16px}.detail-stat{background:var(--surface-2);border:1px solid var(--line);padding:12px;border-radius:13px}.detail-stat small{display:block;color:var(--muted);font-size:9.5px;text-transform:uppercase}.detail-stat strong{font-size:20px}.section-title{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:800;margin:20px 0 8px}.note-box{background:#f8fafc;border:1px solid var(--line);border-radius:12px;padding:13px;white-space:pre-wrap;font-size:12.5px;line-height:1.5}.timeline{display:grid;gap:0}.timeline-item{display:grid;grid-template-columns:14px 1fr;gap:10px;padding:10px 0}.timeline-item:not(:last-child){border-bottom:1px solid #edf0f5}.timeline-dot{width:9px;height:9px;border-radius:50%;background:#2563eb;margin-top:4px}.timeline-item .t-title{font-size:12px;font-weight:800}.timeline-item .t-meta{font-size:10px;color:var(--muted);margin-top:2px}.timeline-item .t-note{font-size:12px;margin-top:4px}.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field{display:grid;gap:6px}.field.full{grid-column:1/-1}.field label{font-size:10.5px;color:#69778b;font-weight:720}.field textarea{min-height:88px;resize:vertical}.check-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.check-item,.check-card{display:flex;gap:8px;align-items:center;padding:10px 12px;border:1px solid var(--line);border-radius:11px;background:#fff;font-size:11.5px}.check-item input{width:auto}.money-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.toast{position:fixed;right:24px;bottom:24px;background:#111827;color:white;border-radius:11px;padding:11px 14px;font-size:11.5px;box-shadow:var(--shadow);opacity:0;transform:translateY(10px);pointer-events:none;transition:.2s;z-index:100}.toast.show{opacity:1;transform:translateY(0)}
.mobile-nav{display:none}

@media(max-width:1180px){.kpi-grid{grid-template-columns:repeat(3,1fr)}.grid-2{grid-template-columns:1fr}.detail-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:760px){
  body{padding-bottom:66px}.sidebar{display:none}.main{margin-left:0;padding:16px 14px 28px}.topbar{align-items:flex-start;margin-bottom:14px}.topbar h1{font-size:24px}.top-actions{gap:7px}.top-actions .secondary{display:none}.btn{padding:9px 10px;font-size:11.5px}.kpi-grid{grid-template-columns:repeat(2,1fr);gap:9px}.kpi{padding:13px}.kpi .value{font-size:24px}.card{border-radius:15px}.toolbar{align-items:stretch}.toolbar-spacer{display:none}.companies-toolbar{display:grid;grid-template-columns:1fr auto;gap:8px}.company-result-summary{grid-column:1/-1}.companies-toolbar .primary{grid-column:1/-1}.search{min-width:100%;width:100%}.select{flex:1}.count-label{width:100%;margin:0}.data-table{min-width:690px}.companies-table{min-width:2050px}.calls-table{min-width:1850px}.notes-cell{width:300px;max-width:300px}.calls-notes-cell{width:300px;max-width:300px}.mobile-nav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;bottom:0;left:0;right:0;background:rgba(255,255,255,.97);backdrop-filter:blur(10px);border-top:1px solid var(--line);z-index:40;padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -8px 24px rgba(15,23,42,.06)}.mobile-nav-item{height:60px;border:0;background:transparent;color:#77869b;display:grid;place-items:center;align-content:center;gap:2px;font-size:18px}.mobile-nav-item small{font-size:9px}.mobile-nav-item.active{color:#2563eb;font-weight:800}.field-grid{grid-template-columns:1fr}.field.full{grid-column:auto}.detail-grid{grid-template-columns:repeat(2,1fr)}.check-grid,.money-grid,.row-tone-picker{grid-template-columns:1fr}.dialog{max-height:94vh}.dialog-head,.dialog-body,.dialog-actions{padding-left:16px;padding-right:16px}.toast{left:14px;right:14px;bottom:78px;text-align:center}.stat-boxes{grid-template-columns:1fr}.funnel-row{grid-template-columns:105px 1fr 45px}.column-filter-popover{position:fixed;left:14px!important;right:14px!important;top:auto;bottom:76px;width:auto;z-index:70}
}

/* v2.7 · selector visual de fechas y borrado de registros */
.column-filter-popover:has(.date-calendar-filter){width:306px;padding:12px 13px 13px}
.date-calendar-filter{display:grid;gap:10px;user-select:none}
.calendar-toolbar{display:grid;grid-template-columns:34px 1fr 34px;align-items:center;gap:6px}
.calendar-month-label{text-align:center;color:#263247;font-size:12px;font-weight:820;text-transform:capitalize}
.calendar-nav{width:34px;height:32px;border:1px solid #dce3ec;background:#fff;color:#536174;border-radius:9px;display:grid;place-items:center;font-size:20px;line-height:1;cursor:pointer;transition:.14s ease}
.calendar-nav:hover{background:#edf4ff;border-color:#c6d8f6;color:#2459b3}
.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:3px;align-items:center}
.calendar-weekday{height:22px;display:grid;place-items:center;color:#94a0b0;font-size:9px;font-weight:800;text-transform:uppercase}
.calendar-empty{height:32px}
.calendar-day{position:relative;height:32px;min-width:0;border:0;background:transparent;border-radius:9px;color:#344054;font-size:10.5px;font-weight:680;cursor:pointer;font-variant-numeric:tabular-nums;transition:.12s ease}
.calendar-day:hover{background:#edf4ff;color:#2459b3}
.calendar-day.today{box-shadow:inset 0 0 0 1px #a8b8ca}
.calendar-day.in-range{background:#eaf2ff;border-radius:3px;color:#2459b3}
.calendar-day.range-start,.calendar-day.range-end,.calendar-day.single-day{background:#2563eb;color:#fff;border-radius:9px;box-shadow:none}
.calendar-day.range-start:not(.range-end){border-top-right-radius:3px;border-bottom-right-radius:3px}
.calendar-day.range-end:not(.range-start){border-top-left-radius:3px;border-bottom-left-radius:3px}
.calendar-selection{min-height:30px;padding:8px 9px;border-radius:9px;background:#f8fafc;border:1px solid #e5eaf0;color:#64748b;font-size:9.8px;line-height:1.35;text-align:center}
.calendar-actions{display:grid;grid-template-columns:auto auto 1fr;gap:7px}
.calendar-actions button{border:1px solid #dbe3ed;background:#fff;color:#64748b;border-radius:9px;padding:8px 9px;font-size:10px;font-weight:760;cursor:pointer;transition:.14s ease}
.calendar-actions button:hover{background:#f4f7fb;color:#344054}
.calendar-actions .calendar-apply{background:#2563eb;border-color:#2563eb;color:#fff}
.calendar-actions .calendar-apply:hover{background:#1f57cf;border-color:#1f57cf;color:#fff}

.row-actions-column,.row-actions-cell{width:78px;min-width:78px;text-align:center!important}
.row-actions-column{padding:0!important}
.row-actions-cell{padding:7px 9px!important;white-space:nowrap!important}
.row-actions{display:flex;justify-content:center;align-items:center;gap:6px}
.row-trash-btn,.timeline-trash-btn{border:1px solid #eadfe1;background:#fff;color:#a65a62;width:30px;height:30px;border-radius:9px;display:inline-grid;place-items:center;cursor:pointer;transition:.14s ease}
.row-trash-btn svg,.timeline-trash-btn svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.row-trash-btn:hover,.timeline-trash-btn:hover{background:#fff0f1;border-color:#f1c7cb;color:#c92828;transform:translateY(-1px)}
.timeline-row-actions{display:flex;align-items:center;gap:6px;flex:0 0 auto}
.timeline-trash-btn{width:27px;height:27px;flex:0 0 27px}
.timeline-trash-btn svg{width:14px;height:14px}
.followup-table td:last-child{white-space:nowrap}

@media(max-width:760px){
  .column-filter-popover:has(.date-calendar-filter){padding:12px 13px 14px}
}

@media(max-width:760px){
  .column-filter-popover:has(.date-calendar-filter){width:auto!important;left:14px!important;right:14px!important}
  .calendar-day{height:36px;font-size:11px}
}

/* v2.8 · área mínima de resultados para que los filtros no queden recortados */
.companies-table-wrap,.followup-table-wrap,.calls-table-wrap{min-height:510px}
@media(max-width:760px){
  .companies-table-wrap,.followup-table-wrap,.calls-table-wrap{min-height:440px}
}

/* v2.9 · resumen visible de filtros y seguimiento completo */
.company-result-summary{flex-wrap:wrap;align-items:center;row-gap:6px}
.active-filter-count{display:inline-flex;align-items:center;flex-wrap:wrap;gap:5px 7px;max-width:100%;white-space:normal;line-height:1.35}
.active-filter-total{font-weight:800}
.active-filter-item{font-weight:600;color:#274e91;background:rgba(255,255,255,.58);border-radius:999px;padding:1px 6px}
.active-filter-item strong{font-weight:800}
.active-filter-sep{color:#8aa4cf;font-weight:900}
.followup-table{min-width:4300px}
.followup-col-notes{min-width:460px;max-width:460px}
.followup-col-company{min-width:220px}
.followup-col-productText{min-width:210px}
.followup-col-invoiced,.followup-col-database,.followup-col-excel,.followup-col-implementation{min-width:125px}
.followup-money{font-variant-numeric:tabular-nums;font-weight:750;color:#29384c}
.followup-rating{font-variant-numeric:tabular-nums;font-weight:750;color:#536174}
@media(max-width:760px){.active-filter-count{border-radius:12px;padding:6px 8px}.active-filter-item{max-width:100%;overflow:hidden;text-overflow:ellipsis}.followup-table{min-width:4300px}}

/* v3.0 · agenda de acciones realizadas y por realizar */
.planned-date{font-weight:720;color:#315b96}.overdue-text{color:#b42318;font-weight:850}
.pending-action-row td{background:rgba(255,247,214,.48)}
.pending-action-row:hover td{background:rgba(255,242,191,.68)!important}
.timeline-pending{background:linear-gradient(90deg,rgba(255,247,214,.55),transparent);border-radius:10px;padding-left:7px;padding-right:7px}
.timeline-pending .timeline-dot{background:#d97706}
.timeline-title-row .badge{margin-right:7px;vertical-align:middle}
.field-disabled{opacity:.48}.field-disabled input,.field-disabled select{cursor:not-allowed;background:#f4f6f8}
.action-form-note{grid-column:1/-1;margin-top:14px;padding:11px 13px;border:1px solid #dce5f0;border-radius:11px;background:#f8fbff;color:#536174;font-size:11.5px;line-height:1.45}
.action-form-note strong{color:#263247}

/* v3.1 · Seguimiento compacto por productos */
.followup-table{min-width:3050px}
.followup-col-products_group{min-width:150px}
.followup-col-combo_eris,.followup-col-combo_trazor,.followup-col-combo_kotaia,.followup-col-combo_gesdoc,.followup-col-combo_erpin{min-width:150px}
.followup-product-icons{display:flex;align-items:center;gap:4px;min-height:30px}
.followup-product-icon{width:28px;height:28px;object-fit:contain;display:block;border-radius:50%}
.followup-product-icon.header-icon{width:22px;height:22px}
.followup-combo-cell{display:flex;align-items:baseline;gap:6px;white-space:nowrap}
.followup-combo-sep{color:#a3adba}
.muted-dash{color:#9aa5b1}
.product-combo-head{min-width:138px;display:grid;grid-template-columns:1fr auto;grid-template-areas:"title filter" "sort sort";gap:3px 4px;align-items:center}
.product-combo-title{grid-area:title;display:flex;align-items:center;gap:5px;font-weight:800;color:#26354a;min-width:0}
.product-combo-sorters{grid-area:sort;display:flex;gap:4px;align-items:center}
.product-combo-head>.filter-trigger{grid-area:filter}
.mini-sort{border:0;background:transparent;color:#657286;font:inherit;font-size:11px;font-weight:750;padding:2px 4px;border-radius:6px;cursor:pointer;display:inline-flex;align-items:center;gap:2px}
.mini-sort:hover{background:#edf3f9;color:#243448}
.followup-static-head{font-weight:800;color:#26354a;white-space:nowrap}
.followup-group-filter{min-width:220px}
.filter-mini-label{display:block;font-size:11px;font-weight:750;color:#66758a;margin:8px 0 4px}
@media(max-width:760px){.followup-table{min-width:3050px}}

/* v3.4 · temperatura comercial en escala verde + tono dominante exacto por fila */
.followup-heat-legend{display:flex;align-items:center;flex-wrap:wrap;gap:6px 7px;padding:0 14px 11px;color:#66758a;font-size:10.5px}
.followup-heat-legend .legend-title{font-weight:800;color:#46556a;margin-right:2px}
.heat-key{display:inline-flex;align-items:center;justify-content:center;min-height:24px;padding:3px 8px;border:1px solid rgba(100,116,139,.18);border-radius:999px;font-weight:800;color:#425166}
.heat-sold{background:#e2f2e6!important}
.heat-rating-1{background:#e8f4eb!important}
.heat-rating-2{background:#eef7f0!important}
.heat-rating-3{background:#f4faf5!important}
.heat-rating-4{background:#f9fcfa!important}
.heat-rejected{background:#fff!important}
.followup-temperature-row.heat-sold td{background:#e2f2e6}
.followup-temperature-row.heat-rating-1 td{background:#e8f4eb}
.followup-temperature-row.heat-rating-2 td{background:#eef7f0}
.followup-temperature-row.heat-rating-3 td{background:#f4faf5}
.followup-temperature-row.heat-rating-4 td{background:#f9fcfa}
.followup-temperature-row.heat-rejected td{background:#fff}
.followup-heat-cell{transition:background-color .12s ease,box-shadow .12s ease}
/* Product cells always retain their own temperature, even when the rest of the row uses another one. */
.followup-temperature-row td.followup-heat-cell.heat-sold{background:#e2f2e6!important}
.followup-temperature-row td.followup-heat-cell.heat-rating-1{background:#e8f4eb!important}
.followup-temperature-row td.followup-heat-cell.heat-rating-2{background:#eef7f0!important}
.followup-temperature-row td.followup-heat-cell.heat-rating-3{background:#f4faf5!important}
.followup-temperature-row td.followup-heat-cell.heat-rating-4{background:#f9fcfa!important}
.followup-temperature-row td.followup-heat-cell.heat-rejected{background:#fff!important}
.followup-table tbody tr.followup-temperature-row:hover td{box-shadow:inset 0 0 0 9999px rgba(255,255,255,.11)}
.followup-table tbody tr.followup-temperature-row:hover td.followup-heat-cell{box-shadow:inset 0 0 0 9999px rgba(255,255,255,.08)}
.followup-rating-state{display:inline-flex;align-items:center;min-height:20px;padding:1px 6px;border-radius:999px;font-size:9px;font-weight:850;letter-spacing:.01em;white-space:nowrap}
.followup-rating-state.sold{background:#176b3a;color:#fff}
.followup-rating-state.rejected{background:#eef1f4;color:#697586}
.sold-product-picker{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.sold-product-option{display:flex;align-items:center;gap:9px;min-height:54px;padding:8px 10px;border:1px solid #dfe6ef;border-radius:12px;background:#fff;cursor:pointer;transition:.14s ease}
.sold-product-option:hover{border-color:#b9c9df;background:#f8fbff}
.sold-product-option input{width:17px;height:17px;accent-color:#1f7a46;flex:0 0 auto}
.sold-product-option .followup-product-icon{width:31px;height:31px;flex:0 0 31px}
.sold-product-option span:last-child{display:grid;gap:1px;min-width:0}
.sold-product-option strong{font-size:11.5px;color:#26354a}
.sold-product-option small{font-size:9.7px;color:#7b8798}
.sold-product-option.already-sold{background:#edf9f1;border-color:#b8dfc4;cursor:default}
.sold-product-option.already-sold input{cursor:not-allowed}
.empty-inline{padding:10px 12px;border:1px dashed #d8e0ea;border-radius:11px;background:#fafbfd;color:#7b8798;font-size:11px}
.company-flags{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:760px){.sold-product-picker,.company-flags{grid-template-columns:1fr}.followup-heat-legend{padding-left:10px;padding-right:10px}}

@media(max-width:760px){.pager{align-items:flex-start;flex-direction:column}.pager-controls{width:100%}.pager-controls .btn{flex:1}.pager-left{width:100%;justify-content:space-between}}

/* v3.5 · paginación superior/inferior y ventas navegables */
@media(max-width:760px){.product-total-link{grid-template-columns:1fr;grid-template-areas:"label" "amount" "units";gap:5px}.product-total-amount{font-size:30px}.product-row{grid-template-columns:64px 1fr auto 14px;gap:8px}}

.activity-hidden{display:none!important}
.sales-back-btn{white-space:nowrap}

/* v3.9 · edición completa de acciones pendientes */
.activity-field-secondary{opacity:.72}
.activity-field-secondary:focus-within{opacity:1}
.complete-pending-btn{border-color:#b7decf;background:#eef8f4;color:#087355}
.complete-pending-btn:hover{background:#e2f3ec}


/* v4.0 · acceso multiusuario */
.auth-screen{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 20% 10%,#edf5ff 0,transparent 34%),linear-gradient(145deg,#f8fafc,#edf2f7)}
.auth-screen[hidden]{display:none}
.auth-card{width:min(440px,100%);background:#fff;border:1px solid #e2e8f0;border-radius:24px;padding:30px;box-shadow:0 24px 70px rgba(15,23,42,.12)}
.auth-brand{display:flex;align-items:center;gap:12px;margin-bottom:26px}.auth-brand .brand-mark{background:#0f172a;color:#fff}.auth-brand .brand-logo{width:52px;height:52px;border-radius:15px}.auth-brand strong{display:block;font-size:20px}.auth-brand small{color:#7b8aa0}
.auth-card h1{font-size:25px;margin:0 0 7px}.auth-card .auth-copy{color:#66758a;margin:0 0 22px;line-height:1.5}.auth-form{display:grid;gap:14px}.auth-form label{display:grid;gap:6px;font-size:12px;font-weight:750;color:#536174}.auth-form input{width:100%;border:1px solid #dbe3ed;border-radius:11px;padding:12px 13px;font:inherit;font-size:15px;outline:none}.auth-form input:focus{border-color:#6ea0e8;box-shadow:0 0 0 3px rgba(59,130,246,.10)}.auth-form .btn{margin-top:5px;justify-content:center}.auth-error{min-height:20px;color:#b42318;font-size:12px}
.scope-picker{display:flex;align-items:center;gap:7px;color:#6b7789;font-size:11px;font-weight:800}.scope-picker select{border:1px solid #dce3ec;background:#fff;border-radius:10px;padding:8px 28px 8px 10px;color:#243044;font:inherit;font-size:12px;max-width:180px}
.user-chip{display:flex;align-items:center;gap:8px;padding:9px 12px;border-radius:12px;background:#fff7d6;border:1px solid #ead68a;color:#2d3440;font-size:12px;font-weight:800;white-space:nowrap;box-shadow:0 3px 10px rgba(111,88,15,.06)}.user-chip::before{content:'●';color:#22a06b;font-size:10px}.user-role{font-size:9px;text-transform:uppercase;letter-spacing:.07em;color:#8b7440}
.user-table{min-width:820px}.user-status{display:inline-flex;align-items:center;gap:6px}.user-status::before{content:'';width:8px;height:8px;border-radius:50%;background:#22a06b}.user-status.inactive::before{background:#a8b1bf}
.user-card-actions{display:flex;gap:6px}.commercial-owner-badge{display:inline-flex;align-items:center;gap:6px;font-weight:750;color:#344054;white-space:nowrap}.commercial-owner-badge::before{content:'';width:7px;height:7px;border-radius:50%;background:#78a7e7}
@media(max-width:760px){.scope-picker{order:5;width:100%}.scope-picker select{max-width:none;flex:1}.user-chip{display:none}.top-actions{flex-wrap:wrap}.auth-card{padding:22px;border-radius:18px}}

/* v4.2 · corrección visual: barra amarilla clara e icono compacto */

/* v4.2 ajuste: sin tarjeta lateral de comercial */
.sidebar-user-card{display:none!important}

/* v4.3 · chip visible arriba a la derecha y limpieza de avisos */
.top-actions{align-items:center;flex-wrap:wrap}
.user-chip{display:inline-flex!important;align-items:center;gap:10px;padding:10px 14px;border-radius:14px;background:#fff7d6;border:1px solid #e6cf73;color:#273142;font-size:13px;font-weight:800;white-space:nowrap;box-shadow:0 4px 12px rgba(111,88,15,.08)}
.user-chip::before{content:"●";color:#22a06b;font-size:11px}
.user-chip .user-role{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:#8b7440}
.notice{display:none!important}
@media(max-width:760px){.user-chip{order:4;display:inline-flex!important;width:auto;max-width:100%}.top-actions #logoutBtn{order:5}}


/* v4.4 · acciones programadas independientes */
#scheduleActivityBtn{border-color:#d8c56e;background:#fff9dc;color:#51461e}
#scheduleActivityBtn:hover{background:#fff4bf;border-color:#c8ae3e}
@media(max-width:1050px){#scheduleActivityBtn{padding-left:10px;padding-right:10px}}

/* v4.5 · filtros activos eliminables uno a uno */
.active-filter-bar{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap;margin-left:8px;min-width:0}
.active-filter-label{font-size:10.5px;font-weight:800;color:#68778d;white-space:nowrap}
.active-filter-chip{display:inline-flex;align-items:center;gap:4px;max-width:360px;border:1px solid #d4e2fb;background:#eef4ff;color:#315d9e;border-radius:999px;padding:5px 7px 5px 9px;font-size:10.5px;line-height:1.15;cursor:pointer;transition:.14s ease;box-shadow:0 1px 2px rgba(37,99,235,.03)}
.active-filter-chip:hover{background:#e2edff;border-color:#b7cef5;color:#244c87}
.active-filter-chip:focus-visible{outline:2px solid #7da8ee;outline-offset:2px}
.active-filter-chip-label{font-weight:850;white-space:nowrap}
.active-filter-chip-value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.active-filter-chip-remove{display:grid;place-items:center;width:17px;height:17px;margin-left:2px;border-radius:50%;font-size:14px;line-height:1;color:#5677a9;background:rgba(255,255,255,.68);flex:0 0 17px}
.active-filter-chip:hover .active-filter-chip-remove{background:#fff;color:#1f4f91}
@media(max-width:760px){.active-filter-bar{margin-left:0;width:100%;padding-top:3px}.active-filter-chip{max-width:100%}}


/* v4.6 · estadísticas de Seguimiento coherentes */
.stat-box-subset{position:relative;border-style:dashed;background:#fbfcfe}
.stat-box-subset .stat-subnote{display:block;margin-top:4px;font-size:10px;color:#8794a8;font-weight:650}

/* v4.7 · navegación desde Estadísticas a Empresas */
.stat-box-link{appearance:none;width:100%;font:inherit;text-align:left;cursor:pointer;color:inherit;transition:transform .14s ease,border-color .14s ease,box-shadow .14s ease}
.stat-box-link:hover{transform:translateY(-2px);border-color:#b8c7da;box-shadow:0 8px 18px rgba(15,23,42,.07)}
.stat-box-link:focus-visible{outline:3px solid rgba(37,99,235,.20);outline-offset:2px}
.stat-open-hint{display:block;margin-top:8px;font-size:9.5px;font-weight:800;color:#5e79a2;letter-spacing:.01em}
.stats-origin-filter-bar{margin-top:6px}
.stats-origin-filter{background:#eef5ff;border-color:#bfd2f1}

/* v4.10 · columnas reordenables y persistentes por usuario */
.column-drag-handle{width:24px;min-width:24px;margin:7px 0 7px 4px;border-radius:7px;display:grid;place-items:center;align-self:stretch;color:#a1acba;cursor:grab;user-select:none;font-size:13px;font-weight:900;letter-spacing:-3px;line-height:1;transition:.14s ease}
.column-drag-handle:hover{background:#e9eef5;color:#536174}
.column-drag-handle:active{cursor:grabbing}
th.column-dragging{opacity:.55}
th.column-drag-over{box-shadow:inset 3px 0 0 #2563eb}
th.column-drag-over.column-drag-over-after{box-shadow:inset -3px 0 0 #2563eb}
.product-combo-head{grid-template-columns:auto 1fr auto;grid-template-areas:"drag title filter" "drag sort sort"}
.product-combo-head>.column-drag-handle{grid-area:drag;margin:4px 0 4px 2px;align-self:stretch}
.followup-static-head{flex:1;display:flex;align-items:center;padding-left:8px}

/* v4.11 · columnas compactas */
.sortable-table{width:max-content;min-width:100%;table-layout:auto}
.sortable-table th.col-compact,.sortable-table td.col-compact{width:1%;white-space:nowrap;padding-left:7px;padding-right:7px}
.sortable-table th.col-medium,.sortable-table td.col-medium{width:1%;white-space:nowrap;padding-left:9px;padding-right:9px}
.sortable-table th.col-company,.sortable-table td.col-company{min-width:165px}
.sortable-table th.col-notes,.sortable-table td.col-notes{min-width:250px;max-width:320px}
.sortable-table th.col-compact .column-drag-handle{width:18px;min-width:18px;margin-left:1px}
.sortable-table th.col-compact .filter-trigger{width:27px;min-width:27px;margin-right:2px}
.sortable-table th.col-compact .sort-head{padding-left:4px;padding-right:2px;gap:3px}
.sortable-table th.col-medium .column-drag-handle{width:20px;min-width:20px;margin-left:2px}
.sortable-table th.col-medium .filter-trigger{width:29px;min-width:29px;margin-right:3px}
.sortable-table th.col-medium .sort-head{padding-left:6px;padding-right:3px;gap:4px}
.companies-table,.followup-table,.calls-table{min-width:100%}
@media(max-width:760px){.companies-table,.followup-table,.calls-table{min-width:100%}}

/* v4.12 · agrupación Demo en Empresas */
.companies-table thead .company-column-groups th.company-group-head{height:25px;min-height:25px;padding:0 7px;background:#eef3f8;border-bottom:1px solid #dce3ec;color:#667085;font-size:10px;font-weight:850;letter-spacing:.055em;text-transform:uppercase;text-align:center;vertical-align:middle}
.companies-table thead .company-column-groups th.company-group-spacer,.companies-table thead .company-column-groups th.row-actions-group-spacer{color:transparent;background:#f8fafc}
.companies-table thead .company-column-groups th.demo-group-head{background:#e7eef8;color:#405a7a;border-left:1px solid #d8e1ed;border-right:1px solid #d8e1ed}
.companies-table thead .company-column-groups+tr th[data-column="demoAccepted"],.companies-table thead .company-column-groups+tr th[data-column="demoDone"]{background:#f3f6fb}


/* v4.14 · navegación con URLs reales por pantalla */
.nav-item,.mobile-nav-item{text-decoration:none}
.nav-item:visited,.mobile-nav-item:visited{color:inherit}


/* v4.15 · estadísticas navegables y actividad comercial */
.stats-kpi-link{font:inherit;color:inherit;text-align:left;width:100%;cursor:pointer;position:relative;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease}
.stats-kpi-link:hover{transform:translateY(-2px);border-color:#b9c9e2;box-shadow:0 10px 24px rgba(15,23,42,.08)}
.stats-kpi-link.accent:hover{border-color:transparent;box-shadow:0 14px 28px rgba(37,99,235,.27)}
.stats-open-hint{display:block;margin-top:8px;font-size:9.5px;font-weight:800;color:#3d6eaf}
.stats-kpi-link.accent .stats-open-hint{color:#dce9ff}
.stats-funnel-row{border:0;background:transparent;padding:4px 2px;width:100%;font:inherit;color:inherit;cursor:pointer;text-align:left;grid-template-columns:130px 1fr 60px 16px;border-radius:9px}
.stats-funnel-row:hover{background:#f6f9fd}
.stats-funnel-arrow{font-weight:900;color:#6e8fbd;text-align:right}
@media(max-width:760px){.stats-funnel-row{grid-template-columns:105px 1fr 45px 14px}}

/* v4.16 · Inicio navegable y Ventas centradas en productos */
.kpi.stats-kpi-link{appearance:none;border:1px solid rgba(219,226,237,.9);background:rgba(255,255,255,.97)}
.kpi.stats-kpi-link.accent{background:linear-gradient(180deg,#3478f6,#2563eb);border-color:transparent;color:#fff}

/* v4.17 · productos vendidos visibles en Empresas */
.company-sold-product-icons{display:flex;align-items:center;gap:3px;min-height:26px;white-space:nowrap}
.company-sold-product-icons .followup-product-icon{width:24px;height:24px;flex:0 0 24px;border-radius:50%;object-fit:contain}
.company-sold-product-icons .followup-product-icon.company-sold-icon{width:24px;height:24px}

/* v4.19 · estado de copias automáticas SQLite */
.backup-auto-status{font-size:10.5px;line-height:1.35;color:#756b49;padding:0 10px 7px;white-space:normal}


/* v4.20 · lista de campos visibles persistente */
.field-list-wrap{position:relative;display:inline-flex;align-items:center;z-index:45}
.field-list-trigger{gap:7px}
.field-list-trigger.active{background:#eef4ff;border-color:#b9cdf4;color:#244f91}
.field-list-count{display:inline-flex;align-items:center;justify-content:center;min-width:31px;height:19px;padding:0 6px;border-radius:999px;background:#eef1f5;color:#667085;font-size:9.5px;font-weight:850}
.field-list-trigger.active .field-list-count{background:#dce8fb;color:#315d9c}
.field-list-popover{position:absolute;z-index:90;right:0;top:calc(100% + 8px);width:285px;max-height:440px;overflow:hidden;background:#fff;border:1px solid #dbe3ed;border-radius:15px;box-shadow:0 20px 48px rgba(15,23,42,.18);text-align:left}
.field-list-title{display:grid;gap:2px;padding:12px 14px 10px;border-bottom:1px solid #edf0f4;background:#fbfcfe}
.field-list-title strong{font-size:12px;color:#273449}
.field-list-title span{font-size:10px;color:#7a8799;font-weight:500}
.field-list-items{max-height:365px;overflow:auto;padding:6px}
.field-list-item{width:100%;border:0;background:transparent;border-radius:9px;display:grid;grid-template-columns:28px 1fr;align-items:center;gap:7px;padding:8px 9px;color:#344054;text-align:left;cursor:pointer;font-size:11.5px;font-weight:650}
.field-list-item:hover{background:#f3f6fa}
.field-list-item.is-hidden{color:#98a2b3;background:#fafbfc}
.field-eye-icon{width:18px;height:18px;display:block;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.field-list-item:not(.is-hidden) .field-eye-icon{color:#2563eb}
.field-list-item.is-hidden .field-eye-icon{color:#a3adba}
@media(max-width:760px){.field-list-wrap{position:static}.field-list-popover{position:fixed;left:14px;right:14px;top:auto;bottom:76px;width:auto;max-height:70vh}.field-list-items{max-height:55vh}}

/* v4.21 · nombre de empresa más visible */
.company-name{font-size:14px;font-weight:820;line-height:1.2;color:#152033}


/* v4.22 · Observaciones de Seguimiento: nunca invaden la columna siguiente */
.followup-table td.followup-col-notes{
  width:460px;
  min-width:460px;
  max-width:460px;
  white-space:normal!important;
  vertical-align:top;
  overflow:hidden;
}
.followup-table td.followup-col-notes .followup-notes-cell{
  width:100%;
  max-width:100%;
  white-space:normal!important;
  overflow-wrap:anywhere;
  word-break:break-word;
  line-height:1.4;
}
@media(max-width:760px){
  .followup-table td.followup-col-notes{width:320px;min-width:320px;max-width:320px}
}

/* v4.23 · Observaciones de Empresas: salto de línea sin invadir columnas */
.companies-table td.col-notes{
  width:420px;
  min-width:420px;
  max-width:420px;
  white-space:normal!important;
  vertical-align:top;
  overflow:hidden;
}
.companies-table td.col-notes .notes-cell{
  width:100%;
  max-width:100%;
  white-space:normal!important;
  overflow:visible;
  text-overflow:clip;
  overflow-wrap:anywhere;
  word-break:break-word;
  line-height:1.4;
}
@media(max-width:760px){
  .companies-table td.col-notes{width:300px;min-width:300px;max-width:300px}
}

/* v4.25 · filtros Sí/No para demos y aviso de exclusión estadística */
.stats-exclusion-note{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#fff4dd;border:1px solid #eed29a;color:#8a5a05;font-size:10.5px;font-weight:800;white-space:nowrap}

/* v4.29 · búsqueda parcial de empresa en Acciones */
.activity-company-search{margin-bottom:7px}


/* v4.30 · navegación directa Empresas ↔ Seguimiento */
.company-jump-cell{display:flex;align-items:center;gap:7px;min-width:0}
.company-jump-cell .company-name{min-width:0;flex:0 1 auto}
.cross-view-btn{width:25px;height:25px;flex:0 0 25px;border:1px solid #d8e0ea;border-radius:8px;background:rgba(255,255,255,.72);color:#53657c;display:inline-grid;place-items:center;padding:0;line-height:1;font-size:14px;font-weight:800;cursor:pointer;box-shadow:0 1px 2px rgba(15,23,42,.035)}
.cross-view-btn:hover{background:#fff;border-color:#9eb6d2;color:#2563eb;transform:translateY(-1px)}
.cross-view-btn:focus-visible{outline:2px solid #2563eb;outline-offset:2px}
.actions-jump-btn{color:#7253a6}
.actions-jump-btn:hover{border-color:#b7a4d8;color:#6d28d9}

/* v4.33 · Nota de Acciones: salto de línea sin invadir columnas */
.calls-table td.col-notes{
  width:430px;
  min-width:430px;
  max-width:430px;
  white-space:normal!important;
  vertical-align:top;
  overflow:hidden;
}
.calls-table td.col-notes .calls-notes-cell{
  width:100%;
  max-width:100%;
  white-space:normal!important;
  overflow:visible;
  text-overflow:clip;
  overflow-wrap:anywhere;
  word-break:break-word;
  line-height:1.4;
}
@media(max-width:760px){
  .calls-table td.col-notes{width:300px;min-width:300px;max-width:300px}
}

/* v4.34 · fecha realizada con hora compacta */
.date-time-inline{display:grid;grid-template-columns:minmax(138px,1fr) 92px;gap:7px;align-items:center}
.date-time-inline input[type="date"],.date-time-inline input[type="time"]{min-width:0;width:100%}
.calls-table .col-performed-date{width:120px!important;min-width:120px!important;max-width:120px!important}
.performed-datetime{font-variant-numeric:tabular-nums;font-size:12px}
@media(max-width:760px){.date-time-inline{grid-template-columns:1fr 96px}}

/* v4.38 · encabezados de fecha compactos en Acciones */
.calls-table th.col-action-date{padding-left:2px;padding-right:2px}
.calls-table th.col-action-date .column-drag-handle{width:16px;min-width:16px;margin-left:1px;letter-spacing:-4px}
.calls-table th.col-action-date .filter-trigger{width:25px;min-width:25px;margin-right:1px}
.calls-table th.col-action-date .sort-head{padding-left:2px;padding-right:1px;gap:2px;overflow:hidden}
.calls-table th.col-action-date .sort-head>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis}
.calls-table th.col-action-date .sort-indicator{width:10px;min-width:10px;flex:0 0 10px}

/* v4.45 · filtro temporal de Actividad comercial */
.stats-activity-head{display:grid;grid-template-columns:minmax(120px,1fr) auto minmax(120px,1fr);align-items:center;gap:14px}
.stats-activity-head>h2{justify-self:start}
.stats-activity-head>.meta{justify-self:end;text-align:right}
.stats-date-filter{display:flex;align-items:end;justify-content:center;gap:7px;min-width:0;padding:5px 8px;border:1px solid var(--line);border-radius:11px;background:var(--surface-2)}
.stats-date-filter-title{align-self:center;font-size:10.5px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.stats-date-filter label{display:grid;gap:2px;font-size:9.5px;color:var(--muted);font-weight:700}
.stats-date-filter input{width:124px;min-width:0;padding:6px 7px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--text);font:inherit;font-size:11px}
.stats-date-filter .btn{padding:6px 9px;min-height:30px}
.stats-date-filter .btn:disabled{opacity:.45;cursor:default}
.stats-origin-toolbar{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:stretch;gap:10px;margin-bottom:12px}
.stats-origin-select{align-items:center}
.stats-origin-select select{min-width:130px;padding:6px 7px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--text);font:inherit;font-size:11px}
.stats-funnel-static{border:0;background:transparent;padding:4px 2px;width:100%;font:inherit;color:inherit;text-align:left;grid-template-columns:130px 1fr 60px 16px}
.stats-funnel-static:hover{background:transparent}
@media(max-width:1100px){.stats-activity-head{grid-template-columns:1fr}.stats-activity-head>h2,.stats-activity-head>.meta{justify-self:start}.stats-date-filter{justify-self:stretch;justify-content:flex-start;flex-wrap:wrap}.stats-date-filter input{width:132px}}
@media(max-width:760px){.stats-date-filter{align-items:end}.stats-date-filter-title{width:100%}.stats-date-filter label{flex:1;min-width:118px}.stats-date-filter input{width:100%}.stats-funnel-static{grid-template-columns:105px 1fr 45px 14px}}
.stats-period-note{margin-top:12px;padding:9px 11px;border-radius:9px;background:var(--surface-2);color:var(--muted);font-size:10.5px;line-height:1.35}


/* v4.51 - Calendario de acciones */
.calendar-shell{overflow:visible}
.calendar-main-toolbar{display:grid;grid-template-columns:auto minmax(220px,1fr) auto;align-items:center;gap:16px;padding:16px 18px;border-bottom:1px solid var(--line);background:#fff}
.calendar-nav-controls,.calendar-toolbar-right{display:flex;align-items:center;gap:7px}
.calendar-toolbar-right{justify-content:flex-end}
.calendar-range-title{margin:0;text-align:center;text-transform:capitalize;font-size:18px;letter-spacing:-.02em}
.calendar-view-switch{display:inline-flex;padding:3px;border:1px solid var(--line);background:var(--surface-2);border-radius:10px}
.calendar-view-switch button{border:0;background:transparent;color:var(--muted);padding:7px 10px;border-radius:7px;font-size:11px;font-weight:750;cursor:pointer}
.calendar-view-switch button.active{background:#fff;color:var(--primary);box-shadow:0 1px 4px rgba(15,23,42,.08)}
.calendar-summary{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:9px 18px;border-bottom:1px solid var(--line);background:#fbfcfe;color:var(--muted);font-size:11px;font-weight:650}
.calendar-summary span{display:inline-flex;align-items:center;gap:6px}.calendar-legend-dot{width:8px;height:8px;border-radius:999px;display:inline-block}.calendar-legend-dot.completed{background:#2563eb}.calendar-legend-dot.pending{background:#d97706}.calendar-undated{margin-left:auto;color:#9a6700}
.calendar-stage{min-width:0;background:#fff}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-bottom:1px solid var(--line);background:#f8fafc}.calendar-weekdays>div{padding:9px 10px;text-align:center;color:#7c899c;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;border-right:1px solid var(--line)}.calendar-weekdays>div:last-child{border-right:0}
.calendar-month-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.calendar-month-day{min-height:128px;padding:8px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);background:#fff;min-width:0}.calendar-month-day:nth-child(7n){border-right:0}.calendar-month-day.outside{background:#fafbfc}.calendar-month-day.outside .calendar-date-button{color:#b0bac7}.calendar-month-day.today{box-shadow:inset 0 0 0 2px rgba(37,99,235,.22)}
.calendar-month-day-head,.calendar-week-day-head{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-bottom:6px}.calendar-clickable-day-head{cursor:pointer;border-radius:8px}.calendar-clickable-day-head:hover{background:#f4f8ff}.calendar-date-button,.calendar-add-day,.calendar-more,.calendar-week-date{border:0;background:transparent;cursor:pointer}.calendar-date-button{width:27px;height:27px;border-radius:8px;color:#435169;font-size:11px;font-weight:800}.calendar-date-button:hover{background:#edf4ff;color:#2563eb}.calendar-month-day.today .calendar-date-button{background:#2563eb;color:#fff}.calendar-add-day{width:25px;height:25px;border-radius:8px;color:#8b98aa;font-size:18px;line-height:1;display:grid;place-items:center}.calendar-add-day:hover{background:#edf4ff;color:#2563eb}
.calendar-month-events,.calendar-week-events{display:grid;gap:5px;align-content:start}.calendar-event{width:100%;border:1px solid #dfe7f0;background:#fff;border-radius:9px;padding:7px 8px;text-align:left;display:grid;grid-template-columns:8px minmax(0,1fr) auto;align-items:center;gap:7px;cursor:pointer;min-width:0;color:#28364a}.calendar-event:hover{border-color:#b9cae4;background:#f8fbff}.calendar-event.pending{background:#fffaf0;border-color:#f0dfb9}.calendar-event.completed{background:#f7faff;border-color:#dbe7fb}.calendar-event-dot{width:7px;height:7px;border-radius:50%;background:#2563eb}.calendar-event.pending .calendar-event-dot{background:#d97706}.calendar-event-main{display:grid;min-width:0}.calendar-event-main strong{font-size:10.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.calendar-event-main small{font-size:9px;color:#78869a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.calendar-event-status{font-size:8.5px;color:#738196;font-weight:750;white-space:nowrap}.calendar-event.compact{grid-template-columns:7px minmax(0,1fr);padding:5px 6px;border-radius:7px}.calendar-event.compact .calendar-event-main strong{font-size:9.5px}.calendar-event.compact .calendar-event-main small{font-size:8.5px}.calendar-contact-state{font-weight:800}.calendar-contact-state.yes{color:#15803d}.calendar-contact-state.no{color:#b45309}.calendar-more{padding:4px 6px;text-align:left;color:#2563eb;font-size:9.5px;font-weight:750;border-radius:7px}.calendar-more:hover{background:#edf4ff}
.crm-calendar-week{display:grid;grid-template-columns:repeat(7,minmax(140px,1fr));min-width:980px}.calendar-week-day{min-height:560px;border-right:1px solid var(--line);padding:10px;background:#fff}.calendar-week-day:last-child{border-right:0}.calendar-week-day.today{background:#fbfdff}.calendar-week-date{padding:0;text-align:left;color:inherit}.calendar-day-name{color:#8290a3;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.05em}.calendar-day-number{font-size:20px;font-weight:820;line-height:1.1;color:#273449}.calendar-day-number small{font-size:10px;color:#8290a3;font-weight:700}.calendar-week-day.today .calendar-day-number{color:#2563eb}.calendar-empty-day{padding:14px 4px;color:#a0aaba;font-size:10px;text-align:center}
.crm-calendar-day{padding:18px}.calendar-day-hero{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:4px 2px 16px}.calendar-day-hero .calendar-day-number{font-size:30px}.calendar-day-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.calendar-day-group{border:1px solid var(--line);border-radius:14px;overflow:hidden;background:#fff}.calendar-day-group-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;background:#f8fafc;border-bottom:1px solid var(--line)}.calendar-day-group-head h3{margin:0;font-size:12px}.calendar-day-group-head span{font-size:11px;font-weight:800;color:#64748b}.calendar-day-list{display:grid;gap:8px;padding:10px}.calendar-day-card{border:1px solid var(--line);background:#fff;border-radius:11px;padding:11px;text-align:left;cursor:pointer;color:inherit}.calendar-day-card:hover{border-color:#bac9de;background:#fbfdff}.calendar-day-card.pending{border-left:3px solid #d97706}.calendar-day-card.completed{border-left:3px solid #2563eb}.calendar-day-card-top{display:flex;justify-content:space-between;gap:10px;align-items:center}.calendar-day-card-top strong{font-size:12px}.calendar-day-card-top span{font-size:9px;font-weight:800;color:#59687d;background:#f1f5f9;border-radius:999px;padding:4px 7px}.calendar-day-card-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px;color:#7b8899;font-size:9.5px}.calendar-day-card-note{margin-top:7px;color:#4d5c70;font-size:10.5px;line-height:1.35}.calendar-day-empty{padding:18px;color:#9aa5b4;text-align:center;font-size:10.5px}
@media(max-width:1100px){.calendar-main-toolbar{grid-template-columns:1fr auto}.calendar-range-title{grid-column:1/-1;grid-row:1;text-align:left}.calendar-nav-controls{grid-column:1;grid-row:2}.calendar-toolbar-right{grid-column:2;grid-row:2}.calendar-stage{overflow:auto}.calendar-month-grid{min-width:840px}.calendar-weekdays{min-width:840px}}
@media(max-width:760px){.mobile-nav{grid-template-columns:repeat(6,1fr)}.calendar-main-toolbar{display:flex;flex-wrap:wrap;padding:12px}.calendar-range-title{order:-1;width:100%;font-size:16px;text-align:left}.calendar-toolbar-right{width:100%;justify-content:space-between}.calendar-view-switch button{padding:7px 8px}.calendar-summary{padding:8px 12px}.calendar-undated{margin-left:0}.calendar-month-day{min-height:112px}.crm-calendar-day{padding:12px}.calendar-day-columns{grid-template-columns:1fr}.calendar-day-hero{align-items:flex-end}.calendar-day-hero .calendar-day-number{font-size:26px}}

/* Calendario: resaltar las acciones Demo */
.calendar-event.demo{background:#e9ddff;border-color:#b396e8;box-shadow:inset 0 0 0 1px rgba(109,40,217,.08)}
.calendar-event.demo:hover{background:#dfceff;border-color:#9471dc}
.calendar-event.demo .calendar-event-dot{background:#6d28d9}
.calendar-event.demo .calendar-event-main strong{color:#4c1d95}
.calendar-day-card.demo{background:#eee4ff;border-color:#bca3ea;border-left:4px solid #6d28d9}
.calendar-day-card.demo:hover{background:#e4d5ff;border-color:#9b7bdc}
.calendar-day-card.demo .calendar-day-card-top strong{color:#4c1d95}
.calendar-day-card.demo .calendar-day-card-top span{background:#ddd0fb;color:#5b21b6}

/* v4.55 - Filtros del calendario y semana laboral/natural */
.calendar-filter-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:9px 18px;border-bottom:1px solid var(--line);background:#fff}
.calendar-filter-control{display:flex;align-items:center;gap:7px;color:#64748b;font-size:10px;font-weight:750}
.calendar-filter-control>label,.calendar-filter-control>span{white-space:nowrap}
.calendar-filter-control select{height:30px;min-width:118px;border:1px solid var(--line);border-radius:8px;background:#fff;color:#334155;padding:0 28px 0 9px;font-size:10.5px;font-weight:700;outline:none}
.calendar-filter-control select:focus{border-color:#9db8e7;box-shadow:0 0 0 2px rgba(37,99,235,.08)}
.calendar-mini-switch{display:inline-flex;padding:2px;border:1px solid var(--line);background:var(--surface-2);border-radius:8px}
.calendar-mini-switch button{border:0;background:transparent;color:#718096;padding:5px 8px;border-radius:6px;font-size:9.5px;font-weight:750;cursor:pointer}
.calendar-mini-switch button.active{background:#fff;color:var(--primary);box-shadow:0 1px 3px rgba(15,23,42,.08)}
.calendar-demo-only{display:inline-flex;align-items:center;gap:6px;min-height:30px;padding:0 9px;border:1px solid var(--line);border-radius:8px;background:#fff;color:#5b21b6;font-size:10.5px;font-weight:800;cursor:pointer;user-select:none}
.calendar-demo-only input{margin:0;accent-color:#6d28d9}
.calendar-active-filter{color:#5b21b6!important;background:#f1eaff;border-radius:999px;padding:3px 8px}
.crm-calendar-week.workweek{grid-template-columns:repeat(5,minmax(150px,1fr));min-width:760px}
.crm-calendar-week.naturalweek{grid-template-columns:repeat(7,minmax(140px,1fr));min-width:980px}
.calendar-day-columns.single{grid-template-columns:minmax(0,1fr)}
@media(max-width:760px){.calendar-filter-bar{padding:8px 12px;gap:8px}.calendar-filter-control{gap:5px}.calendar-demo-only{margin-left:0}.calendar-week-kind{width:100%}}

/* v4.56 · conversión de ventas por origen */
.sales-origin-conversions{margin-top:4px;padding-top:14px;border-top:1px solid var(--line);display:grid;gap:10px}
.sales-origin-conversions-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.sales-origin-conversions-head strong{font-size:12px;color:#344256}
.sales-origin-conversions-head span{font-size:10px;color:var(--muted)}
.sales-origin-conversions-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.sales-origin-conversion{position:relative;border:1px solid #dfe6ef;background:#f8fafc;border-radius:13px;padding:13px 14px;display:grid;grid-template-columns:1fr auto;grid-template-areas:"label pct" "detail pct" "link link";gap:3px 10px;text-align:left;color:inherit;cursor:pointer;font:inherit;transition:.14s ease}
.sales-origin-conversion:hover{border-color:#b9c8dc;background:#f3f7fc;transform:translateY(-1px)}
.sales-origin-conversion:disabled{cursor:default;opacity:.68;transform:none}
.sales-origin-label{grid-area:label;font-size:10.5px;font-weight:850;color:#516176;text-transform:uppercase;letter-spacing:.035em}
.sales-origin-conversion strong{grid-area:pct;align-self:center;font-size:28px;line-height:1;font-weight:900;letter-spacing:-.04em;color:#1f4f7a}
.sales-origin-conversion small{grid-area:detail;color:#66758a;font-size:10px;font-weight:650}
.sales-origin-link{grid-area:link;margin-top:4px;font-size:9.5px;font-weight:800;color:#2563eb}
.sales-origin-note{padding:8px 10px;border-radius:9px;background:var(--surface-2);color:var(--muted);font-size:9.5px;line-height:1.35}
@media(max-width:760px){.sales-origin-conversions-head{display:grid;gap:2px}.sales-origin-conversions-grid{grid-template-columns:1fr}}

/* v4.59 · Fecha de valoración por producto en Seguimiento */
.followup-rating-date{font-size:10px;color:#526072;font-variant-numeric:tabular-nums;white-space:nowrap}
.followup-rating-date.missing{color:#a0aab8;font-style:italic}
.dialog .money-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
@media (max-width:760px){.dialog .money-grid{grid-template-columns:1fr}}

/* Demos en Inicio y Acciones: globo morado como en el Calendario.
   Por realizar = tono suave · Realizada = tono intenso */
.badge.demo-pending{background:#f4eeff;color:#6d28d9;border-color:#d8c7f7}
.badge.demo-done{background:#6d28d9;color:#fff;border-color:#5b21b6}
.task.demo-item{border-left:4px solid #6d28d9}
.task.demo-pending{background:#f6f1ff;border-color:#ddcdf8;border-left-color:#a78bfa}
.task.demo-pending:hover{background:#efe6ff;border-color:#c9b2f2}
.task.demo-done{background:#e9ddff;border-color:#b396e8}
.task.demo-done:hover{background:#dfceff;border-color:#9471dc}
.task.demo-item .title{color:#4c1d95}
.task.demo-item .task-date{background:#ddd0fb;color:#5b21b6}
.task.demo-item.overdue .task-date{background:var(--bad-bg);color:var(--bad)}
.calls-table tr.demo-pending td{background:#f6f1ff}
.calls-table tr.demo-pending:hover td{background:#eee4ff!important}
.calls-table tr.demo-done td{background:#e9ddff}
.calls-table tr.demo-done:hover td{background:#dfceff!important}
.calls-table tr.demo-item td:first-child{box-shadow:inset 4px 0 0 #6d28d9}
.calls-table tr.demo-pending td:first-child{box-shadow:inset 4px 0 0 #a78bfa}
.tone-cell{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.tone-cell .tone-dot{width:12px;height:12px;border-radius:4px;border:1px solid rgba(15,23,42,.12)}
.tone-cell.tone-green .tone-dot{background:#70ad47}
.tone-cell.tone-red .tone-dot{background:#dc2626}
.tone-cell.tone-none .tone-dot{background:#fff}
.tone-cell.tone-none{color:#94a3b8}

/* Oportunidades creadas (azules) y perdidas (rojos): mismo formato que Ventas por producto */
.opp-tone-created .product-total-link{border-color:#c9daf3;background:linear-gradient(145deg,#f0f6fe,#e3eefc);color:#1e3a5f}
.opp-tone-created .product-total-link:hover{border-color:#a4c2ea;background:linear-gradient(145deg,#e8f1fd,#d8e7fb)}
.opp-tone-created .product-total-label{color:#4f74a6}
.opp-tone-created .product-total-amount{color:#1d4ed8}
.opp-tone-created .product-total-units{color:#5f7898}
.opp-tone-created .mini-bar span{background:linear-gradient(90deg,#2563eb,#8fb4f5)}
.opp-tone-created .product-row-link.has-sales:hover{background:#f5f9ff;border-color:#dbe7f8}
.opp-tone-created .product-row-link.has-sales:hover .sales-row-arrow{color:#1d4ed8}
.opp-tone-lost .product-total-link{border-color:#f1cfcf;background:linear-gradient(145deg,#fef3f3,#fce6e6);color:#5f1f1f}
.opp-tone-lost .product-total-link:hover{border-color:#e9a9a9;background:linear-gradient(145deg,#fdeaea,#fadada)}
.opp-tone-lost .product-total-label{color:#a65252}
.opp-tone-lost .product-total-amount{color:#b91c1c}
.opp-tone-lost .product-total-units{color:#9a6464}
.opp-tone-lost .mini-bar span{background:linear-gradient(90deg,#dc2626,#f19c9c)}
.opp-tone-lost .product-row-link.has-sales:hover{background:#fff7f7;border-color:#f6dede}
.opp-tone-lost .product-row-link.has-sales:hover .sales-row-arrow{color:#b91c1c}

/* Inicio: "Resumen · Año" al mismo tamaño que el título del panel */
.dashboard-summary-title{font-size:clamp(22px,1.9vw,30px);margin:0 0 14px;letter-spacing:-.04em;font-weight:780}
@media(max-width:760px){.dashboard-summary-title{font-size:24px}}

/* Barra superior en una sola línea: título + vista + botones + usuario + Salir.
   En escritorio no se parte nunca; se compacta a medida que falta ancho. */
@media(min-width:761px){
  .topbar{flex-wrap:nowrap;gap:16px}
  .topbar>div:first-child{flex:0 1 auto;min-width:0}
  .topbar h1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:clamp(22px,1.9vw,30px)}
  .topbar .top-actions{flex:0 0 auto;flex-wrap:nowrap!important;justify-content:flex-end;align-items:center;gap:7px}
  .topbar .top-actions .btn:not(.small){padding:9px 12px;font-size:12.5px}
  .topbar .user-chip{padding:8px 11px!important;font-size:12px!important;gap:7px!important}
}
@media(min-width:761px) and (max-width:1700px){.topbar .user-chip .user-role{display:none}}
@media(min-width:761px) and (max-width:1450px){
  .topbar .scope-picker>span{display:none}
  .topbar .top-actions .btn:not(.small){padding:8px 10px;font-size:12px}
  .topbar .scope-picker select{padding:7px 24px 7px 8px;max-width:140px}
}
@media(max-width:760px){.topbar>div:first-child{flex:1 1 auto}.topbar h1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}

/* Barras partidas por origen (Llamadas = tono intenso, resto = tono claro) */
.mini-bar.origin-split{display:flex}
.mini-bar.origin-split span{flex:none}
.mini-bar.origin-split .o-calls,.origin-legend .o-calls{background:#1f7a47}
.mini-bar.origin-split .o-other,.origin-legend .o-other{background:#9fd3b2}
.opp-tone-created .mini-bar.origin-split .o-calls,.opp-tone-created .origin-legend .o-calls{background:#1d4ed8}
.opp-tone-created .mini-bar.origin-split .o-other,.opp-tone-created .origin-legend .o-other{background:#a8c4f5}
.opp-tone-lost .mini-bar.origin-split .o-calls,.opp-tone-lost .origin-legend .o-calls{background:#b91c1c}
.opp-tone-lost .mini-bar.origin-split .o-other,.opp-tone-lost .origin-legend .o-other{background:#f3a9a9}
.origin-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:11px;color:#6b7789;font-weight:700;padding:0 9px}
.origin-legend span{display:inline-flex;align-items:center;gap:6px}
.origin-legend i{width:12px;height:7px;border-radius:999px;display:inline-block}

/* Actividad comercial partida por origen (azul intenso = Llamadas, claro = resto) */
.bar.origin-split{display:flex}
.bar.origin-split>span{flex:none;border-radius:0}
.bar.origin-split>span.o-calls{background:#1d4ed8}
.bar.origin-split>span.o-other{background:#a8c4f5}
.funnel+.origin-legend .o-calls{background:#1d4ed8}
.funnel+.origin-legend .o-other{background:#a8c4f5}
.funnel+.origin-legend{margin-top:10px}

/* Dato de la derecha con desglose Llamadas / resto */
.origin-value{display:inline-flex;flex-direction:column;align-items:flex-end;line-height:1.15;white-space:nowrap}
.origin-value small{font-size:10.5px;font-weight:700;color:#8a94a3}
.origin-value small b{font-weight:800}
.origin-value .o-calls-text{color:#1f7a47}.origin-value .o-other-text{color:#6fb48a}
.opp-tone-created .origin-value .o-calls-text,.stats-funnel-row .origin-value .o-calls-text{color:#1d4ed8}
.opp-tone-created .origin-value .o-other-text,.stats-funnel-row .origin-value .o-other-text{color:#7ea3e6}
.opp-tone-lost .origin-value .o-calls-text{color:#b91c1c}.opp-tone-lost .origin-value .o-other-text{color:#e07a7a}
.strong-value>span{font-weight:800}
.stats-funnel-row.origin-split-row{grid-template-columns:130px 1fr auto 16px}
@media(max-width:760px){.stats-funnel-row.origin-split-row{grid-template-columns:105px 1fr auto 14px}}
.origin-value{justify-self:end}

/* El nombre del usuario ya se ve en la barra lateral y en el título. */
#currentUserChip{display:none!important}

/* Estadísticas: título y Salir arriba; debajo, filtros a la izquierda y
   Vista + botones a la derecha, centrados verticalmente. */
.topbar-filters{display:flex;align-items:center;gap:10px;min-width:0}
.topbar-filters[hidden]{display:none}
.topbar.stats-mode{flex-wrap:wrap!important;align-items:center;row-gap:10px}
.topbar.stats-mode>.topbar-heading{flex:1 1 100%;display:flex;align-items:center;justify-content:space-between;gap:16px}
.topbar.stats-mode .topbar-title{min-width:0}
.topbar.stats-mode .topbar-filters{flex:0 1 auto;flex-wrap:wrap}
.topbar.stats-mode .top-actions{flex:1 1 auto!important;margin-left:auto;flex-wrap:wrap!important;justify-content:flex-end}
.topbar.stats-mode .stats-date-filter{align-items:center;padding:4px 8px}
.topbar.stats-mode .stats-date-filter label{display:flex;align-items:center;gap:5px}
.topbar.stats-mode .stats-date-filter input{width:118px}
@media(max-width:760px){.topbar.stats-mode .topbar-filters{flex:1 1 100%}.topbar.stats-mode .top-actions{margin-left:0}}
@media(min-width:761px) and (max-width:1450px){
  .topbar.stats-mode .topbar-filters{gap:7px}
  .topbar.stats-mode .stats-date-filter{gap:5px;padding:4px 6px}
  .topbar.stats-mode .stats-date-filter:not(.stats-origin-select) .stats-date-filter-title{display:none}
  .topbar.stats-mode .stats-date-filter input{width:108px;padding:5px 5px}
  .topbar.stats-mode .top-actions{gap:6px}
}
@media(min-width:761px) and (max-width:1450px){.topbar.stats-mode .scope-picker>span{display:none}.topbar.stats-mode .scope-picker select{padding:7px 24px 7px 8px;max-width:140px}}
/* Inicio: "Panel comercial de X · Resumen año N" en la línea del título. */
.topbar h1 .title-sub{font-size:.72em;font-weight:700;color:var(--muted);letter-spacing:-.02em}

/* Autoplan: llamadas autocreadas, amarillo más tenue que las pendientes manuales */
.pending-action-row.auto-action td{background:rgba(255,250,232,.42)}
.pending-action-row.auto-action:hover td{background:rgba(255,246,214,.6)!important}
.pending-action-row.auto-action td:first-child{box-shadow:inset 3px 0 0 #f1dfa6}
.timeline-pending.auto-action{background:linear-gradient(90deg,rgba(255,251,236,.6),transparent)}
.timeline-pending.auto-action .timeline-dot{background:#e8c26a}
.calendar-event.pending.auto-action{background:#fffdf6;border-color:#f5ead0;border-style:dashed}
.calendar-event.pending.auto-action .calendar-event-dot{background:#e8c26a}
.calendar-day-card.pending.auto-action{border-left-color:#e8c26a;background:#fffdf7}
.task.auto-action{background:#fffdf6;border-style:dashed}

/* Scroll horizontal superior siempre visible al bajar (Empresas, Acciones, Seguimiento) */
.companies-card,.calls-card,.followup-card{overflow:clip}
.table-scroll-top{position:sticky;top:0;z-index:30;height:16px;box-shadow:0 2px 6px rgba(15,23,42,.06)}

/* Observaciones de la acción de origen (solo contexto, no forman parte de la nota) */
.calls-notes-source{color:#8a97a8;font-style:italic}

/* El menú lateral queda por encima del scroll superior sticky y de los popovers al desplazar en horizontal */
.sidebar{z-index:95}

/* Calendario: día actual más resaltado */
.calendar-month-day.today{background:#eef4ff;box-shadow:inset 0 0 0 2px #2563eb}
.calendar-month-day.today .calendar-date-button{background:#2563eb;color:#fff;box-shadow:0 2px 6px rgba(37,99,235,.35)}
.calendar-week-day.today{background:#eef4ff;box-shadow:inset 0 0 0 2px #2563eb}
.calendar-week-day.today .calendar-week-day-head{background:#2563eb;border-radius:8px;padding:4px 6px}
.calendar-week-day.today .calendar-day-name,.calendar-week-day.today .calendar-day-number,.calendar-week-day.today .calendar-day-number small,.calendar-week-day.today .calendar-add-day{color:#fff}
.calendar-week-day.today .calendar-clickable-day-head:hover{background:#1d4ed8}

/* Calendario: resaltar las Demos de Soporte (verde) */
.calendar-event.support-demo{background:#d9f5e3;border-color:#86d3a3;box-shadow:inset 0 0 0 1px rgba(21,128,61,.08)}
.calendar-event.support-demo:hover{background:#c6efd5;border-color:#5fbf84}
.calendar-event.support-demo .calendar-event-dot{background:#15803d}
.calendar-event.support-demo .calendar-event-main strong{color:#14532d}
.calendar-day-card.support-demo{background:#e3f8ea;border-color:#9bdcb3;border-left:4px solid #15803d}
.calendar-day-card.support-demo:hover{background:#d2f2de;border-color:#6cc591}
.calendar-day-card.support-demo .calendar-day-card-top strong{color:#14532d}
.calendar-day-card.support-demo .calendar-day-card-top span{background:#c4ecd2;color:#166534}

/* Contraseña olvidada */
.auth-link{display:block;margin:16px auto 0;background:none;border:0;color:#3b6fd8;font:inherit;font-size:13px;cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.auth-link:hover{color:#1f4fb5}
.auth-wide{width:100%;justify-content:center}
.nav-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;margin-left:auto;border-radius:9px;background:#d92d20;color:#fff;font-size:11px;font-weight:800;line-height:1}
.reset-requests{border-left:4px solid #f79009;background:#fffaeb}
.reset-requests p{margin:4px 0 10px;color:#66758a;font-size:13px}
.reset-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:9px 0;border-top:1px solid #fde7c2}
.reset-actions{display:flex;gap:8px}

/* Permisos: elementos de otros comerciales */
.owner-lock{margin:0 0 14px;padding:10px 12px;border-radius:10px;background:#f2f4f7;color:#475467;font-size:13px;border:1px solid #e4e7ec}
.owner-lock-inline{align-self:center;color:#667085;font-size:13px;padding:0 6px}
.timeline-owner{font-size:11px;color:#667085;background:#f2f4f7;border-radius:8px;padding:2px 7px;white-space:nowrap}
.read-only-form input:disabled,.read-only-form select:disabled,.read-only-form textarea:disabled{background:#f9fafb;color:#344054;cursor:default}
.admin-only[hidden],.scope-picker[hidden]{display:none!important}

/* Mi perfil */
.profile-link{cursor:pointer}
.profile-link:hover{text-decoration:underline;text-underline-offset:3px}
.muted-dash{color:#98a2b3;font-size:12px}

/* Hora de las acciones */
.task-time{display:inline-block;font-variant-numeric:tabular-nums;font-weight:800;color:#3b6fd8;margin-right:4px}
.delete-activity-btn{margin-right:auto;display:inline-flex;align-items:center;gap:6px}
.delete-activity-btn svg{width:15px;height:15px}

/* Confirmaciones propias */
.crm-confirm{max-width:440px;width:calc(100% - 32px);padding:0;border-radius:16px}
.crm-confirm-head{display:flex;align-items:center;gap:9px;padding:16px 20px 6px;font-size:15px}
.crm-confirm-head img{border-radius:6px}
.crm-confirm-body{padding:6px 20px 18px;color:#344054;line-height:1.5;font-size:14px;max-height:55vh;overflow:auto}
.crm-confirm-actions{display:flex;justify-content:flex-end;gap:8px;padding:12px 20px 18px;border-top:1px solid #eef1f5}

/* Demos de soporte en verde (como en el calendario) */
.task.support-demo-item{border-left:4px solid #15803d}
.task.support-demo-pending{background:#effaf3;border-color:#bfe8cf;border-left-color:#6cc591}
.task.support-demo-pending:hover{background:#e3f8ea;border-color:#9bdcb3}
.task.support-demo-done{background:#d9f5e3;border-color:#86d3a3}
.task.support-demo-done:hover{background:#c6efd5;border-color:#5fbf84}
.task.support-demo-item .title{color:#14532d}
.task.support-demo-item .task-date{background:#c4ecd2;color:#166534}
.task.support-demo-item.overdue .task-date{background:var(--bad-bg);color:var(--bad)}
.calls-table tr.support-demo-pending td{background:#effaf3}
.calls-table tr.support-demo-pending:hover td{background:#e3f8ea!important}
.calls-table tr.support-demo-done td{background:#d9f5e3}
.calls-table tr.support-demo-done:hover td{background:#c6efd5!important}
.calls-table tr.support-demo-item td:first-child{box-shadow:inset 4px 0 0 #15803d}
.calls-table tr.support-demo-pending td:first-child{box-shadow:inset 4px 0 0 #6cc591}
