@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&family=Roboto:wght@400;500;700;900&display=swap');
:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#172033;
  --muted:#667085;
  --primary:#1545a5;
  --border:#dbe3ef;
  --good:#0f9d58;
  --warn:#b7791f;
  --danger:#c53030;
}
*{box-sizing:border-box;font-family:Arial,Helvetica,sans-serif}
body{margin:0;background:var(--bg);color:var(--text)}
.center-screen{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.card{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:18px;box-shadow:0 4px 18px rgba(20,30,50,.05)}
.login-card{width:min(420px,100%)}
.topbar{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;background:#fff;border-bottom:1px solid var(--border);position:sticky;top:0;z-index:2}
.topbar h2{margin:0}
.topbar-actions{display:flex;gap:8px;flex-wrap:wrap}
main{padding:18px}
.page-grid{display:grid;grid-template-columns:1.55fr 1fr;gap:16px}
.left-col,.right-col{display:flex;flex-direction:column;gap:16px}
.sticky{position:static}
.grid{display:grid;gap:12px}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
label{display:block;font-size:13px;margin-bottom:6px;font-weight:700}
input,select,button,textarea,a.small-btn{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:10px;font-size:14px;text-decoration:none;color:inherit;background:#fff}
textarea{font-family:Consolas,monospace;min-height:220px}
input:disabled{background:#eef2f7}
button{cursor:pointer}
button.primary{background:var(--primary);color:#fff;border-color:var(--primary)}
button.secondary{background:#fff}
button.ghost{background:transparent}
.small-btn{padding:6px 10px;font-size:12px;display:inline-block;width:auto}
.checks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.checks label,.inline-check{display:flex;align-items:center;gap:8px;font-weight:400;margin:0}
.checks input,.inline-check input{width:auto}
.actions,.admin-toolbar,.history-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.actions{margin:12px 0}
.muted{color:var(--muted);font-size:13px}
.error{color:var(--danger);font-size:13px;margin-top:8px;white-space:pre-wrap}
.success{color:var(--good);font-size:13px}
.hidden{display:none !important}
.price-card{padding:12px;border-radius:12px;margin:10px 0;border:1px solid var(--border);background:#fafcff}
.price-main{background:#eef8f1;border-color:#bde3c6}
.price-min{background:#fff7e8;border-color:#edd29e}
.price-number{font-size:24px;font-weight:800;margin:4px 0}
.table{width:100%;border-collapse:collapse;margin-top:12px}
.table th,.table td{padding:8px;border-bottom:1px solid var(--border);text-align:left;font-size:13px;vertical-align:top}
.table th{background:#f8fafc}
.result-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.pill{display:inline-block;padding:4px 8px;border-radius:999px;background:#edf2ff;color:var(--primary);font-size:12px;font-weight:700}
.compact input,.compact select{padding:8px 10px}
.compact-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
code{background:#eef2f7;padding:2px 6px;border-radius:6px}
.admin-layout{margin-bottom:16px}
.modal{position:fixed;inset:0;z-index:20}
.modal-backdrop{position:absolute;inset:0;background:rgba(10,20,40,.45)}
.modal-body{position:relative;z-index:21;max-width:960px;margin:40px auto;padding:0 16px}
.modal-card{background:#fff;border:1px solid var(--border);border-radius:18px;padding:18px;box-shadow:0 18px 40px rgba(0,0,0,.2);max-height:85vh;overflow:auto}
.modal-header{display:flex;justify-content:space-between;align-items:center;gap:16px}
.totals-box{display:grid;gap:4px;justify-content:end;margin-top:12px;text-align:right}
@media (max-width: 900px){
  .page-grid,.admin-layout{grid-template-columns:1fr}
  .sticky{position:static}
  .grid-2,.grid-3,.checks,.compact-cards,.result-meta{grid-template-columns:1fr}
  .modal-body{margin:16px auto}
}

.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin-top:12px}
.stat-card{border:1px solid var(--border);border-radius:12px;padding:12px;background:#fafcff}
.stat-card h4{margin:0 0 8px 0}
.stat-card .big{font-size:22px;font-weight:800;margin:4px 0}
.stat-list{margin:8px 0 0 16px;padding:0}
.stat-list li{margin:4px 0;font-size:13px}
.notice-box{padding:10px 12px;border-radius:10px;background:#eef8f1;border:1px solid #bde3c6;margin-top:8px}

.topbar-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.topbar-actions .ghost{white-space:nowrap}


.full-row{grid-column:1/-1;}
.margin-table{margin-top:12px;border:1px solid #d9dde7;border-radius:10px;overflow:hidden;}
.margin-table table{width:100%;border-collapse:collapse;font-size:13px;}
.margin-table th,.margin-table td{padding:8px 10px;border-bottom:1px solid #eceff5;text-align:left;}
.margin-table tr:last-child td{border-bottom:none;}
.margin-table .selected-row{background:#eef6ff;}
.small-note{font-size:12px;color:#64748b;margin-top:6px;}


.brand-login{display:flex;flex-direction:column;align-items:center;gap:10px;margin-bottom:8px;text-align:center}
.brand-logo-login{width:min(320px,80%);height:auto;display:block}
.topbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:start}
.topbar-main{display:grid;grid-template-columns:minmax(220px,1fr) auto minmax(220px,1fr);align-items:center;min-height:165px;padding:10px 8px 0 8px;column-gap:12px}
.brand-topbar-wrap{display:flex;justify-content:center;align-items:center}
.brand-logo-topbar{width:215px;max-width:30vw;height:auto;object-fit:contain;display:block}
.brand-topbar-text{display:flex;flex-direction:column;justify-content:center}
.brand-topbar-text-left{align-items:flex-start;text-align:left}
.brand-topbar-spacer{min-height:1px}
.topbar h2{margin:0 0 2px 0;font-size:22px}
@media (max-width: 1200px){
  .brand-logo-topbar{width:190px;max-width:32vw}
  .topbar-main{grid-template-columns:minmax(180px,1fr) auto minmax(180px,1fr)}
}
@media (max-width: 1000px){
  .topbar{grid-template-columns:1fr}
  .topbar-actions{justify-content:center}
  .topbar-main{grid-template-columns:1fr;justify-items:center;row-gap:12px;min-height:auto;padding-top:6px}
  .brand-topbar-text-left{align-items:center;text-align:center}
  .brand-topbar-spacer{display:none}
}
@media (max-width: 700px){
  .brand-logo-topbar{width:150px;max-width:52vw}
  .topbar h2{font-size:20px}
}

.history-toolbar{display:grid;grid-template-columns:2fr 1fr 1fr;gap:10px;margin-bottom:12px;align-items:center}
.history-toolbar input,.history-toolbar select{width:100%}
@media (max-width: 900px){
  .history-toolbar{grid-template-columns:1fr}
}


/* Ajustes historial acciones en una sola línea */

.history-table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;}
.history-table-wrap .table{min-width:1180px;}
.table td.history-actions{white-space:nowrap;min-width:430px;}
.history-actions{display:flex;gap:6px;flex-wrap:nowrap;align-items:center;white-space:nowrap;justify-content:flex-start;}
.history-actions .small-btn{white-space:nowrap;flex:0 0 auto;padding:6px 8px;font-size:11px;line-height:1.2;width:auto;}


.disabled-btn { opacity: 0.55; pointer-events: none; }

.inline-actions{display:flex;gap:6px;flex-wrap:nowrap;align-items:center}
.inline-actions .small-btn{width:auto;white-space:nowrap}

.bulk-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.bulk-card{border:1px solid var(--border);border-radius:12px;padding:12px;background:#fafcff}.bulk-card h4{margin:0 0 6px 0}.bulk-card .actions{margin:8px 0 0 0}.bulk-status{margin-top:10px}.danger-btn{color:#b42318;border-color:#f0c8c8}.secondary-link-btn{display:inline-block;width:auto;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:#fff;text-decoration:none;color:inherit;font-size:14px}.hidden-file{display:none}@media (max-width: 900px){.bulk-grid{grid-template-columns:1fr}}

.minimum-recommendation{font-size:16px;line-height:1.35;padding:14px 16px;}
.minimum-recommendation strong{font-size:18px;color:#0f5132;}
.row-min-warning{background:#fff5f5 !important;}
.input-min-warning{border-color:#c53030 !important;color:#c53030 !important;font-weight:700;}
.min-warning{color:#c53030;font-weight:700;font-size:12px;margin-top:4px;}

/* CRM Clientes */
.crm-grid{display:grid;grid-template-columns:minmax(330px,0.85fr) minmax(520px,1.6fr);gap:18px;align-items:start}
.crm-header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;border-bottom:1px solid var(--border);padding-bottom:12px;margin-bottom:14px}
.mini-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:10px;padding:10px;border:1px solid var(--border);border-radius:12px;background:#fafcff}
.mini-form textarea,.mini-form button,.mini-form .inline-check{grid-column:1/-1}
.timeline{display:flex;flex-direction:column;gap:10px;margin-top:8px}
.timeline-item{border-left:4px solid #244c9c;background:#fafcff;border-radius:10px;padding:10px 12px;border-top:1px solid var(--border);border-right:1px solid var(--border);border-bottom:1px solid var(--border)}
.pill{display:inline-block;font-size:11px;background:#e8f1ff;border:1px solid #bdd3ff;border-radius:999px;padding:2px 7px;margin-left:5px;color:#244c9c}
@media (max-width: 1000px){.crm-grid{grid-template-columns:1fr}.crm-header{flex-direction:column}.mini-form{grid-template-columns:1fr}}


/* --- Ajustes UX abril 2026: cabecera compacta + pantalla inicio --- */
.compact-topbar{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:12px 18px;
  position:sticky;
  top:0;
  z-index:10;
  background:#fff;
}
.compact-topbar-main{
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:auto;
  padding:0;
}
.app-identity{
  display:flex;
  align-items:center;
  gap:14px;
}
.compact-logo{
  width:86px;
  max-width:none;
}
.compact-brand-text h2{
  margin:0;
  font-size:20px;
}
.compact-brand-text .muted{
  margin-top:4px;
}
.compact-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.compact-actions button{
  width:auto;
  min-width:140px;
}
.compact-actions .ghost{
  min-width:150px;
}
.home-hero{
  display:grid;
  grid-template-columns:minmax(0,1.7fr) auto;
  gap:16px;
  align-items:center;
  background:linear-gradient(135deg,#f7fbff 0%,#eef4ff 100%);
}
.home-kicker{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  background:#e7efff;
  color:#1545a5;
  font-size:12px;
  font-weight:700;
  margin-bottom:10px;
}
.home-hero h1{
  margin:0 0 10px 0;
  font-size:28px;
}
.home-subtitle{
  margin:0;
  color:#4b5565;
  line-height:1.5;
}
.home-hero-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:230px;
}
.home-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:16px;
  margin-top:16px;
}
.home-card{
  display:flex;
  flex-direction:column;
  gap:12px;
  min-height:240px;
}
.home-card-primary{
  border-color:#c7d7fb;
  background:#f9fbff;
}
.home-card h3{
  margin:0;
}
.home-card p{
  margin:0;
  color:#556070;
  line-height:1.45;
}
.home-card-icon{
  width:52px;
  height:52px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  border-radius:14px;
  background:#eef4ff;
}
.home-card button{
  margin-top:auto;
}
.nav-active{
  background:#1545a5 !important;
  color:#fff !important;
  border-color:#1545a5 !important;
}
@media (max-width: 900px){
  .home-hero{grid-template-columns:1fr;}
  .home-hero-actions{min-width:0;width:100%;}
}
@media (max-width: 700px){
  .compact-topbar{padding:10px 12px;}
  .app-identity{align-items:flex-start;}
  .compact-logo{width:72px;}
  .compact-actions button,.compact-actions .ghost{min-width:unset;flex:1 1 calc(50% - 8px);}
}


/* --- INFLEX Brandbook v3: colores, tipografías e iconografía sólida --- */
:root{
  --bg:#f4f6f7;
  --card:#ffffff;
  --text:#152028;
  --muted:#667085;
  --primary:#D12B38;
  --primary-dark:#a91f2c;
  --brand-navy:#152028;
  --brand-green:#4EBA74;
  --border:#d9e0e7;
  --good:#4EBA74;
  --warn:#b7791f;
  --danger:#D12B38;
}
*{font-family:'Roboto',Arial,Helvetica,sans-serif}
body{background:var(--bg);color:var(--text)}
h1,h2,h3,.home-kicker,.home-card-icon,button.primary,.nav-active{
  font-family:'Archivo Black','Roboto',Arial,sans-serif;
  letter-spacing:-.02em;
}
.card{
  border-color:rgba(21,32,40,.12);
  box-shadow:0 8px 22px rgba(21,32,40,.07);
}
button.primary{
  background:var(--primary);
  color:#fff;
  border-color:var(--primary);
}
button.primary:hover{background:var(--primary-dark);border-color:var(--primary-dark)}
button.secondary{
  color:var(--brand-navy);
  border-color:rgba(21,32,40,.18);
  background:#fff;
}
button.secondary:hover{
  border-color:var(--brand-navy);
  box-shadow:0 2px 10px rgba(21,32,40,.08);
}
.success{color:#21884d}
.error{color:var(--primary)}
.pill{
  background:rgba(78,186,116,.14);
  border-color:rgba(78,186,116,.35);
  color:#197a43;
}

/* Cabecera compacta con línea gráfica INFLEX */
.compact-topbar{
  background:linear-gradient(135deg,var(--brand-navy) 0%,#1b2630 58%,#331d26 100%);
  color:#fff;
  border-bottom:4px solid var(--primary);
  box-shadow:0 10px 28px rgba(21,32,40,.18);
}
.compact-logo{
  width:104px;
  height:auto;
  background:#fff;
  border-radius:14px;
  padding:7px 9px;
  box-shadow:0 8px 22px rgba(0,0,0,.16);
}
.compact-brand-text h2{color:#fff;text-transform:uppercase}
.compact-brand-text .muted{color:rgba(255,255,255,.72)}
.compact-actions button.secondary{
  background:rgba(255,255,255,.96);
  color:var(--brand-navy);
  border-color:rgba(255,255,255,.24);
}
.compact-actions button.ghost{
  background:transparent;
  color:#fff;
  border-color:rgba(255,255,255,.35);
}
.compact-actions button.ghost:hover{background:rgba(255,255,255,.1)}
.nav-active{
  background:var(--primary)!important;
  border-color:var(--primary)!important;
  color:#fff!important;
}

/* Pantalla de inicio */
.home-hero{
  color:#fff;
  background:
    radial-gradient(circle at 92% 18%,rgba(209,43,56,.55) 0%,rgba(209,43,56,.12) 30%,transparent 52%),
    linear-gradient(135deg,#152028 0%,#101a22 62%,#2a1820 100%);
  border:none;
  position:relative;
  overflow:hidden;
}
.home-hero::after{
  content:"";
  position:absolute;
  right:36px;
  top:26px;
  width:190px;
  height:150px;
  opacity:.13;
  background:
    linear-gradient(90deg,transparent 0 18px,rgba(255,255,255,.75) 18px 46px,transparent 46px 64px);
  transform:skewY(-12deg);
  border-radius:22px;
}
.home-hero > *{position:relative;z-index:1}
.home-kicker{
  background:rgba(78,186,116,.18);
  color:#fff;
  border:1px solid rgba(78,186,116,.45);
}
.home-hero h1{
  color:#fff;
  text-transform:uppercase;
}
.home-subtitle{color:rgba(255,255,255,.78)}
.home-hero-actions .secondary{
  background:#fff;
  color:var(--brand-navy);
}
.home-card{
  border-top:6px solid var(--brand-navy);
}
.home-card-primary{
  border-top-color:var(--primary);
  background:#fff;
}
.home-card:nth-child(3){border-top-color:var(--brand-green)}
.home-card-icon{
  width:58px;
  height:58px;
  border-radius:16px;
  background:var(--brand-navy);
  color:#fff;
  font-size:17px;
  letter-spacing:-.03em;
}
.home-card-primary .home-card-icon{background:var(--primary)}
.home-card:nth-child(3) .home-card-icon{background:var(--brand-green)}
.home-card h3{
  text-transform:uppercase;
  color:var(--brand-navy);
}

/* Formularios y tablas */
label{color:var(--brand-navy)}
input:focus,select:focus,textarea:focus{
  outline:none;
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(209,43,56,.11);
}
.table th{
  background:#f2f5f7;
  color:var(--brand-navy);
  font-weight:900;
}
.price-main{
  background:rgba(78,186,116,.12);
  border-color:rgba(78,186,116,.35);
}
.price-min{
  background:rgba(209,43,56,.08);
  border-color:rgba(209,43,56,.22);
}
.timeline-item{border-left-color:var(--primary)}
.notice-box{
  background:rgba(78,186,116,.12);
  border-color:rgba(78,186,116,.35);
}

/* Login */
.login-card{
  border-top:7px solid var(--primary);
}
.login-card h1{
  font-family:'Archivo Black','Roboto',Arial,sans-serif;
  text-transform:uppercase;
  color:var(--brand-navy);
}
.brand-logo-login{
  max-width:310px;
}

@media (max-width:700px){
  .compact-logo{width:88px}
}


/* --- Corrección visual v5: cantidad en revisión final --- */
#quoteItemsReviewBox .table{
  table-layout:auto;
}
#quoteItemsReviewBox th:nth-child(4),
#quoteItemsReviewBox td:nth-child(4){
  min-width:125px;
  width:125px;
}
#quoteItemsReviewBox input[data-item-qty]{
  min-width:96px;
  width:100%;
  max-width:110px;
  text-align:right;
  font-variant-numeric:tabular-nums;
}
#quoteItemsReviewBox input[data-item-desc]{
  min-width:150px;
}


/* --- v6: selector de contacto para cotización desde Cliente 360° --- */
.quote-contact-card{
  margin:0 0 16px 0;
  padding:14px 16px;
  border:1px solid rgba(209,43,56,.18);
  border-left:6px solid var(--primary);
  border-radius:16px;
  background:#fff8f9;
}
.quote-contact-card label{
  margin-bottom:8px;
}
.quote-contact-card select{
  background:#fff;
}


/* --- v7: contactos marcables para cotización/correo --- */
.crm-contacts-table th:first-child,
.crm-contacts-table td:first-child{
  width:72px;
  text-align:center;
}
.crm-contact-check-cell input{
  width:22px;
  height:22px;
  accent-color:var(--primary);
  cursor:pointer;
}
.quote-contact-card{
  border-left-color:var(--brand-green);
  background:#f4fff8;
}


/* --- v8: acciones de cotización dentro de Cliente 360° --- */
.crm-quotes-table .inline-actions{
  flex-wrap:wrap;
}
.crm-quotes-table .small-btn{
  margin-bottom:4px;
}


/* --- v11: alertas y vencimientos de tareas --- */
.task-alerts-card{
  margin:16px 0;
  border-left:7px solid var(--primary);
}
.task-alerts-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.task-alerts-header h3{
  margin:0 0 4px 0;
}
.task-alerts-list{
  display:grid;
  gap:10px;
}
.task-alert-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(21,32,40,.12);
  background:#fff;
}
.task-alert-vencida{border-left:6px solid #D12B38;background:#fff6f7;}
.task-alert-hoy{border-left:6px solid #D12B38;background:#fff8f9;}
.task-alert-proxima{border-left:6px solid #4EBA74;background:#f4fff8;}
.task-list{
  display:grid;
  gap:8px;
}
.task-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  padding:10px;
  border-bottom:1px solid var(--border);
}
.task-row-alert{
  border-radius:12px;
  border-bottom:none;
}
.task-row-vencida,.task-row-hoy{background:#fff6f7;}
.task-row-proxima{background:#f4fff8;}


/* --- v12: tareas completadas separadas y WhatsApp siempre disponible --- */
.completed-tasks-box{
  margin-top:12px;
  border:1px solid rgba(21,32,40,.12);
  border-radius:14px;
  background:#fbfcfd;
  padding:10px 12px;
}
.completed-tasks-box summary{
  cursor:pointer;
  font-weight:800;
  color:var(--brand-navy);
}
.completed-task-list{
  margin-top:10px;
}
.task-row-completed{
  opacity:.72;
  background:#f7f8fa;
}
.task-row-completed strong{
  text-decoration:line-through;
}


/* --- v13: modal amigable para registrar seguimiento --- */
.followup-modal-body{
  max-width:720px;
}
.followup-modal-card textarea{
  min-height:110px;
  font-family:'Roboto',Arial,Helvetica,sans-serif;
}
.quick-date-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.quick-date-actions .small-btn{
  width:auto;
}
.followup-actions{
  justify-content:flex-end;
  margin-top:16px;
}


/* --- v14: Cliente 360° profesional --- */
.crm-360{
  display:grid;
  gap:18px;
}
.crm-360-hero{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:flex-start;
  padding:22px;
  border-radius:22px;
  background:
    radial-gradient(circle at 88% 10%,rgba(209,43,56,.18) 0%,transparent 36%),
    linear-gradient(135deg,#152028 0%,#172631 65%,#2a1820 100%);
  color:#fff;
  box-shadow:0 14px 32px rgba(21,32,40,.16);
}
.crm-360-kicker{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(78,186,116,.18);
  border:1px solid rgba(78,186,116,.42);
  font-weight:900;
  font-size:12px;
  margin-bottom:8px;
}
.crm-360-hero h2{
  margin:0 0 8px 0;
  color:#fff;
  text-transform:uppercase;
  font-size:26px;
}
.crm-360-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:rgba(255,255,255,.78);
}
.crm-360-meta span{
  padding:5px 9px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  background:rgba(255,255,255,.06);
}
.crm-360-notes{
  margin-top:12px;
  color:rgba(255,255,255,.82);
  max-width:760px;
}
.crm-360-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:220px;
}
.crm-360-actions .secondary{
  background:#fff;
}
.crm-kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}
.crm-kpi-card{
  padding:16px;
  border-radius:18px;
  background:#fff;
  border:1px solid rgba(21,32,40,.10);
  box-shadow:0 8px 22px rgba(21,32,40,.06);
}
.crm-kpi-label{
  color:#667085;
  font-size:13px;
  font-weight:700;
}
.crm-kpi-value{
  font-family:'Archivo Black','Roboto',Arial,sans-serif;
  font-size:23px;
  color:var(--brand-navy);
  margin-top:6px;
  word-break:break-word;
}
.crm-kpi-hint{
  color:#667085;
  font-size:12px;
  margin-top:4px;
}
.crm-360-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:16px;
}
.crm-360-panel{
  padding:16px;
  border-radius:20px;
  background:#fff;
  border:1px solid rgba(21,32,40,.10);
  box-shadow:0 8px 22px rgba(21,32,40,.055);
}
.crm-panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.crm-panel-header h3{
  margin:0;
  text-transform:uppercase;
  font-size:16px;
}
.crm-add-box{
  margin-top:12px;
  padding:12px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:16px;
  background:#fbfcfd;
}
.crm-add-box summary{
  cursor:pointer;
  font-weight:900;
  color:var(--brand-navy);
}
.crm-panel-timeline{
  grid-column:1 / -1;
}
.crm-360-recipient-box{
  margin:0;
}
.crm-panel-quotes .table,
.crm-panel-contacts .table{
  margin-bottom:0;
}
@media (max-width:1100px){
  .crm-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .crm-360-grid{grid-template-columns:1fr;}
}
@media (max-width:760px){
  .crm-360-hero{flex-direction:column;}
  .crm-360-actions{width:100%;}
  .crm-kpi-grid{grid-template-columns:1fr;}
}


/* --- v15: Cliente 360° a pantalla completa + totales por moneda --- */
#crmTab.crm-focus-detail .crm-grid{
  grid-template-columns:1fr;
}
#crmTab.crm-focus-detail .crm-list-card{
  display:none;
}
#crmTab.crm-focus-detail .crm-detail-card{
  width:100%;
}
.crm-currency-total{
  padding:12px 14px;
  border:1px solid rgba(21,32,40,.10);
  border-left:6px solid var(--brand-green);
  border-radius:14px;
  background:#f4fff8;
  margin-bottom:12px;
  line-height:1.45;
}
.crm-currency-total .muted{
  margin-top:3px;
}
.crm-360-actions #btnCrmShowList{
  background:#fff;
}


/* --- v20: Dashboard comercial --- */
.dashboard-box{
  margin:16px 0;
}
.dashboard-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  background:
    radial-gradient(circle at 90% 10%,rgba(209,43,56,.18) 0%,transparent 35%),
    linear-gradient(135deg,#ffffff 0%,#f7fbff 100%);
}
.dashboard-header h2{
  margin:4px 0 6px 0;
  color:var(--brand-navy);
}
.dashboard-kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin:14px 0;
}
.dashboard-kpi{
  padding:16px;
  border-radius:18px;
  background:#fff;
  border:1px solid rgba(21,32,40,.10);
  box-shadow:0 8px 22px rgba(21,32,40,.055);
}
.dashboard-kpi-label{
  color:#667085;
  font-size:13px;
  font-weight:800;
}
.dashboard-kpi-value{
  font-family:'Archivo Black','Roboto',Arial,sans-serif;
  font-size:26px;
  color:var(--brand-navy);
  margin-top:5px;
}
.dashboard-kpi-hint{
  color:#667085;
  font-size:12px;
  margin-top:4px;
}
.dashboard-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
.dashboard-panel{
  padding:16px;
  border-radius:20px;
  background:#fff;
  border:1px solid rgba(21,32,40,.10);
  box-shadow:0 8px 22px rgba(21,32,40,.055);
}
.dashboard-panel-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}
.dashboard-panel-header h3{
  margin:0;
  text-transform:uppercase;
  font-size:16px;
}
.dashboard-list{
  display:grid;
  gap:8px;
}
.dashboard-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px;
  border-radius:14px;
  background:#fbfcfd;
  border:1px solid rgba(21,32,40,.08);
}
@media (max-width:1100px){
  .dashboard-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .dashboard-grid{grid-template-columns:1fr;}
}
@media (max-width:720px){
  .dashboard-header{flex-direction:column;}
  .dashboard-kpi-grid{grid-template-columns:1fr;}
  .dashboard-row{align-items:flex-start;flex-direction:column;}
}


/* --- v22: Estados comerciales de cotización --- */
.quote-status-select{
  margin-top:6px;
  min-width:150px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(21,32,40,.16);
  background:#fff;
}
.quote-status-pill{
  display:inline-flex;
  align-items:center;
  padding:5px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  border:1px solid rgba(21,32,40,.12);
  background:#f2f4f7;
  color:#344054;
}
.quote-status-NUEVA{background:#eef4ff;color:#1545a5;border-color:#c7d7fb;}
.quote-status-ENVIADA{background:#fff7e6;color:#9a5b00;border-color:#ffd999;}
.quote-status-EN_SEGUIMIENTO{background:#f4fff8;color:#197a43;border-color:#a7e8bf;}
.quote-status-REQUIERE_AJUSTE{background:#fff0f1;color:#a91f2c;border-color:#f2b8c0;}
.quote-status-GANADA{background:#eafff2;color:#0f7a3f;border-color:#87dba8;}
.quote-status-PERDIDA{background:#f2f4f7;color:#667085;border-color:#d0d5dd;}
.quote-status-RECHAZADA{background:#fff6f7;color:#D12B38;border-color:#f0a7ae;}
.dashboard-status-card{
  margin:14px 0;
}
.dashboard-status-card h3{
  margin:0 0 12px 0;
  text-transform:uppercase;
  font-size:16px;
}
.dashboard-status-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.dashboard-status-chip{
  display:flex;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius:14px;
  background:#fbfcfd;
  border:1px solid rgba(21,32,40,.08);
}


/* --- v23: tareas accionables y cierre automático por estado --- */
.task-row{
  align-items:flex-start;
}
.task-actions{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  justify-content:flex-end;
}
.task-quote-link{
  margin-top:5px;
  border:none;
  background:transparent;
  padding:0;
  color:#1545a5;
  text-decoration:underline;
  cursor:pointer;
  font-weight:800;
}
.quote-row-highlight{
  animation: quoteHighlight 2.5s ease-out;
}
@keyframes quoteHighlight{
  0%{background:#fff3cd;}
  45%{background:#fff3cd;}
  100%{background:transparent;}
}
@media (max-width:760px){
  .task-actions{
    justify-content:flex-start;
    margin-top:8px;
  }
}


/* --- v24: Reportes por vendedor --- */
.report-header{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  margin-bottom:16px;
}
.report-header h3{
  margin:0 0 4px 0;
  text-transform:uppercase;
}
.report-filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.report-filters input{
  max-width:160px;
}
.report-kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-bottom:16px;
}
.report-table-wrap{
  overflow:auto;
}
.report-table{
  min-width:1100px;
}
.report-table th,
.report-table td{
  white-space:nowrap;
}
@media (max-width:900px){
  .report-header{flex-direction:column;}
  .report-filters{justify-content:flex-start;}
  .report-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width:620px){
  .report-kpi-grid{grid-template-columns:1fr;}
}


/* --- v25: Reporte detallado por vendedor --- */
.vendor-report-link{
  border:none;
  background:transparent;
  text-align:left;
  padding:0;
  color:var(--brand-navy);
  cursor:pointer;
}
.vendor-report-link strong{
  text-decoration:underline;
}
.vendor-detail-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:14px;
}
.vendor-detail-header h3{
  margin:8px 0 4px 0;
  text-transform:uppercase;
}
.vendor-chart-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  margin-bottom:16px;
}
.vendor-chart-card{
  padding:16px;
  border-radius:20px;
  background:#fff;
  border:1px solid rgba(21,32,40,.10);
  box-shadow:0 8px 22px rgba(21,32,40,.055);
}
.vendor-chart-card h4{
  margin:0 0 12px 0;
  text-transform:uppercase;
  color:var(--brand-navy);
}
.simple-bar-row{
  display:grid;
  grid-template-columns:110px 1fr 44px;
  gap:8px;
  align-items:center;
  margin:8px 0;
  font-size:13px;
}
.simple-bar{
  height:10px;
  background:#eef1f4;
  border-radius:999px;
  overflow:hidden;
}
.simple-bar div{
  height:100%;
  background:var(--primary);
  border-radius:999px;
}
@media (max-width:1100px){
  .vendor-chart-grid{grid-template-columns:1fr;}
}


/* --- v27: Indicadores clickeables y navegación a detalle --- */
.dashboard-kpi-clickable{
  width:100%;
  text-align:left;
  cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dashboard-kpi-clickable:hover{
  transform:translateY(-2px);
  border-color:rgba(209,43,56,.35);
  box-shadow:0 12px 26px rgba(21,32,40,.10);
}
.dashboard-row-clickable{
  cursor:pointer;
}
.dashboard-row-clickable:hover{
  border-color:rgba(209,43,56,.35);
  background:#fff8f9;
}
.report-section-highlight{
  animation: reportSectionHighlight 2.2s ease-out;
  border-radius:18px;
}
@keyframes reportSectionHighlight{
  0%{box-shadow:0 0 0 4px rgba(209,43,56,.30);}
  60%{box-shadow:0 0 0 4px rgba(209,43,56,.14);}
  100%{box-shadow:none;}
}


/* --- v29: equipos comerciales --- */
.team-list{
  display:grid;
  gap:14px;
}
.team-card{
  border:1px solid rgba(21,32,40,.12);
  border-radius:18px;
  padding:14px;
  background:#fbfcfd;
}
.team-vendors-box{
  margin-top:12px;
}
.team-vendors-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-top:8px;
}
.team-vendor-check{
  display:flex;
  align-items:center;
  gap:8px;
  padding:9px 10px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:12px;
  background:#fff;
}
.team-vendor-check input{
  width:18px;
  height:18px;
}
@media (max-width:900px){
  .team-vendors-grid{grid-template-columns:1fr;}
}


/* --- v30: equipos comerciales más claros --- */
.team-list{
  display:grid;
  gap:16px;
}
.team-card{
  border:1px solid rgba(21,32,40,.12);
  border-radius:22px;
  padding:18px;
  background:#fff;
  box-shadow:0 8px 22px rgba(21,32,40,.055);
}
.team-card-warning{
  border-color:rgba(209,43,56,.28);
  background:#fffafa;
}
.team-card-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:12px;
}
.team-title{
  font-family:'Archivo Black','Roboto',Arial,sans-serif;
  font-size:22px;
  color:var(--brand-navy);
  text-transform:uppercase;
}
.team-status{
  display:inline-flex;
  align-items:center;
  padding:7px 11px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  white-space:nowrap;
}
.team-status-ok{
  color:#0f7a3f;
  background:#eafff2;
  border:1px solid #87dba8;
}
.team-status-warning{
  color:#a91f2c;
  background:#fff0f1;
  border:1px solid #f2b8c0;
}
.team-summary{
  display:grid;
  grid-template-columns:280px 1fr;
  gap:12px;
  margin:12px 0 16px 0;
}
.team-summary-item{
  padding:12px;
  border-radius:16px;
  background:#f7f9fb;
  border:1px solid rgba(21,32,40,.08);
}
.team-summary-item span{
  display:block;
  font-size:12px;
  color:#667085;
  font-weight:800;
  margin-bottom:5px;
}
.team-chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}
.team-chip{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  background:#eef4ff;
  color:#1545a5;
  font-weight:900;
  font-size:12px;
  border:1px solid #c7d7fb;
}
.team-edit-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-bottom:12px;
}
.team-vendors-box{
  margin-top:12px;
}
.team-vendors-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-top:8px;
}
.team-vendor-check{
  display:flex;
  align-items:center;
  gap:8px;
  padding:11px 12px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:14px;
  background:#fff;
}
.team-vendor-selected{
  border-color:#87dba8;
  background:#f4fff8;
}
.team-vendor-check input{
  width:18px;
  height:18px;
}
.team-rule-box{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
  padding:12px;
  border-radius:16px;
  background:#f7f9fb;
  border:1px solid rgba(21,32,40,.08);
}
@media (max-width:980px){
  .team-summary,
  .team-edit-grid{grid-template-columns:1fr;}
  .team-vendors-grid{grid-template-columns:1fr;}
}


/* --- v31: equipos existentes separados del editor --- */
.teams-configured-panel,
.teams-editor-panel{
  border:1px solid rgba(21,32,40,.10);
  border-radius:22px;
  padding:16px;
  background:#fff;
  margin-bottom:16px;
}
.teams-configured-panel{
  background:linear-gradient(135deg,#ffffff 0%,#f7fbff 100%);
}
.teams-section-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  margin-bottom:14px;
}
.teams-section-header h4{
  margin:0 0 4px 0;
  font-family:'Archivo Black','Roboto',Arial,sans-serif;
  color:var(--brand-navy);
  text-transform:uppercase;
}
.team-count-pill{
  display:inline-flex;
  padding:7px 11px;
  border-radius:999px;
  font-weight:900;
  color:#1545a5;
  background:#eef4ff;
  border:1px solid #c7d7fb;
  white-space:nowrap;
}
.configured-team-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.configured-team-card{
  padding:14px;
  border-radius:18px;
  border:1px solid rgba(21,32,40,.10);
  background:#fff;
  box-shadow:0 8px 18px rgba(21,32,40,.045);
}
.configured-team-title{
  font-family:'Archivo Black','Roboto',Arial,sans-serif;
  color:var(--brand-navy);
  text-transform:uppercase;
  margin-bottom:8px;
}
.configured-team-line{
  margin:5px 0;
}
.empty-team-state{
  padding:14px;
  border-radius:16px;
  background:#fff8f9;
  border:1px solid rgba(209,43,56,.20);
}
.team-warning-note{
  margin-top:12px;
  padding:10px 12px;
  border-radius:14px;
  background:#fff0f1;
  color:#a91f2c;
  font-weight:900;
  border:1px solid #f2b8c0;
}
@media (max-width:900px){
  .teams-section-header{flex-direction:column;}
  .configured-team-grid{grid-template-columns:1fr;}
}


/* --- v33: creación robusta de supervisores y equipos --- */
.admin-toolbar #btnAddSupervisorUser{
  border-color:#c7d7fb;
  background:#eef4ff;
  color:#1545a5;
}
.admin-toolbar #btnAddAdminUser{
  border-color:#d0d5dd;
}


/* --- v34: tablas admin legibles y equipos sin bloqueo por borrador vacío --- */
.admin-layout .card{
  overflow-x:auto;
}
#adminVendors table,
#adminUsers table{
  min-width:980px;
}
#adminVendors input,
#adminUsers input,
#adminUsers select{
  min-width:120px;
}
#adminVendors input[data-field="email"],
#adminUsers input[data-field="email"]{
  min-width:190px;
}
#adminVendors input[data-field="nombre"],
#adminUsers input[data-field="name"]{
  min-width:160px;
}
#adminVendors input[data-field="username"],
#adminUsers input[data-field="username"]{
  min-width:150px;
}
#adminVendors input[data-field="celular"],
#adminUsers input[data-field="celular"]{
  min-width:130px;
}


/* --- v35: BCC por supervisor y Admin sin barra horizontal --- */
#adminVendors table,
#adminUsers table{
  min-width:0 !important;
  width:100%;
  table-layout:fixed;
}
#adminVendors th,
#adminUsers th,
#adminVendors td,
#adminUsers td{
  white-space:normal !important;
  vertical-align:top;
}
#adminVendors input,
#adminUsers input,
#adminUsers select{
  min-width:0 !important;
  width:100%;
  box-sizing:border-box;
  font-size:13px;
  padding:10px 8px;
}
#adminVendors th:nth-child(1),
#adminUsers th:nth-child(1){width:82px;}
#adminVendors th:nth-child(7){width:70px;}
#adminUsers th:nth-child(8),
#adminVendors th:nth-child(8){width:90px;}
.admin-layout .card{
  overflow-x:visible !important;
}
.teams-editor-panel .team-card{
  margin-top:8px;
}
@media (max-width:1150px){
  #adminVendors table,
  #adminUsers table,
  #adminVendors thead,
  #adminUsers thead,
  #adminVendors tbody,
  #adminUsers tbody,
  #adminVendors tr,
  #adminUsers tr,
  #adminVendors th,
  #adminUsers th,
  #adminVendors td,
  #adminUsers td{
    display:block;
  }
  #adminVendors thead,
  #adminUsers thead{
    display:none;
  }
  #adminVendors tr,
  #adminUsers tr{
    border:1px solid rgba(21,32,40,.10);
    border-radius:16px;
    padding:10px;
    margin-bottom:10px;
    background:#fbfcfd;
  }
  #adminVendors td,
  #adminUsers td{
    padding:6px 0;
  }
  #adminVendors td::before,
  #adminUsers td::before{
    display:block;
    font-size:12px;
    color:#667085;
    font-weight:900;
    margin-bottom:4px;
  }
  #adminVendors td:nth-child(1)::before{content:"Código";}
  #adminVendors td:nth-child(2)::before{content:"Nombre";}
  #adminVendors td:nth-child(3)::before{content:"Usuario";}
  #adminVendors td:nth-child(4)::before{content:"Correo";}
  #adminVendors td:nth-child(5)::before{content:"Celular";}
  #adminVendors td:nth-child(6)::before{content:"Clave";}
  #adminVendors td:nth-child(7)::before{content:"Activo";}
  #adminUsers td:nth-child(1)::before{content:"Rol";}
  #adminUsers td:nth-child(2)::before{content:"Usuario";}
  #adminUsers td:nth-child(3)::before{content:"Nombre";}
  #adminUsers td:nth-child(4)::before{content:"Correo";}
  #adminUsers td:nth-child(5)::before{content:"Celular";}
  #adminUsers td:nth-child(6)::before{content:"Código";}
  #adminUsers td:nth-child(7)::before{content:"Clave";}
}


