/* ==========================================================================
   modules/comercial.css - Modulo Comercial.
   Fase 1: movido TAL CUAL desde tqc.css (orden preservado => cascada identica).
   ========================================================================== */
/* ===== Módulo Comercial ===== */
.comercial-dashboard-message {
  max-width: 880px;
  font-size: 1rem;
  line-height: 1.55;
}

.comercial-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.comercial-panel-editor {
  margin: -6px 0 20px;
}

.comercial-panel-editor-form {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}

.comercial-panel-editor-form label {
  display: grid;
  gap: 6px;
  color: #25364d;
  font-weight: 800;
}

.comercial-panel-editor-form input,
.comercial-panel-editor-form textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 11px 13px;
  color: #0f172a;
  font: inherit;
  font-weight: 600;
  background: #f8fafc;
}

.comercial-totals-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.comercial-totals-grid .stat-card {
  min-height: 94px;
  padding: 15px 16px;
}

.comercial-module-grid {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 8px;
}

.comercial-module-grid .module-card {
  min-height: 230px;
}

.comercial-form {
  display: grid;
  gap: 18px;
}

.comercial-form .form-grid.two-cols {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.comercial-form .checkbox-field {
  align-items: stretch;
}

.comercial-form .comercial-check {
  justify-content: flex-start;
  gap: 12px;
  min-height: 44px;
}

.comercial-form .comercial-check span {
  margin: 0;
  min-width: auto;
}

.comercial-form .comercial-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
}

.trm-status {
  display: block;
  margin-top: 6px;
  color: var(--success);
  font-weight: 700;
}

.trm-status-error {
  color: var(--warning);
}

.branch-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.branch-total {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .06);
}

.comercial-live-filter {
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) repeat(3, minmax(170px, 1fr)) minmax(120px, .65fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.comercial-live-filter input,
.comercial-live-filter select {
  min-height: 42px;
}

.comercial-live-filter .btn {
  min-height: 42px;
  width: 100%;
}

.quote-release-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.quote-release-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.quote-release-card span {
  color: #5b677a;
  font-size: 12px;
  font-weight: 800;
}

.quote-release-card strong {
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
}

.comercial-codigos-scroll {
  max-height: 62vh;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.comercial-codigos-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed;
}

.comercial-codigos-table th,
.comercial-codigos-table td {
  padding: 8px 5px;
  font-size: 10.8px;
  vertical-align: middle;
}

.comercial-codigos-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.comercial-codigos-table .description-cell {
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.25;
}

.comercial-codigos-table .code-cell,
.comercial-codigos-table td:nth-child(3),
.comercial-codigos-table td:nth-child(4) {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.comercial-codigos-table .money-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap !important;
  font-size: 10.5px;
}

.comercial-codigos-table .number-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap !important;
  font-size: 10.5px;
}

.comercial-codigos-table th:nth-child(7),
.comercial-codigos-table td:nth-child(7) {
  background: #f6f8ff;
  text-align: center;
}

.comercial-codigos-table th:nth-child(8),
.comercial-codigos-table td:nth-child(8) {
  text-align: center;
  background: #f8fafc;
  font-variant-numeric: tabular-nums;
}

.comercial-codigos-table th:nth-child(6),
.comercial-codigos-table td:nth-child(6) {
  background: #f4fbf7;
  text-align: center;
}

.comercial-codigos-table th:nth-child(9),
.comercial-codigos-table td:nth-child(9) {
  text-align: center;
}

.comercial-codigos-table th:nth-child(5),
.comercial-codigos-table td:nth-child(5) {
  text-align: center;
}

.comercial-codigos-table th:nth-child(10),
.comercial-codigos-table td:nth-child(10),
.comercial-codigos-table th:nth-child(11),
.comercial-codigos-table td:nth-child(11) {
  text-align: center;
}

.comercial-codigos-table th:last-child,
.comercial-codigos-table td:last-child {
  border-right: 0;
}

