/* NexoProCRM v0.17.8 · Fase 6: pulido visual por módulos
   Mejora la lectura de clientes, visitas, oportunidades, pedidos, incidencias, tareas, gastos y calendario.
   No modifica lógica fiscal, cálculos, plantillas de factura ni envíos VERI*FACTU. */

:root{
  --nxp-module-line:#e7ecf2;
  --nxp-module-soft:#f8fafc;
  --nxp-module-soft-red:#fff7f7;
  --nxp-module-red-line:#d71920;
}

/* Jerarquía de módulos */
.ch301-main > .ch301-panel:not(.ch301-dashboard-section):not(.ch301-dashboard-actions-panel):not(.ch301-dashboard-export-panel):not(.ch301-dashboard-activity){
  position:relative;
}
.ch301-main > .ch301-panel:not(.ch301-dashboard-section):not(.ch301-dashboard-actions-panel):not(.ch301-dashboard-export-panel):not(.ch301-dashboard-activity) > h2:first-child{
  position:relative;
  margin-bottom:14px!important;
  padding-left:14px;
  font-size:20px!important;
  line-height:1.18!important;
  font-weight:850!important;
  letter-spacing:-.025em!important;
}
.ch301-main > .ch301-panel:not(.ch301-dashboard-section):not(.ch301-dashboard-actions-panel):not(.ch301-dashboard-export-panel):not(.ch301-dashboard-activity) > h2:first-child:before{
  content:"";
  position:absolute;
  left:0;
  top:.15em;
  bottom:.15em;
  width:4px;
  border-radius:999px;
  background:var(--nxp-module-red-line);
}
.ch301-main > .ch301-panel > p:first-of-type{
  margin-top:-4px!important;
}

/* Paneles de creación: visibles, pero sin saturar de rojo */
.ch301-panel#nuevo,
.ch301-visit-form#nuevo{
  scroll-margin-top:96px;
}
.ch301-panel#nuevo{
  border-color:#ffd6da!important;
  background:linear-gradient(180deg,#fff 0%,#fffafa 100%)!important;
}
.ch301-panel#nuevo:after{
  content:"Nuevo registro";
  position:absolute;
  top:18px;
  right:20px;
  padding:5px 9px;
  border:1px solid #ffd6da;
  border-radius:999px;
  background:#fff;
  color:var(--nxp-accent-dark);
  font-size:11px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.ch301-panel#nuevo .ch301-form,
.ch301-visit-form#nuevo{
  margin-top:6px;
}

/* Filtros: apariencia de barra de búsqueda, más limpia */
.ch301-filters,
.ch301-client-search-form,
.ch301-export-form{
  background:var(--nxp-module-soft)!important;
  border:1px solid var(--nxp-module-line)!important;
  border-radius:16px!important;
  padding:14px!important;
}
.ch301-filters .ch301-grid,
.ch301-client-search-form .ch301-grid{
  gap:12px!important;
}
.ch301-filters label,
.ch301-client-search-form label,
.ch301-export-form label{
  margin:0!important;
}
.ch301-filters button,
.ch301-client-search-form button,
.ch301-export-form button{
  align-self:end;
}

/* Botoneras internas: agrupación más clara y menos peso rojo */
.ch301-actions,
.ch301-row-actions{
  gap:8px!important;
}
.ch301-actions{
  display:flex!important;
  flex-wrap:wrap!important;
  align-items:center!important;
  padding:14px!important;
  border:1px solid var(--nxp-module-line)!important;
  border-radius:18px!important;
  background:#fff!important;
  box-shadow:0 8px 20px rgba(17,24,39,.035)!important;
}
.ch301-actions .ch301-btn,
.ch301-row-actions .ch301-btn{
  border-radius:12px!important;
  font-weight:850!important;
}
.ch301-actions .ch301-btn-red:not(.ch301-btn-danger),
.ch301-row-actions .ch301-btn-red:not(.ch301-btn-danger){
  background:#202832!important;
  border-color:#202832!important;
  color:#fff!important;
}
.ch301-actions .ch301-btn-red:not(.ch301-btn-danger):hover,
.ch301-row-actions .ch301-btn-red:not(.ch301-btn-danger):hover{
  background:#111827!important;
  border-color:#111827!important;
}
.ch301-actions .ch301-btn-light,
.ch301-row-actions .ch301-btn-light{
  background:#fff!important;
  border-color:var(--nxp-border)!important;
  color:#313a46!important;
}

/* Ficha de cliente: cabecera y datos más legibles */
.ch301-client-head{
  padding:0!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
}
.ch301-client-title{
  position:relative;
  overflow:hidden;
}
.ch301-client-title:before{
  content:"";
  position:absolute;
  left:0;
  top:18px;
  bottom:18px;
  width:4px;
  border-radius:0 999px 999px 0;
  background:var(--nxp-accent);
}
.ch301-client-title h2{
  font-size:26px!important;
  font-weight:850!important;
}
.ch301-client-title p{
  margin-top:4px!important;
  color:var(--nxp-muted)!important;
}
.ch301-detail-grid{
  gap:10px!important;
}
.ch301-detail-grid p{
  margin:0!important;
  padding:13px 14px!important;
  line-height:1.35!important;
}
.ch301-detail-grid p strong{
  display:block;
  margin-bottom:4px;
  color:#667085!important;
  font-size:11px!important;
  font-weight:950!important;
  letter-spacing:.08em;
  text-transform:uppercase;
}