/* --- v38: confirmación visual de acciones --- */
.app-toast{
  position:fixed;
  right:24px;
  bottom:24px;
  z-index:9999;
  padding:14px 18px;
  border-radius:16px;
  font-weight:900;
  box-shadow:0 12px 30px rgba(0,0,0,.22);
  max-width:420px;
  animation:toastIn .2s ease-out;
}
.app-toast-success{
  background:#eafff2;
  color:#0f7a3f;
  border:1px solid #87dba8;
}
.app-toast-error{
  background:#fff0f1;
  color:#a91f2c;
  border:1px solid #f2b8c0;
}
.app-toast-hide{
  opacity:0;
  transform:translateY(8px);
  transition:all .25s ease;
}
.btn-busy{
  opacity:.75;
  cursor:wait !important;
}
.btn-done{
  background:#198754 !important;
  color:#fff !important;
  border-color:#198754 !important;
}
@keyframes toastIn{
  from{opacity:0;transform:translateY(8px);}
  to{opacity:1;transform:translateY(0);}
}


/* --- v41: consistencia de alcance y periodo --- */
.report-scope-note{
  margin:10px 0 14px 0;
  padding:12px 14px;
  border-radius:16px;
  background:#f7fbff;
  border:1px solid #c7d7fb;
  color:#1545a5;
  font-weight:700;
}
.report-scope-note strong{
  font-weight:900;
}