.comercial-codigos-table th:nth-child(1),
.comercial-codigos-table td:nth-child(1) { width: 6%; }
.comercial-codigos-table th:nth-child(2),
.comercial-codigos-table td:nth-child(2) { width: 27%; }
.comercial-codigos-table th:nth-child(3),
.comercial-codigos-table td:nth-child(3) { width: 10%; }
.comercial-codigos-table th:nth-child(4),
.comercial-codigos-table td:nth-child(4) { width: 7%; }
.comercial-codigos-table th:nth-child(5),
.comercial-codigos-table td:nth-child(5) { width: 7%; }
.comercial-codigos-table th:nth-child(6),
.comercial-codigos-table td:nth-child(6) { width: 10%; }
.comercial-codigos-table th:nth-child(7),
.comercial-codigos-table td:nth-child(7) { width: 8%; }
.comercial-codigos-table th:nth-child(8),
.comercial-codigos-table td:nth-child(8) { width: 6%; }
.comercial-codigos-table th:nth-child(9),
.comercial-codigos-table td:nth-child(9) { width: 11.5%; }
.comercial-codigos-table th:nth-child(10),
.comercial-codigos-table td:nth-child(10) {
  width: 2.5%;
  padding-left: 2px;
  padding-right: 2px;
}
.comercial-codigos-table th:nth-child(11),
.comercial-codigos-table td:nth-child(11) {
  width: 4%;
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
}

.comercial-codigos-table td:nth-child(11) .btn {
  padding: 5px 6px;
  font-size: 10px;
}

.comercial-clientes-scroll {
  max-height: 520px;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.comercial-clientes-scroll::-webkit-scrollbar {
  width: 8px;
}

.comercial-clientes-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed;
}

.comercial-clientes-table th,
.comercial-clientes-table td {
  padding: 8px 6px;
  font-size: 11px;
  line-height: 1.25;
  vertical-align: middle;
}

