/* NexoProCRM v0.17.7 · Fase 4: pantallas internas
   Unifica listados, formularios, fichas y vistas operativas sin tocar lógica fiscal ni plantillas de factura. */
:root{
  --nxp-row-hover:#f8fafc;
  --nxp-card-line:#edf1f5;
  --nxp-chip:#f1f4f7;
}

/* Paneles internos: más aire, blanco limpio y títulos consistentes */
.ch301-main > .ch301-panel,
.ch301-main > section.ch301-panel{
  margin-bottom:18px!important;
}
.ch301-panel > h2:first-child,
.ch301-panel .ch301-section-head h2,
.ch301-panel .ch301-section-head h3{
  letter-spacing:-.02em!important;
}
.ch301-panel-intro,
.ch301-panel > p:first-of-type{
  max-width:860px;
  color:var(--nxp-muted)!important;
  line-height:1.55!important;
}
.ch301-section-head{
  align-items:flex-start!important;
  padding-bottom:12px;
  border-bottom:1px solid var(--nxp-card-line);
  margin-bottom:16px!important;
}
.ch301-section-head h2,
.ch301-section-head h3{
  font-size:18px!important;
  color:var(--nxp-ink-strong)!important;
}
.ch301-section-head p{
  color:var(--nxp-muted)!important;
}

/* Formularios por bloques */
.ch301-form-section,
.ch301-edit-client-form .ch301-form-section,
.ch301-client-access-box,
.ch301-visit-followup,
.ch301-edit-form,
.ch301-documents-panel .ch301-upload-form{
  background:#fff!important;
  border:1px solid var(--nxp-border)!important;
  border-radius:16px!important;
  box-shadow:0 8px 22px rgba(17,24,39,.045)!important;
}
.ch301-form-section-accent,
.ch301-edit-client-form .ch301-form-section-accent{
  border-left:0!important;
  background:#fff!important;
  position:relative;
}
.ch301-form-section-accent:before,
.ch301-edit-client-form .ch301-form-section-accent:before{
  content:"";
  position:absolute;
  top:16px;
  bottom:16px;
  left:0;
  width:3px;
  border-radius:999px;
  background:var(--nxp-border-strong);
}
.ch301-form label,
.nxp-invoice-form-grid label,
.nxp-payment-form label,
.nxp-invoice-lines label,
.nxp-commission-form label{
  color:var(--nxp-ink)!important;
  font-size:13px!important;
  font-weight:850!important;
}
.ch301-form input,
.ch301-form select,
.ch301-form textarea,
.ch301-priority-form select,
.ch301-status-form select{
  min-height:43px;
}
.ch301-form textarea{line-height:1.45!important;}
.ch301-form-actions,
.nxp-invoice-form-actions{
  padding-top:12px;
  border-top:1px solid var(--nxp-card-line);
}

/* Tablas: lectura más suave */
.ch301-table-wrap,
.nxp-invoice-table-wrap,
.nxp-commission-table-wrap{
  overflow:auto;
  background:#fff!important;
  border:1px solid var(--nxp-border)!important;
  border-radius:16px!important;
  box-shadow:0 8px 20px rgba(17,24,39,.035)!important;
}
.ch301-table,
.nxp-invoice-table,
.nxp-commission-table{
  border-collapse:separate!important;
  border-spacing:0!important;
}
.ch301-table th,
.nxp-invoice-table th,
.nxp-commission-table th{
  position:sticky;
  top:0;
  z-index:1;
  background:#f8fafc!important;
  color:#475467!important;
  font-size:11px!important;
  letter-spacing:.06em!important;
  text-transform:uppercase!important;
  font-weight:950!important;
  border-bottom:1px solid var(--nxp-border)!important;
}
.ch301-table td,
.nxp-invoice-table td,
.nxp-commission-table td{
  color:var(--nxp-ink)!important;
  background:#fff;
}
.ch301-table tbody tr:hover td,
.nxp-invoice-table tbody tr:hover td,
.nxp-commission-table tbody tr:hover td{
  background:var(--nxp-row-hover)!important;
}
.ch301-table td:first-child,
.ch301-table th:first-child{
  padding-left:16px!important;
}
.ch301-table td:last-child,
.ch301-table th:last-child{
  padding-right:16px!important;
}

/* Ficha de cliente y tarjetas de detalle */
.ch301-client-title,
.ch301-month-head{
  background:#fff;
  border:1px solid var(--nxp-border);
  border-radius:18px;
  padding:18px 20px;
  box-shadow:var(--nxp-shadow-sm);
}
.ch301-client-title h2,
.ch301-month-head h2{
  color:var(--nxp-ink-strong)!important;
  letter-spacing:-.025em;
}
.ch301-detail-grid p,
.ch301-discount-card,
.ch301-contact-card,
.ch301-file-card,
.ch301-sales-history-card,
.ch301-client-result-card,
.ch301-visit-card,
.ch301-opportunity-row{
  border:1px solid var(--nxp-border)!important;
  background:#fff!important;
  border-radius:16px!important;
  box-shadow:0 8px 22px rgba(17,24,39,.045)!important;
}
.ch301-detail-grid p,
.ch301-discount-card{
  background:#f8fafc!important;
}
.ch301-discount-card strong,
.ch301-contact-card strong,
.ch301-sales-history-card>strong,
.ch301-client-result-card strong,
.ch301-visit-card-head strong,
.ch301-opportunity-row-head strong{
  color:var(--nxp-ink-strong)!important;
}
.ch301-discount-card span,
.ch301-contact-card span,
.ch301-client-result-card span,
.ch301-sales-history-card>span,
.ch301-sales-history-card small,
.ch301-visit-card small,
.ch301-opportunity-row-head span{
  color:var(--nxp-muted)!important;
}
.ch301-file-icon{
  background:var(--nxp-surface-muted)!important;
  color:var(--nxp-ink)!important;
}
.ch301-documents-panel{
  border-top:1px solid var(--nxp-border)!important;
}
.ch301-documents-panel .ch301-upload-form{
  border-style:dashed!important;
  background:#f8fafc!important;
}