/* --- v42: conteo consistente de tareas en Cliente 360° --- */
.task-count-note{
  margin:0 0 10px 0;
  padding:8px 10px;
  border-radius:12px;
  background:#f7fbff;
  border:1px solid #d6e4ff;
}


/* --- v43: estados visibles en tareas activas --- */
.pill-muted{
  background:#f2f4f7 !important;
  border-color:#d0d5dd !important;
  color:#667085 !important;
}


/* --- v44: vencimiento visible en todas las tareas --- */
.task-count-note{
  font-weight:700;
}


/* --- v45: solo tres estados de tarea --- */
.task-count-note{
  font-weight:800;
}


/* --- v46: vence pronto solo próximos 2 días hábiles --- */
.task-count-note{
  font-weight:800;
}


/* --- v47: objetivos comerciales y reasignación automática --- */
.objective-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.objective-card{
  border:1px solid rgba(21,32,40,.10);
  border-radius:18px;
  background:#fff;
  padding:14px;
  box-shadow:0 8px 20px rgba(21,32,40,.045);
}
.objective-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  margin-bottom:8px;
}
.objective-progress{
  display:grid;
  grid-template-columns:1fr 54px;
  align-items:center;
  gap:10px;
  margin:10px 0;
}
.objective-bar{
  height:12px;
  background:#eef1f4;
  border-radius:999px;
  overflow:hidden;
}
.objective-bar div{
  height:100%;
  background:var(--primary);
  border-radius:999px;
}
#adminObjectives .card{
  margin-top:16px;
}
@media (max-width:1100px){
  .objective-grid{grid-template-columns:1fr;}
}