.comercial-clientes-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.comercial-clientes-table td:nth-child(1),
.comercial-clientes-table td:nth-child(5),
.comercial-clientes-table td:nth-child(6),
.comercial-clientes-table td:nth-child(8),
.comercial-clientes-table td:nth-child(9),
.comercial-clientes-table td:nth-child(11) {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.comercial-clientes-table th:nth-child(2),
.comercial-clientes-table td:nth-child(2),
.comercial-clientes-table th:nth-child(4),
.comercial-clientes-table td:nth-child(4),
.comercial-clientes-table th:nth-child(7),
.comercial-clientes-table td:nth-child(7),
.comercial-clientes-table th:nth-child(10),
.comercial-clientes-table td:nth-child(10),
.comercial-clientes-table th:nth-child(12),
.comercial-clientes-table td:nth-child(12),
.comercial-clientes-table th:nth-child(11),
.comercial-clientes-table td:nth-child(11) {
  text-align: center;
}

.comercial-clientes-table th:nth-child(1),
.comercial-clientes-table td:nth-child(1) { width: 16%; }
.comercial-clientes-table th:nth-child(2),
.comercial-clientes-table td:nth-child(2) { width: 5%; }
.comercial-clientes-table th:nth-child(3),
.comercial-clientes-table td:nth-child(3) { width: 8%; }
.comercial-clientes-table th:nth-child(4),
.comercial-clientes-table td:nth-child(4) { width: 7%; }
.comercial-clientes-table th:nth-child(5),
.comercial-clientes-table td:nth-child(5) { width: 12%; }
.comercial-clientes-table th:nth-child(6),
.comercial-clientes-table td:nth-child(6) { width: 10%; }
.comercial-clientes-table th:nth-child(7),
.comercial-clientes-table td:nth-child(7) { width: 7%; }
.comercial-clientes-table th:nth-child(8),
.comercial-clientes-table td:nth-child(8) { width: 7%; }
.comercial-clientes-table th:nth-child(9),
.comercial-clientes-table td:nth-child(9) { width: 12%; }
.comercial-clientes-table th:nth-child(10),
.comercial-clientes-table td:nth-child(10) { width: 5%; }
.comercial-clientes-table th:nth-child(11),
.comercial-clientes-table td:nth-child(11) { width: 7%; }
.comercial-clientes-table th:nth-child(12),
.comercial-clientes-table td:nth-child(12) { width: 5%; }

.comercial-clientes-table td:nth-child(12) .btn {
  padding: 6px 8px;
  font-size: 10.5px;
}

.comercial-cotizaciones-scroll {
  max-height: 62vh;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.comercial-actas-scroll {
  max-height: 62vh;
  overflow: auto !important;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: #ffffff;
}

.comercial-scroll-sync-top {
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: #f8fafc;
  scrollbar-width: thin;
}

.comercial-scroll-sync-top > div {
  height: 1px;
  min-width: 100%;
}

.comercial-actas-filter {
  grid-template-columns: minmax(260px, 1.55fr) repeat(3, minmax(170px, 1fr)) minmax(120px, .65fr);
}

.acta-money-summary {
  grid-template-columns: minmax(260px, 1.8fr) repeat(4, minmax(120px, .8fr));
  margin-bottom: 8px;
}

.acta-billing-summary {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  align-items: stretch;
}

.acta-value-card {
  align-items: center;
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  min-height: 50px;
}

.acta-value-card strong {
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
  text-align: right;
}

.acta-state-card {
  min-height: 52px;
  padding: 8px 10px;
}

.acta-state-card span {
  max-width: 160px;
  font-size: 10.5px;
  line-height: 1.1;
}

.acta-state-card strong {
  font-size: 18px;
}

.acta-invoice-card {
  min-height: 50px;
  padding: 8px 10px;
}

.acta-invoice-card span {
  font-size: 11px;
  font-weight: 900;
}

.acta-invoice-card strong {
  font-size: 18px;
}

.acta-state-card,
.estado-acta-cell {
  border-color: rgba(15, 23, 42, .08) !important;
}

.estado-acta-cell {
  font-weight: 800;
}

.estado-acta-finalizado {
  background: rgba(0, 176, 80, .18) !important;
  color: #075f2b !important;
}

.estado-acta-acta-firmada {
  background: rgba(255, 242, 0, .35) !important;
  color: #675a00 !important;
}

.estado-acta-gr-es-rp {
  background: rgba(255, 192, 0, .32) !important;
  color: #704900 !important;
}

.estado-acta-orden-compra {
  background: rgba(229, 105, 225, .28) !important;
  color: #70206f !important;
}

.estado-acta-acta-firmada-oc {
  background: rgba(230, 255, 0, .35) !important;
  color: #5f6900 !important;
}

.estado-acta-por-facturar {
  background: rgba(112, 48, 160, .24) !important;
  color: #3f1664 !important;
}

.estado-acta-por-facturar-parcial {
  background: rgba(0, 222, 210, .26) !important;
  color: #005f59 !important;
}

.estado-acta-finalizado-parcial {
  background: rgba(0, 176, 240, .24) !important;
  color: #075b78 !important;
}

.estado-acta-ejecucion-total {
  background: rgba(255, 83, 220, .25) !important;
  color: #7a1768 !important;
}

.estado-acta-perdido {
  background: rgba(192, 0, 0, .22) !important;
  color: #7a1111 !important;
}

.factura-estado-cell {
  font-weight: 800;
  text-align: center;
}

.estado-factura-facturado {
  background: rgba(0, 176, 80, .2) !important;
  color: #075f2b !important;
}

.estado-factura-pendiente {
  background: rgba(255, 0, 0, .18) !important;
  color: #8a1111 !important;
}

.estado-factura-no-facturado {
  background: rgba(0, 176, 240, .22) !important;
  color: #075b78 !important;
}

.estado-factura-pagado {
  background: rgba(237, 125, 49, .24) !important;
  color: #803900 !important;
}

.comercial-actas-table {
  min-width: 1780px;
  table-layout: fixed;
}

.comercial-actas-table th,
.comercial-actas-table td {
  padding: 8px 7px;
  font-size: 11px;
  vertical-align: middle;
}

.comercial-actas-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.comercial-actas-table th:nth-child(1),
.comercial-actas-table td:nth-child(1) { width: 95px; }
.comercial-actas-table th:nth-child(3),
.comercial-actas-table td:nth-child(3),
.comercial-actas-table th:nth-child(5),
.comercial-actas-table td:nth-child(5),
.comercial-actas-table th:nth-child(17),
.comercial-actas-table td:nth-child(17),
.comercial-actas-table th:nth-child(19),
.comercial-actas-table td:nth-child(19) { text-align: center; }
.comercial-actas-table th:nth-child(12),
.comercial-actas-table td:nth-child(12),
.comercial-actas-table th:nth-child(13),
.comercial-actas-table td:nth-child(13),
.comercial-actas-table th:nth-child(14),
.comercial-actas-table td:nth-child(14),
.comercial-actas-table th:nth-child(16),
.comercial-actas-table td:nth-child(16) {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.acta-calculated-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.acta-calculated-state span {
  color: #5b677a;
  font-weight: 800;
}

.acta-calculated-state strong {
  color: var(--primary);
}

.comercial-cotizaciones-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed;
}

.comercial-cotizaciones-table th,
.comercial-cotizaciones-table td {
  padding: 8px 6px;
  font-size: 11px;
  vertical-align: middle;
}

.comercial-cotizaciones-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.comercial-cotizaciones-table td:nth-child(2),
.comercial-cotizaciones-table td:nth-child(3),
.comercial-cotizaciones-table td:nth-child(4),
.comercial-cotizaciones-table td:nth-child(12) {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.quote-service-description,
.quote-service-location {
  color: #334155;
  line-height: 1.25;
}

.quote-release-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 5px 7px;
  border-radius: var(--radius-pill);
  background: #eef2f7;
  color: #25364d;
  font-weight: 800;
  line-height: 1.1;
}

.comercial-cotizaciones-table .money-cell,
.comercial-cotizaciones-table th:nth-child(5),
.comercial-cotizaciones-table td:nth-child(5),
.comercial-cotizaciones-table th:nth-child(6),
.comercial-cotizaciones-table td:nth-child(6),
.comercial-cotizaciones-table th:nth-child(7),
.comercial-cotizaciones-table td:nth-child(7),
.comercial-cotizaciones-table th:nth-child(8),
.comercial-cotizaciones-table td:nth-child(8),
.comercial-cotizaciones-table th:nth-child(13),
.comercial-cotizaciones-table td:nth-child(13) {
  text-align: center;
}

.comercial-cotizaciones-table th:nth-child(1),
.comercial-cotizaciones-table td:nth-child(1) { width: 6%; }
.comercial-cotizaciones-table th:nth-child(2),
.comercial-cotizaciones-table td:nth-child(2) { width: 5%; }
.comercial-cotizaciones-table th:nth-child(3),
.comercial-cotizaciones-table td:nth-child(3) { width: 14%; }
.comercial-cotizaciones-table th:nth-child(4),
.comercial-cotizaciones-table td:nth-child(4) { width: 9%; }
.comercial-cotizaciones-table th:nth-child(5),
.comercial-cotizaciones-table td:nth-child(5) { width: 6%; }
.comercial-cotizaciones-table th:nth-child(6),
.comercial-cotizaciones-table td:nth-child(6) { width: 6%; }
.comercial-cotizaciones-table th:nth-child(7),
.comercial-cotizaciones-table td:nth-child(7) { width: 8%; }
.comercial-cotizaciones-table th:nth-child(8),
.comercial-cotizaciones-table td:nth-child(8) { width: 8%; }
.comercial-cotizaciones-table th:nth-child(9),
.comercial-cotizaciones-table td:nth-child(9) { width: 7%; }
.comercial-cotizaciones-table th:nth-child(10),
.comercial-cotizaciones-table td:nth-child(10) { width: 6%; }
.comercial-cotizaciones-table th:nth-child(11),
.comercial-cotizaciones-table td:nth-child(11) { width: 7%; }
.comercial-cotizaciones-table th:nth-child(12),
.comercial-cotizaciones-table td:nth-child(12) { width: 8%; }
.comercial-cotizaciones-table th:nth-child(13),
.comercial-cotizaciones-table td:nth-child(13) { width: 10%; }

.quote-actions-cell {
  padding-left: 4px !important;
  padding-right: 4px !important;
}

.quote-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.quote-actions form {
  display: inline-flex;
  margin: 0;
}

.quote-action-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #dbe4f0;
  border-radius: var(--radius-pill);
  background: #f8fafc;
  color: #123f8c;
  font-size: 10.5px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.quote-action-chip:hover {
  background: #edf4ff;
  color: #0f3474;
}

.quote-action-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.quote-action-danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.quote-action-icon {
  width: 28px;
  min-width: 28px;
  padding: 0;
}

.quote-action-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quote-status-select {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 800;
}

.quote-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 800;
}

.quote-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .42);
}