/* Visitas, oportunidades y operativa */
.ch301-visit-card-head,
.ch301-opportunity-row-head{
  border-bottom:1px solid var(--nxp-card-line);
  padding-bottom:12px;
}
.ch301-opportunity-row:before{
  width:4px!important;
  border-radius:999px;
  top:14px!important;
  bottom:14px!important;
  left:0!important;
}
.ch301-intel-panel:before{
  height:3px!important;
  background:linear-gradient(90deg,var(--nxp-accent),var(--nxp-border-strong))!important;
}
.ch301-intel-top{
  background:#f8fafc;
  border:1px solid var(--nxp-border);
  border-radius:14px;
  padding:12px;
}
.ch301-op-badge{
  border-radius:999px!important;
  font-size:11px!important;
  letter-spacing:.04em!important;
}

/* Buscador y resultados de clientes */
.ch301-client-access-grid{
  gap:14px!important;
}
.ch301-client-access-box{
  background:#fff!important;
}
.ch301-client-access-box h3{
  color:var(--nxp-ink-strong)!important;
}
.ch301-client-result-grid{
  gap:14px!important;
}
.ch301-client-result-card{
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
.ch301-client-result-card:hover{
  border-color:var(--nxp-border-strong)!important;
  box-shadow:var(--nxp-shadow-sm)!important;
  transform:translateY(-1px);
}

/* Calendario: sustituir azul intenso por gris oscuro */
.ch301-calendar-weekdays span{
  background:#f1f4f7!important;
  color:var(--nxp-ink)!important;
}
.ch301-month-head h2,
.ch301-day-number{
  color:var(--nxp-ink-strong)!important;
}
.ch301-day{
  border-color:var(--nxp-border)!important;
  box-shadow:0 6px 16px rgba(17,24,39,.035)!important;
}
.ch301-day.has-events{
  border-color:#ffd8db!important;
  background:linear-gradient(180deg,#fff 0%,#fffafa 100%)!important;
}
.ch301-day.is-today{
  box-shadow:0 0 0 2px var(--nxp-ink) inset!important;
}
.ch301-day-event{
  border-left-color:var(--nxp-accent)!important;
}
.ch301-day-event strong{
  color:var(--nxp-accent-dark)!important;
}

/* Estados y acciones: jerarquía clara */
.ch301-badge,
.ch301-status,
.nxp-invoice-status{
  border:1px solid rgba(17,24,39,.06)!important;
  box-shadow:none!important;
}
.ch301-row-actions .ch301-btn,
.nxp-invoice-actions .ch301-btn{
  min-height:36px!important;
  padding:9px 12px!important;
  border-radius:10px!important;
  box-shadow:none!important;
}
.ch301-row-actions form,
.nxp-inline-danger{
  margin:0!important;
}
.ch301-btn-danger{
  color:var(--nxp-accent-dark)!important;
  background:#fff!important;
  border:1px solid #ffd0d4!important;
}
.ch301-btn-danger:hover{
  color:#fff!important;
  background:var(--nxp-accent)!important;
  border-color:var(--nxp-accent)!important;
}

/* Contabilidad mantiene estructura, pero las pantallas internas quedan más suaves */
.nxp-accounting-nav,
.nxp-invoice-nav{
  border-radius:14px!important;
  box-shadow:var(--nxp-shadow-sm)!important;
}
.nxp-accounting-nav{
  background:#202832!important;
}
.nxp-accounting-nav a.is-active{
  color:#202832!important;
  box-shadow:inset 0 3px 0 var(--nxp-accent)!important;
}
.nxp-accounting-nav .nxp-accounting-new{
  background:var(--nxp-accent)!important;
  color:#fff!important;
}
.nxp-invoice-summary article,
.nxp-quarter-card,
.nxp-invoice-totals-live>div{
  transition:border-color .16s ease,box-shadow .16s ease;
}
.nxp-invoice-summary article:hover,
.nxp-quarter-card:hover{
  border-color:var(--nxp-border-strong)!important;
  box-shadow:var(--nxp-shadow-sm)!important;
}

/* Responsive interno */
@media(max-width:1180px){
  .ch301-detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .ch301-client-access-grid,
  .ch301-client-result-grid{grid-template-columns:1fr!important;}
}
@media(max-width:820px){
  .ch301-section-head,
  .ch301-client-title,
  .ch301-month-head,
  .ch301-visit-card-head,
  .ch301-opportunity-row-head{
    flex-direction:column!important;
    align-items:stretch!important;
  }
  .ch301-form-actions .ch301-btn,
  .ch301-row-actions .ch301-btn,
  .ch301-row-actions form,
  .nxp-invoice-actions .ch301-btn{
    width:100%!important;
    justify-content:center!important;
  }
  .ch301-table th,
  .ch301-table td{
    padding:11px 12px!important;
  }
}
@media(max-width:680px){
  .ch301-form-section,
  .ch301-client-title,
  .ch301-month-head{
    padding:15px!important;
    border-radius:15px!important;
  }
  .ch301-detail-grid,
  .ch301-discount-grid,
  .ch301-contact-grid,
  .ch301-files-grid,
  .ch301-sales-history-grid{
    grid-template-columns:1fr!important;
  }
}