/* --- v48: objetivos para supervisores y confirmación interna --- */
.reassign-box{
  margin:14px 0;
  padding:14px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:16px;
  background:#f8fafc;
}
.inline-confirm{
  margin-top:10px;
  padding:10px 12px;
  border-radius:14px;
  background:#fff8e6;
  border:1px solid #ffd37a;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.inline-confirm.hidden{
  display:none !important;
}
#reportsObjectivesBox{
  margin:14px 0;
}


/* --- v49: formulario de objetivos robusto --- */
.objective-manager .error{
  margin-top:10px;
}


/* --- v50: estabilización y mantenimiento --- */
.maintenance-result{
  margin-top:14px;
}
.maintenance-grid{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:10px;
  margin-top:12px;
}
.maintenance-grid div{
  border:1px solid rgba(21,32,40,.10);
  border-radius:14px;
  padding:10px;
  background:#fbfcfd;
}
.maintenance-grid strong{
  display:block;
  font-size:22px;
  color:var(--brand-navy);
}
.maintenance-grid span{
  display:block;
  font-size:12px;
  color:#667085;
  font-weight:800;
}
@media (max-width:1100px){
  .maintenance-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}


/* --- v51: exportación de reportes --- */
.report-export-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:12px 0;
  padding:14px;
}
.report-export-toolbar .inline-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
@media (max-width:900px){
  .report-export-toolbar{
    align-items:flex-start;
    flex-direction:column;
  }
}