.quote-modal[hidden] {
  display: none;
}

.quote-modal-panel {
  width: min(980px, 96vw);
  max-height: 88vh;
  overflow: auto;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .24);
}

.quote-modal-header,
.quote-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.quote-form-footer {
  margin: 20px 0 16px;
}

.quote-modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.quote-calc-row,
.quote-item-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(90px, .45fr) minmax(120px, .55fr) minmax(130px, .6fr) minmax(80px, auto);
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.quote-calc-head {
  font-weight: 800;
  color: var(--primary);
}

.quote-calc-row select,
.quote-calc-row input,
.quote-item-row select,
.quote-item-row input,
.quote-item-row textarea {
  width: 100%;
}

.quote-iva {
  margin-top: 12px;
}

.quote-calc-totals {
  display: grid;
  grid-template-columns: auto minmax(140px, auto);
  justify-content: end;
  gap: 6px 16px;
  margin: 12px 0;
  font-variant-numeric: tabular-nums;
}

.quote-form-totals {
  margin: 0;
}

.quote-client-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fafc;
  font-size: 12px;
}

.quote-main-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.quote-main-grid .form-field {
  margin: 0;
}

.quote-number-field {
  padding: 8px 10px;
  border: 1px solid #facc15;
  border-radius: var(--radius-md);
  background: #fffbeb;
}