/* Timeline, notas e historial */
.ch301-timeline{
  display:grid!important;
  gap:10px!important;
  margin:0!important;
  padding:0!important;
  list-style:none!important;
}
.ch301-timeline li{
  position:relative;
  margin:0!important;
  padding:13px 14px 13px 18px!important;
  border:1px solid var(--nxp-module-line)!important;
  border-radius:14px!important;
  background:#fff!important;
  box-shadow:0 6px 16px rgba(17,24,39,.035)!important;
}
.ch301-timeline li:before{
  content:"";
  position:absolute;
  left:0;
  top:14px;
  bottom:14px;
  width:3px;
  border-radius:0 999px 999px 0;
  background:#e8edf3;
}
.ch301-timeline li:hover:before{
  background:var(--nxp-accent);
}
.ch301-timeline-link{
  font-weight:800!important;
  text-decoration:none!important;
}
.ch301-timeline small,
.ch301-timeline span{
  color:var(--nxp-muted)!important;
}

/* Tarjetas de visitas y oportunidades */
.ch301-visit-mini-list,
.ch301-opportunity-list{
  display:grid!important;
  gap:12px!important;
}
.ch301-visit-card,
.ch301-opportunity-row,
.ch301-client-result-card{
  position:relative;
  overflow:hidden;
}
.ch301-visit-card:after,
.ch301-client-result-card:after{
  content:"";
  position:absolute;
  left:0;
  top:0;
  height:3px;
  width:100%;
  background:linear-gradient(90deg,var(--nxp-accent),#e8edf3 120px,#e8edf3);
  opacity:.85;
}
.ch301-visit-card-head,
.ch301-opportunity-row-head{
  gap:12px!important;
}
.ch301-opportunity-row ul,
.ch301-visit-card ul{
  margin-top:12px!important;
}
.ch301-opportunity-row li,
.ch301-visit-card li{
  line-height:1.45!important;
}

/* Importación y documentos */
.ch301-dropzone{
  border:1.5px dashed #cbd5df!important;
  border-radius:18px!important;
  background:#f8fafc!important;
  transition:border-color .16s ease,background .16s ease,box-shadow .16s ease;
}
.ch301-dropzone:hover{
  border-color:#d71920!important;
  background:#fffafa!important;
  box-shadow:0 0 0 3px rgba(215,25,32,.06)!important;
}
.ch301-dropzone-icon{
  background:#202832!important;
  color:#fff!important;
}
.ch301-file-card{
  transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease;
}
.ch301-file-card:hover{
  transform:translateY(-1px);
  border-color:#cbd5df!important;
  box-shadow:var(--nxp-shadow-sm)!important;
}

/* Calendario operativo */
.ch301-calendar-panel .ch301-calendar-note{
  border:1px solid #ffd6da!important;
  border-left:4px solid var(--nxp-accent)!important;
  border-radius:14px!important;
  background:#fffafa!important;
  color:#313a46!important;
}
.ch301-calendar-grid{
  gap:8px!important;
}
.ch301-day{
  border-radius:16px!important;
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
.ch301-day:hover{
  transform:translateY(-1px);
  border-color:#cbd5df!important;
  box-shadow:0 10px 22px rgba(17,24,39,.06)!important;
}
.ch301-day.has-events:hover{
  border-color:#ffc5ca!important;
}

/* Estados vacíos y mensajes */
.ch301-empty,
.ch301-section-hint,
.ch301-muted{
  color:#667085!important;
}
.ch301-error,
.ch301-success,
.ch301-alert{
  border-radius:14px!important;
  box-shadow:0 8px 20px rgba(17,24,39,.04)!important;
}
.ch301-success{
  border-left:4px solid #1f7a4d!important;
}
.ch301-error,
.ch301-alert{
  border-left:4px solid var(--nxp-accent)!important;
}

/* PDF viewer shell coherente con la nueva identidad cuando se use dentro de iframes/visor */
.nxp-pdfbar{
  background:#202832!important;
}
.nxp-pdfdownload{
  background:var(--nxp-accent)!important;
}
.nxp-pdfback{
  color:#202832!important;
}

@media(max-width:900px){
  .ch301-panel#nuevo:after{
    position:static;
    display:inline-flex;
    margin-bottom:10px;
  }
  .ch301-actions{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .ch301-actions .ch301-btn{
    width:100%!important;
    justify-content:center!important;
  }
}
@media(max-width:640px){
  .ch301-actions{
    grid-template-columns:1fr;
  }
  .ch301-client-title h2{
    font-size:23px!important;
  }
  .ch301-main > .ch301-panel:not(.ch301-dashboard-section):not(.ch301-dashboard-actions-panel):not(.ch301-dashboard-export-panel):not(.ch301-dashboard-activity) > h2:first-child{
    font-size:18px!important;
  }
  .ch301-filters,
  .ch301-client-search-form,
  .ch301-export-form{
    padding:12px!important;
  }
}