/* --- v53: carga masiva solo clientes --- */
.bulk-card{
  border-left:4px solid var(--primary);
}
.bulk-status.success{
  line-height:1.45;
}


/* --- v54: correo real SMTP --- */
.smtp-settings-box{
  border-left:4px solid var(--primary);
}
.smtp-settings-box .check-row{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:12px;
  background:#fbfcfd;
  font-weight:800;
}
.smtp-settings-box .check-row input{
  width:18px;
  height:18px;
}


/* --- v55: correo SMTP por vendedor --- */
.vendor-smtp-table{
  min-width:1200px;
}
.vendor-smtp-table input{
  min-width:120px;
}
.vendor-smtp-table input[data-field="smtp_user"],
.vendor-smtp-table input[data-field="smtp_from"]{
  min-width:170px;
}


/* --- v56: usuarios y correos simplificados --- */
.unified-users-card{
  margin-bottom:16px;
}
.users-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.unified-users-table td{
  vertical-align:top;
}
.user-role-pill{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
}
.role-admin{background:#fef3c7;color:#92400e;}
.role-supervisor{background:#dbeafe;color:#1e40af;}
.role-vendedor{background:#dcfce7;color:#166534;}
.system-mail-box{
  margin:10px 0 14px 0;
  padding:12px 14px;
  border-radius:16px;
  background:#f8fafc;
  border:1px solid rgba(21,32,40,.10);
}
.user-modal-card{
  width:min(940px, 94vw);
  max-height:88vh;
  overflow:auto;
}
.user-modal-card .modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.user-modal-card h4{
  margin:16px 0 6px 0;
}
.user-modal-card hr{
  border:0;
  border-top:1px solid rgba(21,32,40,.12);
  margin:18px 0 8px;
}
.user-modal-card input,
.user-modal-card select{
  min-height:42px;
}
.user-modal-card .check-row{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:12px;
  background:#fbfcfd;
}
@media (max-width:800px){
  .users-header{flex-direction:column;}
}

/* --- v57: lista simple de usuarios y modal limpio --- */
.simplified-users-table th:first-child,
.simplified-users-table td:first-child{
  width:auto;
}
.simplified-users-table th:last-child,
.simplified-users-table td:last-child{
  width:120px;
  text-align:right;
}
.simplified-users-table td{
  padding:14px 10px;
}
.user-list-subline{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:4px;
}
.user-list-actions .small-btn{
  min-width:82px;
}
.icon-btn{
  width:38px !important;
  min-width:38px;
  height:38px;
  padding:0 !important;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  line-height:1;
  background:#fff;
}
.modal-body{
  max-width:none;
  width:100%;
  display:flex;
  justify-content:center;
}
.user-modal-card{
  width:min(980px, 94vw) !important;
  margin:0 auto;
}
.user-modal-card .modal-head h3{
  margin:0;
  font-size:24px;
}
.user-modal-card .actions button{
  width:auto;
  min-width:170px;
}
@media (max-width:800px){
  .simplified-users-table th:last-child,
  .simplified-users-table td:last-child{
    width:92px;
  }
  .user-modal-card .actions button{
    width:100%;
  }
}


/* --- v59: correos IMAP en Cliente 360 --- */
.crm-panel-emails{
  grid-column: span 2;
}
.email-360-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:10px;
}
.email-360-item{
  border:1px solid rgba(21,32,40,.10);
  border-radius:14px;
  padding:12px;
  background:#fbfcfd;
}
.email-360-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
  margin-bottom:6px;
}
.email-360-top span{
  color:#667085;
  font-size:12px;
  white-space:nowrap;
}
.email-360-item p{
  margin:8px 0 0 0;
  color:#43516b;
  line-height:1.35;
}
@media (max-width:1000px){
  .crm-panel-emails{grid-column:span 1;}
}


/* --- v75: tabla CRM clientes alineada y con scroll interno --- */
.crm-company-table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  border:1px solid rgba(21,32,40,.08);
  border-radius:16px;
  background:#fff;
}
.crm-company-table{
  width:100%;
  min-width:920px;
  margin-top:0;
  table-layout:fixed;
}
.crm-company-table th,
.crm-company-table td{
  vertical-align:top;
}
.crm-company-table th:nth-child(1),
.crm-company-table td:nth-child(1){width:34%;}
.crm-company-table th:nth-child(2),
.crm-company-table td:nth-child(2){width:17%;}
.crm-company-table th:nth-child(3),
.crm-company-table td:nth-child(3){width:16%;}
.crm-company-table th:nth-child(4),
.crm-company-table td:nth-child(4),
.crm-company-table th:nth-child(5),
.crm-company-table td:nth-child(5){width:8%; text-align:center; white-space:nowrap;}
.crm-company-table th:nth-child(6),
.crm-company-table td:nth-child(6){width:17%; white-space:nowrap;}
.crm-company-table td strong{
  display:block;
  line-height:1.35;
  margin-bottom:4px;
  word-break:break-word;
}
.crm-company-table .muted{
  line-height:1.35;
  word-break:break-word;
}
.crm-company-table .pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.crm-company-table .small-btn{
  width:auto;
  white-space:nowrap;
}