.quote-number-field label {
  color: #92400e;
}

.quote-number-field input {
  border-color: #f59e0b;
  color: #92400e;
  font-weight: 900;
}

.quote-number-field small {
  display: block;
  margin-top: 4px;
  color: #a16207;
  font-size: 11px;
  font-weight: 800;
}

.quote-grid-span {
  grid-column: span 2;
}

.quote-service-field {
  margin: 12px 0;
}

.section-title-small {
  margin: 16px 0 8px;
  font-size: 18px;
}

.quote-item-row {
  grid-template-columns: minmax(210px, 1.1fr) minmax(80px, .35fr) minmax(280px, 1.5fr) minmax(120px, .55fr) minmax(120px, .55fr) minmax(70px, auto);
  align-items: end;
}

.quote-excel-card {
  max-height: 520px;
}

.quote-excel-table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.quote-excel-table th,
.quote-excel-table td {
  padding: 6px;
  font-size: 11px;
  vertical-align: middle;
}

.quote-excel-table .quote-item-row {
  display: table-row;
  padding: 0;
  border-bottom: 0;
}

.quote-excel-table input,
.quote-excel-table textarea {
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.quote-excel-table th:nth-child(1),
.quote-excel-table td:nth-child(1) { width: 9%; }
.quote-excel-table th:nth-child(2),
.quote-excel-table td:nth-child(2) { width: 7%; }
.quote-excel-table th:nth-child(3),
.quote-excel-table td:nth-child(3) { width: 8%; }
.quote-excel-table th:nth-child(4),
.quote-excel-table td:nth-child(4) { width: 43%; }
.quote-excel-table th:nth-child(5),
.quote-excel-table td:nth-child(5) { width: 13%; }
.quote-excel-table th:nth-child(6),
.quote-excel-table td:nth-child(6) { width: 14%; }
.quote-excel-table th:nth-child(7),
.quote-excel-table td:nth-child(7) { width: 6%; }

.quote-excel-table textarea {
  min-height: 36px;
  resize: none;
}

.quote-excel-table textarea[readonly],
.quote-excel-table input[readonly] {
  background: #f8fafc;
  color: #334155;
}

.quote-code-helper {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(260px, 1fr);
  gap: 8px 12px;
  align-items: center;
  margin: 4px 0 10px;
}

.quote-code-helper label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quote-code-helper input {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.quote-code-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 352px;
  right: 0;
  z-index: 5;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .12);
}

.quote-code-results button {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 150px;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  color: #0f172a;
}

.quote-code-results strong {
  color: #0f172a;
  font-weight: 900;
}

.quote-code-results button:hover {
  background: #f8fafc;
}

.quote-code-results span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-code-results small {
  overflow: hidden;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-excel-table input[name$="-valor_unitario"] {
  display: none;
}

.quote-money-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: #0f172a;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quote-hidden-code {
  display: none;
}

.quote-selected-card {
  max-height: 190px;
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.quote-selected-card.quote-excel-card {
  max-height: 360px;
  min-height: 285px;
}

.quote-selected-table {
  width: 100%;
  table-layout: fixed;
}

.quote-selected-table th,
.quote-selected-table td {
  padding: 7px 8px;
  font-size: 11px;
  vertical-align: middle;
}

.quote-selected-table th:nth-child(1),
.quote-selected-table td:nth-child(1) { width: 12%; }
.quote-selected-table th:nth-child(2),
.quote-selected-table td:nth-child(2) {
  width: 46%;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}
.quote-selected-table th:nth-child(3),
.quote-selected-table td:nth-child(3),
.quote-selected-table th:nth-child(4),
.quote-selected-table td:nth-child(4),
.quote-selected-table th:nth-child(5),
.quote-selected-table td:nth-child(5) {
  text-align: center;
}

.quote-folders {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.quote-folders details {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.quote-folders summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--primary);
  font-weight: 800;
}

.quote-folders .form-field {
  padding: 0 12px 12px;
  margin: 0;
}

.quote-line-total span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quote-delete {
  align-self: center;
}

.quote-row-action {
  text-align: center;
  vertical-align: middle !important;
}

.quote-row-action input[type="checkbox"] {
  display: none;
}

.quote-remove-row {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.quote-remove-row svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quote-remove-row:hover {
  background: #fee2e2;
  color: #7f1d1d;
}

.quote-print-header {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  margin-bottom: 6px;
  padding: 0;
  border-radius: 0;
  background: #000078;
  color: #ffffff;
  box-shadow: inset 0 0 0 999px #000078;
  overflow: hidden;
}

.print-page:has(.quote-print-header-formal) {
  font-family: "Arial Narrow", Arial, sans-serif;
}

.quote-print-header-legacy {
  display: none !important;
}

.quote-print-header-formal {
  min-height: 86px;
  border: 1px solid #d6dde8;
}

.quote-header-company {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 39%;
  padding: 8px 12px;
}

.quote-header-company img {
  width: 128px;
  height: 70px;
  object-fit: contain;
  flex-shrink: 0;
}

.quote-header-company strong,
.quote-header-company span {
  display: block;
  color: #ffffff;
}

.quote-header-company strong {
  margin-bottom: 2px;
  font-size: 14px;
  line-height: 1.05;
}

.quote-header-company span {
  font-size: 9px;
  line-height: 1.28;
}

.quote-header-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 8px 12px;
}

.quote-header-title h1 {
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.quote-header-title p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, .82);
  font-size: 11px;
  font-style: italic;
  font-weight: 800;
}

.quote-header-number {
  display: grid;
  grid-template-columns: auto 120px;
  align-self: start;
  align-items: center;
  margin: 18px 12px 0 0;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 0;
}

.quote-header-number span {
  padding: 0 10px;
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
}