/* --- v76: acciones de reasignación para administradores en CRM Clientes --- */
.crm-company-table th:nth-child(6),
.crm-company-table td:nth-child(6){width:24%; white-space:normal;}
.crm-company-table{min-width:1080px;}
.crm-row-actions{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
.crm-row-actions .small-btn{
  flex:0 0 auto;
  white-space:nowrap;
}
.crm-assign-select{
  width:210px;
  min-width:190px;
  max-width:100%;
  padding:6px 8px;
  font-size:12px;
  border-radius:9px;
}


/* --- v80: WhatsApp simple desde Cliente 360 --- */
.crm-contact-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  align-items:center;
}
.crm-contact-actions .small-btn{
  width:auto;
  white-space:nowrap;
}
.crm-contacts-table th:last-child,
.crm-contacts-table td:last-child{
  min-width:230px;
}


/* --- v83: responder correo en ventana emergente con adjuntos --- */
.email-compose-modal-card{
  width:min(900px, 94vw) !important;
}
.email-compose-grid{
  align-items:end;
}
.email-compose-textarea{
  min-height:240px;
  width:100%;
  resize:vertical;
}
.email-compose-files{
  margin-top:8px;
  line-height:1.4;
  word-break:break-word;
}

/* --- v86: comunicaciones 360 + alertas emergentes reprogramables --- */
.email-compose-modal-card{width:min(980px,94vw)!important;}
.email-compose-grid{align-items:end;}
.email-compose-textarea{min-height:250px;width:100%;resize:vertical;}
.email-compose-files{margin-top:8px;line-height:1.4;word-break:break-word;}
.email-compose-quote-box{padding:12px;border:1px solid rgba(21,32,40,.10);border-radius:14px;background:#fbfcfd;}
.email-quote-options{display:grid;gap:8px;margin-top:8px;max-height:180px;overflow:auto;}
.email-quote-option{display:flex;gap:8px;align-items:flex-start;padding:8px 10px;border:1px solid rgba(21,32,40,.10);border-radius:12px;background:#fff;}
.email-quote-option input{width:18px;min-width:18px;margin-top:2px;}
.timeline-filter-box{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.timeline-filter-box select{width:auto;min-width:150px;padding:7px 10px;}
.task-snooze-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end;margin-top:8px;}
.task-alert-modal-card{width:min(980px,94vw)!important;}
.task-alert-modal-list{display:grid;gap:10px;margin-top:14px;max-height:58vh;overflow:auto;padding-right:4px;}
.task-alert-modal-item{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:12px;border:1px solid rgba(21,32,40,.12);border-radius:14px;background:#fff;}
.task-alert-modal-actions{min-width:320px;text-align:right;}
@media (max-width:760px){.task-alert-modal-item{flex-direction:column}.task-alert-modal-actions{min-width:0;width:100%;text-align:left}.task-snooze-actions{justify-content:flex-start}.timeline-filter-box select{width:100%;}}


/* --- v87: correos leidos / no leidos en 360 --- */
.email-360-item{
  position:relative;
  transition:background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.email-360-read{
  background:#fff;
  border-left:5px solid rgba(102,112,133,.25);
}
.email-360-unread{
  background:#fff8f9;
  border-left:7px solid var(--primary);
  box-shadow:0 8px 20px rgba(209,43,56,.08);
}
.email-360-unread .email-360-top strong{
  font-weight:900;
  color:var(--brand-navy);
}
.email-360-read .email-360-top strong{
  font-weight:700;
  color:#475467;
}
.email-360-subject-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.email-read-dot{
  width:10px;
  height:10px;
  border-radius:999px;
  background:#cbd5e1;
  flex:0 0 auto;
}
.email-read-dot-unread{
  background:var(--primary);
  box-shadow:0 0 0 4px rgba(209,43,56,.12);
}
.email-status-pill{
  display:inline-flex;
  align-items:center;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  border:1px solid rgba(21,32,40,.12);
}
.email-status-unread{
  color:#a91f2c;
  background:#fff0f2;
  border-color:rgba(209,43,56,.28);
}
.email-status-read{
  color:#475467;
  background:#f2f4f7;
}

/* --- v89: clientes sin scroll horizontal + correo leído al abrir --- */
.crm-company-table-wrap{
  overflow-x:visible !important;
}
.crm-company-table{
  min-width:0 !important;
  width:100% !important;
  table-layout:fixed !important;
}
.crm-company-table th,
.crm-company-table td{
  padding:7px 6px !important;
  font-size:12px !important;
  overflow-wrap:anywhere;
}
.crm-company-table th:nth-child(1),
.crm-company-table td:nth-child(1){width:28% !important;}
.crm-company-table th:nth-child(2),
.crm-company-table td:nth-child(2){width:14% !important;}
.crm-company-table th:nth-child(3),
.crm-company-table td:nth-child(3){width:14% !important;}
.crm-company-table th:nth-child(4),
.crm-company-table td:nth-child(4){width:8% !important; text-align:center;}
.crm-company-table th:nth-child(5),
.crm-company-table td:nth-child(5){width:8% !important; text-align:center;}
.crm-company-table th:nth-child(6),
.crm-company-table td:nth-child(6){width:28% !important; white-space:normal !important;}
.crm-row-actions{
  display:grid !important;
  grid-template-columns:1fr 1fr;
  gap:5px;
  align-items:center;
}
.crm-row-actions .crm-assign-select{
  grid-column:1 / -1;
  width:100% !important;
  min-width:0 !important;
  font-size:11px;
  padding:6px 7px;
}
.crm-row-actions .small-btn{
  width:100% !important;
  min-width:0 !important;
  white-space:normal !important;
  padding:6px 7px;
  font-size:11px;
}
.email-attachment-hint{
  display:inline-flex;
  margin:4px 0 8px 0;
  padding:4px 8px;
  border-radius:999px;
  background:#eef4ff;
  border:1px solid #cbd8ff;
  color:#1d3f8f;
  font-size:12px;
  font-weight:700;
}
.email-detail-modal-card{
  width:min(980px,94vw)!important;
}
.email-detail-meta{
  display:grid;
  gap:6px;
  padding:12px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:14px;
  background:#fbfcfd;
  margin-bottom:12px;
}
.email-detail-body{
  white-space:pre-wrap;
  min-height:180px;
  max-height:45vh;
  overflow:auto;
  padding:14px;
  border:1px solid rgba(21,32,40,.12);
  border-radius:14px;
  background:#fff;
  line-height:1.5;
}
.email-detail-attachments{
  display:grid;
  gap:8px;
}
.email-detail-attachment{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border:1px solid rgba(21,32,40,.12);
  border-radius:12px;
  background:#fbfcfd;
  text-decoration:none;
  color:inherit;
}
@media (max-width:760px){
  .crm-company-table th:nth-child(4), .crm-company-table td:nth-child(4),
  .crm-company-table th:nth-child(5), .crm-company-table td:nth-child(5){display:none;}
  .crm-company-table th:nth-child(1), .crm-company-table td:nth-child(1){width:34%!important;}
  .crm-company-table th:nth-child(2), .crm-company-table td:nth-child(2){width:18%!important;}
  .crm-company-table th:nth-child(3), .crm-company-table td:nth-child(3){width:18%!important;}
  .crm-company-table th:nth-child(6), .crm-company-table td:nth-child(6){width:30%!important;}
}

/* --- v90: contactos y grupos para responder/reenviar correo --- */
.email-compose-contact-box{
  border:1px solid rgba(21,32,40,.12);
  border-radius:14px;
  padding:12px;
  background:#fbfcfd;
}
.email-compose-contact-box summary{
  cursor:pointer;
}
.email-compose-contact-picker{
  margin-top:10px;
}
.email-compose-contact-row{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:8px 10px;
  border-bottom:1px solid rgba(21,32,40,.08);
}
.email-compose-contact-row input{
  width:18px;
  height:18px;
  flex:0 0 auto;
  margin-top:2px;
}
.email-compose-groups{
  display:grid;
  gap:8px;
}
.email-compose-group-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  padding:10px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:12px;
  background:#fff;
}
.email-compose-group-row small{
  word-break:break-word;
}

/* --- v91: libreta interna tipo Outlook y bandeja comercial --- */
.email-contact-list{
  max-height:260px;
  overflow:auto;
  border:1px solid rgba(21,32,40,.10);
  border-radius:14px;
  padding:10px;
  margin-top:8px;
  background:#fbfcfd;
}
.email-contact-list h4{
  margin:8px 0 6px 0;
  font-size:13px;
  text-transform:uppercase;
  color:#667085;
}
.email-compose-contact-row{
  display:flex;
  align-items:flex-start;
  gap:8px;
  padding:8px;
  border-bottom:1px solid rgba(21,32,40,.08);
}
.email-compose-contact-row input{width:auto;min-height:auto;margin-top:3px;}
.email-compose-contact-row.internal-contact{
  background:#f8fbff;
}
.mailbox-list{
  display:grid;
  gap:10px;
}
#mailboxTab .section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
#mailboxTab #btnMailboxRefresh{
  width:auto;
  min-width:180px;
}
@media(max-width:800px){
  #mailboxTab .section-head{flex-direction:column;}
  #mailboxTab #btnMailboxRefresh{width:100%;}
}

/* --- v92: contactos dentro de Correos + marcar no leído --- */
.mailbox-tab-actions .small-btn{width:auto;min-width:130px;}
.mailbox-contacts-panel{padding:14px;border:1px solid rgba(21,32,40,.10);border-radius:16px;background:#fff;}
.mailbox-contact-list{margin-top:12px;display:grid;gap:8px;}
.mailbox-contact-row{display:grid;grid-template-columns:1.4fr .8fr;gap:12px;align-items:center;padding:10px 12px;border:1px solid rgba(21,32,40,.10);border-radius:12px;background:#fbfcfd;}
@media (max-width:760px){.mailbox-contact-row{grid-template-columns:1fr}.mailbox-tab-actions{flex-direction:column}.mailbox-tab-actions .small-btn{width:100%;}}

/* --- v93: contactos clickeables en pestaña Correos --- */
.mailbox-contact-clickable{
  cursor:pointer;
  transition:background .15s ease, border-color .15s ease, transform .12s ease;
}
.mailbox-contact-clickable:hover{
  background:#fff8f9;
  border-color:rgba(209,43,56,.28);
  transform:translateY(-1px);
}
.mailbox-contact-actions{
  display:flex;
  align-items:center;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
}
.mailbox-contact-actions .small-btn{
  white-space:nowrap;
}
.mailbox-contacts-panel #mailboxContactSearch{
  border:2px solid rgba(209,43,56,.20);
}

/* --- V95: buscadores de correos/contactos mejorados --- */
.mailbox-search-box{
  margin:12px 0;
  display:grid;
  gap:6px;
}
.mailbox-search-box input{
  width:100%;
}
.mailbox-contact-row .muted strong{
  color:var(--brand-navy);
}


/* --- v99: WhatsApp integrado en Cliente 360 --- */
.crm-panel-whatsapp .inline-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.crm-whatsapp-list .email-360-item{border-left:5px solid rgba(78,186,116,.45)}


/* --- v100: WhatsApp leído / no leído visual --- */
.crm-whatsapp-list .whatsapp-360-item{
  border-radius:16px;
  transition:background .15s ease,border-color .15s ease,box-shadow .15s ease;
}
.crm-whatsapp-list .whatsapp-unread{
  background:#fff5f6 !important;
  border-left:7px solid var(--primary) !important;
  box-shadow:0 8px 20px rgba(209,43,56,.10);
}
.crm-whatsapp-list .whatsapp-unread strong{
  color:var(--brand-navy);
  font-weight:900;
}
.crm-whatsapp-list .whatsapp-read{
  background:#fff !important;
  border-left:5px solid rgba(78,186,116,.38) !important;
  opacity:.82;
}
.crm-whatsapp-list .wa-read-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 9px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  margin-left:8px;
  white-space:nowrap;
}
.crm-whatsapp-list .wa-pill-unread{
  color:#a91f2c;
  background:#ffe5e8;
  border:1px solid rgba(209,43,56,.35);
}
.crm-whatsapp-list .wa-pill-read{
  color:#197a43;
  background:#edf8f1;
  border:1px solid rgba(78,186,116,.35);
}

/* --- V101: permisos granulares por usuario --- */
.permissions-box{
  border:1px solid rgba(21,32,40,.12);
  border-radius:16px;
  background:#fbfcfd;
  padding:14px;
  display:grid;
  gap:12px;
}
.permission-group{
  border:1px solid rgba(21,32,40,.08);
  border-radius:14px;
  background:#fff;
  padding:12px;
}
.permission-group h5{
  margin:0 0 8px 0;
  font-size:14px;
  color:var(--brand-navy);
  text-transform:uppercase;
}
.permission-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
}
.permission-check{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:12px;
  background:#f8fafc;
  font-weight:700;
}
.permission-check input{
  width:18px;
  height:18px;
  min-height:18px;
  padding:0;
}
@media (max-width:760px){
  .permission-grid{grid-template-columns:1fr;}
}

/* --- V102: WhatsApp Cloud API - números por usuario --- */
.whatsapp-number-editor{
  margin-top:14px;
  padding:12px;
  border:1px solid rgba(21,32,40,.10);
  border-radius:16px;
  background:#fbfcfd;
}
.modal-subhead-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:10px;
}
.modal-subhead-row h4{margin:0 0 4px 0;}
.whatsapp-number-table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.whatsapp-number-table{
  min-width:1120px;
  table-layout:auto;
}
.whatsapp-number-table input,
.whatsapp-number-table select{
  min-width:120px;
  padding:7px 8px;
  font-size:12px;
}
.whatsapp-number-table .center{text-align:center;}
.whatsapp-number-table input[type="checkbox"]{
  min-width:unset;
  width:18px;
  height:18px;
}
.whatsapp-empty-box{
  padding:12px;
  border:1px dashed rgba(21,32,40,.18);
  border-radius:12px;
  background:#fff;
}
button.danger,
.small-btn.danger{
  color:#D12B38;
  border-color:rgba(209,43,56,.35);
  background:#fff6f7;
}