.quote-header-number strong {
  display: grid;
  place-items: center;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, .7);
  color: #ffde00;
  font-size: 28px;
  font-weight: 900;
}

.quote-section-band {
  margin: 0 0 7px;
  padding: 4px 10px;
  background: #000078;
  color: #ffde00;
  box-shadow: inset 0 0 0 999px #000078;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.quote-print-header .eyebrow {
  color: #ffde00;
  letter-spacing: .04em;
}

.quote-print-header p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, .86);
}

.quote-print-header h1 {
  margin: 0;
  font-size: 30px;
  color: #ffffff;
}

.quote-print-status {
  position: absolute;
  right: 0;
  bottom: 3px;
  min-width: 120px;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .12);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.quote-print-items td:nth-child(2) {
  width: 45%;
}

.quote-print-items {
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
  border: 1.5px solid #94a3b8;
  border-radius: var(--radius-sm);
}

.quote-print-items th,
.quote-print-items td {
  border-right: 1px solid #d6dde8 !important;
  border-bottom: 1px solid #d6dde8 !important;
}

.quote-print-items th:last-child,
.quote-print-items td:last-child {
  border-right: 0 !important;
}

.quote-print-items tbody tr:last-child td {
  border-bottom: 0 !important;
}

.quote-print-items th {
  border-color: #000078;
  background: #000078 !important;
  color: #ffffff !important;
  box-shadow: inset 0 0 0 999px #000078;
}

.quote-print-items th:first-child {
  border-top-left-radius: 9px;
}

.quote-print-items th:last-child {
  border-top-right-radius: 9px;
}

.quote-print-totals {
  display: grid;
  justify-content: end;
  gap: 4px;
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid #d6dde8;
}

.quote-print-totals div {
  display: grid;
  grid-template-columns: 100px 150px;
  gap: 12px;
  text-align: right;
}

.quote-total-letters {
  margin-top: 10px;
  font-weight: 800;
  text-align: left;
}

.quote-conditions-list {
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.quote-conditions-list div {
  padding: 6px 0;
  border-bottom: 1px solid #d6dde8;
  line-height: 1.35;
}

.quote-conditions-list div:last-child {
  border-bottom: 0;
}

.quote-signatures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 42px;
  margin: 72px 20px 0;
  align-items: end;
}

.quote-signatures div {
  min-height: 96px;
  padding-top: 46px;
  border-top: 1px solid #111827;
  text-align: center;
}

.quote-signatures span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.quote-signatures strong {
  display: block;
  margin-top: 4px;
  min-height: 16px;
  color: #111827;
}

@media print {
  .quote-print-status {
    display: none !important;
  }

  .quote-print-header {
    border-radius: 0;
  }

  .quote-print-items th {
    background: #000078 !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 999px #000078 !important;
  }

  .quote-print-items th,
  .quote-print-items td {
    border-right: 1px solid #d6dde8 !important;
    border-bottom: 1px solid #d6dde8 !important;
  }

  .quote-signatures {
    margin-top: 82px;
  }

  .quote-signatures div {
    min-height: 108px;
    padding-top: 54px;
  }
}

@media (max-width: 900px) {
  .comercial-totals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-grid.comercial-module-grid {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
  }

  .comercial-live-filter {
    grid-template-columns: 1fr 1fr;
  }

  .comercial-live-filter input[name="q"] {
    grid-column: 1 / -1;
  }

  .comercial-live-filter .btn {
    grid-column: 1 / -1;
  }

  .quote-release-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .acta-money-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .acta-billing-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-signatures {
    gap: 18px;
    margin-left: 0;
    margin-right: 0;
  }
}

@media (max-width: 620px) {
  .comercial-totals-grid,
  .comercial-form .form-grid.two-cols {
    grid-template-columns: 1fr;
  }

  .comercial-live-filter {
    grid-template-columns: 1fr;
  }

  .quote-release-summary {
    grid-template-columns: 1fr;
  }

  .acta-billing-summary,
  .acta-money-summary {
    grid-template-columns: 1fr;
  }
}