/* --- V115: bandeja correos por meses y cabecera móvil más usable --- */
.mailbox-load-more-box{
  margin:14px 0 6px 0;
  padding:12px;
  border:1px dashed rgba(21,32,40,.18);
  border-radius:14px;
  background:#fbfcfd;
}
.mailbox-load-more-box button{
  max-width:360px;
}
@media (max-width: 900px){
  .compact-topbar,
  .topbar{
    position:static !important;
    top:auto !important;
    z-index:auto !important;
  }
  .compact-topbar{
    padding:10px 10px 8px !important;
    gap:8px !important;
  }
  .compact-topbar-main,
  .topbar-main{
    min-height:auto !important;
    padding:0 !important;
  }
  .app-identity{
    align-items:center;
    gap:10px;
  }
  .app-logo,
  .brand-logo-topbar{
    width:72px !important;
    max-width:22vw !important;
  }
  .app-title h1,
  .topbar h2{
    font-size:22px !important;
    line-height:1.1 !important;
  }
  .app-title .muted,
  .user-badge,
  #userBadge{
    font-size:12px !important;
  }
  .topbar-actions{
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
    width:100% !important;
  }
  .topbar-actions button{
    min-height:44px;
    padding:9px 8px;
  }
  main{padding:10px !important;}
}
@media (max-width: 520px){
  .topbar-actions{grid-template-columns:1fr 1fr !important;}
  .app-title h1,.topbar h2{font-size:20px !important;}
}




/* --- V121: indicador global visible de procesamiento --- */
#globalBusyIndicator{
  position:fixed;
  top:18px;
  left:50%;
  transform:translateX(-50%);
  z-index:99999;
  display:none;
  align-items:center;
  gap:12px;
  padding:14px 22px;
  border-radius:999px;
  background:#15202b;
  color:#fff;
  box-shadow:0 16px 40px rgba(0,0,0,.28);
  font-weight:800;
  letter-spacing:.2px;
  border:1px solid rgba(255,255,255,.18);
}
#globalBusyIndicator.show{display:flex;}
#globalBusyIndicator.done{background:#116b3a;}
.busy-dot{
  width:16px;
  height:16px;
  border-radius:999px;
  border:3px solid rgba(255,255,255,.35);
  border-top-color:#fff;
  animation:busy-spin .8s linear infinite;
}
#globalBusyIndicator.done .busy-dot{
  border-color:#fff;
  animation:none;
  position:relative;
}
#globalBusyIndicator.done .busy-dot::after{
  content:"✓";
  position:absolute;
  inset:-7px 0 0 -1px;
  font-size:18px;
  color:#fff;
}
@keyframes busy-spin{to{transform:rotate(360deg);}}
body.app-is-busy{cursor:progress;}
body.app-is-busy button,
body.app-is-busy input,
body.app-is-busy select,
body.app-is-busy textarea{cursor:progress;}
button.btn-busy{opacity:.75; cursor:progress !important;}
button.btn-done{box-shadow:0 0 0 2px rgba(34,197,94,.28) inset;}

/* V125 - reportes: números clicables y modal de clientes */
.report-number-link{
  border:0;
  background:transparent;
  color:inherit;
  text-decoration:underline;
  cursor:pointer;
  font:inherit;
  padding:2px 4px;
}
.report-number-link:hover{ color:#d7263d; }
.report-clients-modal{ width:min(980px, 94vw) !important; max-height:86vh; overflow:auto; }
.report-clients-list{ display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.report-client-row{ display:flex; justify-content:space-between; gap:12px; align-items:center; border:1px solid #dde3ea; border-radius:14px; padding:10px 12px; background:#fff; }
@media (max-width:700px){ .report-client-row{ align-items:flex-start; flex-direction:column; } }

/* V130 - Ítems cotizados / Re-cotizar en Cliente 360 */
.crm-requote-box{
  margin-top:16px;
  padding:14px;
  border:1px solid #d9e2ee;
  border-radius:16px;
  background:#f8fafc;
}
.crm-requote-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  flex-wrap:wrap;
}
.crm-requote-head h4{margin:0 0 4px 0;font-size:18px;}
.crm-requote-search{width:100%;margin:12px 0;}
.crm-requote-list{display:grid;gap:10px;max-height:420px;overflow:auto;padding-right:4px;}
.crm-requote-item{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:10px;
  align-items:start;
  border:1px solid #d9e2ee;
  border-radius:14px;
  padding:10px;
  background:#fff;
  cursor:pointer;
}
.crm-requote-item:hover{border-color:#b9c7d8;box-shadow:0 4px 14px rgba(15,23,42,.06);}
.crm-requote-main{min-width:0;}
.crm-requote-actions{display:flex;gap:6px;align-items:center;}
@media (max-width: 760px){
  .crm-requote-item{grid-template-columns:auto 1fr;}
  .crm-requote-actions{grid-column:2;}
}


/* V131 exportación y comentarios PDF */
.quote-comments-box{margin-top:14px;padding:12px;border:1px solid #dbe3ee;border-radius:14px;background:#fafcff}
.quote-comments-box label{display:block;font-weight:700;margin-bottom:6px}
.quote-comments-box textarea{width:100%;min-height:90px;resize:vertical}


/* --- V134: exportación de clientes CRM --- */
.bulk-export-panel{
  margin:12px 0 18px 0;
  padding:16px;
  border:1px solid rgba(21,32,40,.12);
  border-left:6px solid var(--brand-green);
  border-radius:18px;
  background:#f8fffb;
  box-shadow:0 6px 18px rgba(21,32,40,.05);
}
.bulk-export-panel h4{margin:0 0 4px 0;}
.bulk-export-controls{margin-top:12px;align-items:end;}
.bulk-export-action{display:flex;align-items:end;}
.bulk-export-action button{min-height:42px;}
@media (max-width:900px){
  .bulk-export-controls{grid-template-columns:1fr!important;}
}


/* --- P138 WhatsApp Light + Leads --- */
.whatsapp-light-card .qr-placeholder{margin-top:14px;padding:16px;border:1px dashed var(--border);border-radius:16px;background:#fbfcfd;text-align:center;word-break:break-all}
.whatsapp-light-status{line-height:1.6}
button#btnMyWhatsapp{border-color:rgba(78,186,116,.45);}

/* P190 calendario alertas */
.task-alerts-compact{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px}
.task-alerts-compact h3{margin:0 0 3px}.task-calendar-modal-card{width:min(1420px,96vw);max-width:1420px;max-height:92vh;overflow:auto}
.task-calendar-kpis{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:14px 0}.task-calendar-kpis>div{border:1px solid #dbe2ea;border-radius:12px;padding:12px 16px;background:#f8fafc;display:flex;gap:10px;align-items:baseline}.task-calendar-kpis strong{font-size:24px;color:#9f1d20}.task-calendar-kpis span{color:#64748b}
.task-calendar-toolbar{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:12px;margin:12px 0}.task-calendar-toolbar>div:last-child{display:flex;justify-content:flex-end;align-items:end;gap:8px}.task-calendar-toolbar h4{margin:0;text-align:center;font-size:20px}.task-calendar-vendor-filter{display:flex;flex-direction:column;font-size:12px;gap:3px}.task-calendar-vendor-filter select{min-width:190px}
.task-calendar-legend{display:flex;flex-wrap:wrap;gap:8px 14px;margin:8px 0 12px;padding:8px 10px;border-radius:10px;background:#f8fafc}.task-calendar-legend span{display:inline-flex;align-items:center;gap:6px;font-size:12px}.task-calendar-legend i{width:10px;height:10px;border-radius:50%;display:inline-block}
.task-calendar-layout{display:grid;grid-template-columns:minmax(650px,1.8fr) minmax(330px,.9fr);gap:14px}.task-calendar-weekdays,.task-calendar-grid{display:grid;grid-template-columns:repeat(7,1fr)}.task-calendar-weekdays>div{text-align:center;font-weight:700;padding:8px;color:#475569;border-bottom:1px solid #dbe2ea}.task-calendar-grid{border-left:1px solid #dbe2ea;border-top:1px solid #dbe2ea}
.task-calendar-day{min-height:105px;border:0;border-right:1px solid #dbe2ea;border-bottom:1px solid #dbe2ea;background:white;text-align:left;padding:8px;display:flex;flex-direction:column;gap:5px;cursor:pointer;border-radius:0;color:#1f2937}.task-calendar-day:hover{background:#f8fafc}.task-calendar-day.other-month{background:#f8fafc;color:#94a3b8}.task-calendar-day.today{box-shadow:inset 0 0 0 2px #9f1d20}.task-calendar-day.selected{background:#eff6ff}.task-calendar-day.has-overdue .task-calendar-day-number{color:#b91c1c}.task-calendar-day-number{font-weight:800;font-size:15px}.task-calendar-day-count{font-size:11px;color:#64748b}.task-calendar-day-owners{display:flex;flex-wrap:wrap;gap:4px;margin-top:auto}.task-calendar-owner-count{background:var(--owner-color);color:white;border-radius:999px;padding:2px 6px;font-size:10px;font-weight:700}
.task-calendar-detail{border:1px solid #dbe2ea;border-radius:12px;padding:12px;min-height:100%}.task-calendar-detail-head{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e2e8f0;padding-bottom:8px;margin-bottom:8px}.task-calendar-detail-head h4{margin:0;text-transform:capitalize}.task-day-item{display:grid;grid-template-columns:5px 1fr;gap:8px;border-bottom:1px solid #e5e7eb;padding:10px 0}.task-owner-strip{background:var(--owner-color);border-radius:99px}.task-day-actions{grid-column:2;display:flex;flex-wrap:wrap;gap:5px}.task-owner-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin:0 5px}.task-calendar-empty{padding:18px 4px}
@media(max-width:1000px){.task-calendar-layout{grid-template-columns:1fr}.task-calendar-toolbar{grid-template-columns:1fr}.task-calendar-toolbar h4{text-align:left}.task-calendar-toolbar>div:last-child{justify-content:flex-start}.task-calendar-day{min-height:82px}}

/* P191 - colores únicos por usuario */
.alert-color-picker{display:flex;flex-wrap:wrap;gap:9px;padding:10px 0}
.alert-color-swatch{width:31px;height:31px;border-radius:50%;background:var(--swatch);border:3px solid transparent;cursor:pointer;box-shadow:0 0 0 1px #cbd5e1;transition:.12s ease}
.alert-color-swatch:hover:not(:disabled){transform:scale(1.09)}
.alert-color-swatch.selected{border-color:#fff;box-shadow:0 0 0 3px #111827}
.alert-color-swatch.used{opacity:.20;cursor:not-allowed;filter:grayscale(.55)}

/* P192 - tooltip de colores asignados */
.alert-color-swatch.used{
  opacity:.55 !important;
  cursor:not-allowed;
  filter:none !important;
  position:relative;
}
.alert-color-swatch.used:hover{
  transform:none !important;
}

/* P193 - usuarios sin color asignado */
.alert-color-picker:empty::before{
  content:"Sin colores disponibles";
  color:#64748b;
  font-size:12px;
}


/* P207 - módulos integrados sin recargar el ERP principal */
.integrated-module-shell{
  position:fixed;
  inset:0;
  z-index:99999;
  background:#fff;
  display:flex;
  flex-direction:column;
}
.integrated-module-bar{
  flex:0 0 auto;
  min-height:54px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:8px 14px;
  border-bottom:1px solid #d7dce2;
  background:#fff;
  box-shadow:0 1px 4px rgba(0,0,0,.08);
}
.integrated-module-bar strong{
  font-size:16px;
}
.integrated-module-spacer{flex:1}
.integrated-module-frame{
  width:100%;
  flex:1 1 auto;
  border:0;
  min-height:0;
  background:#fff;
}

/* P209 */
.integrated-module-shell{display:block}.integrated-module-frame{width:100%;height:100%;min-height:100%;display:block;border:0}


/* P211 - usuarios conectados */
.active-users-summary{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0 12px}
.active-user-pill,.active-user-status{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:5px 10px;font-size:12px;font-weight:700}
.active-user-pill.is-active,.active-user-status.is-active{background:#e8f7ee;color:#176b38;border:1px solid #b9e4c9}
.active-user-pill.is-idle,.active-user-status.is-idle{background:#fff6df;color:#825c09;border:1px solid #f0d98f}
.active-users-table small{color:#667085}
.active-users-table td{vertical-align:top}
.maintenance-advice{margin-top:12px;padding:10px 12px;border-radius:9px;background:#f7f8fa;border:1px solid #e0e3e8}
.maintenance-advice.warning{background:#fff3e8;border-color:#f0b97d;color:#7d3e00}
@media(max-width:760px){
  .active-users-table{min-width:820px}
  #adminActiveUsers .table-wrap{overflow-x:auto}
}
