/* Cobranza extends the existing Ventas forms, palette and buttons. */
body.app-ventas .ventas-collections {
  --collections-ink: #173d33;
  --collections-muted: #516b62;
  --collections-line: #d6e4dd;
  color: var(--collections-ink);
  min-width: 0;
}

body.app-ventas .collections-heading h3 { margin: 0; font-size: 20px; }
body.app-ventas .collections-heading p { margin: 8px 0 0; color: #365d50; line-height: 1.5; }
body.app-ventas .collections-hint { margin: 12px 0; color: #516b62; font-size: 14px; line-height: 1.55; }
body.app-ventas .collections-toolbar { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 20px 0 12px; }
body.app-ventas .collections-toolbar label { display: grid; gap: 7px; color: #173d33; font-size: 14px; font-weight: 700; }
body.app-ventas .collections-toolbar select { min-height: 44px; width: min(100%, 330px); padding: 10px 12px; border: 1px solid #c6d9d0; border-radius: 10px; color: #173d33; background: #fff; font: inherit; font-size: 16px; }
body.app-ventas .collections-toolbar > span { color: #516b62; font-size: 14px; }
body.app-ventas .collections-table-wrap { width: 100%; overflow-x: auto; }
body.app-ventas .collections-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
body.app-ventas .collections-table th { padding: 12px 10px; color: #365d50; background: #f1f7f3; border-bottom: 1px solid #d6e4dd; font-size: 13px; font-weight: 700; }
body.app-ventas .collections-table td { padding: 14px 10px; border-bottom: 1px solid #d6e4dd; vertical-align: top; overflow-wrap: anywhere; }
body.app-ventas .collections-table td > strong,
body.app-ventas .collections-table td > span,
body.app-ventas .collections-table td > small { display: block; }
body.app-ventas .collections-table td > span + small,
body.app-ventas .collections-table td > strong + span { margin-top: 5px; }
body.app-ventas .collections-table td > small { color: #516b62; font-size: 12px; }
body.app-ventas .collections-money { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
body.app-ventas .collections-table .collections-status { display: inline-block; padding: 4px 7px; border-radius: 6px; background: #edf2ef; color: #51635c; font-size: 12px; font-weight: 700; }
body.app-ventas .collections-table .collections-status.is-current { background: #e8f4ed; color: #1f6242; }
body.app-ventas .collections-table .collections-status.is-overdue { background: #fff0e4; color: #87400d; }
body.app-ventas .collections-table .collections-attention { color: #87400d; }
body.app-ventas .collections-row-actions { display: flex; align-items: start; flex-wrap: wrap; gap: 7px; }
body.app-ventas .collections-row-actions button { min-height: 44px; font-size: 16px; }
body.app-ventas .collections-empty { padding: 28px 14px; text-align: center; color: #365d50; }
body.app-ventas .collections-empty p { margin: 7px auto 0; max-width: 55ch; color: #516b62; line-height: 1.5; }
body.app-ventas .collections-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body.app-ventas .collections-dialog {
  box-sizing: border-box;
  width: min(760px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: #173d33;
  background: #f8fcfa;
  box-shadow: 0 24px 70px rgb(0 0 0 / 25%);
}
body.app-ventas .collections-dialog::backdrop { background: rgb(10 28 24 / 58%); }
body.app-ventas .collections-dialog .collections-form { display: flex; flex-direction: column; gap: 0; padding: 0; min-width: 0; width: 100%; max-height: calc(100dvh - 24px); }
body.app-ventas .collections-dialog .modal-header { margin: 0; padding: 18px 22px; background: #edf5f0; border-bottom: 1px solid #d6e4dd; align-items: center; }
body.app-ventas .collections-dialog .modal-header h2 { color: #173d33; margin: 0; font-size: 22px; }
body.app-ventas .collections-dialog .collections-dialog-content { padding: 20px 22px; min-width: 0; }
body.app-ventas .collections-sale-summary { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 20px; font-size: 15px; line-height: 1.5; }
body.app-ventas .collections-sale-summary b { font-variant-numeric: tabular-nums; }
body.app-ventas .collections-dialog .collections-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; }
body.app-ventas .collections-dialog .collections-form-grid label { display: grid; align-content: start; gap: 7px; font-size: 14px; font-weight: 700; color: #173d33; min-width: 0; }
body.app-ventas .collections-dialog .collections-note { grid-column: 1 / -1; }
body.app-ventas .collections-dialog input,
body.app-ventas .collections-dialog select,
body.app-ventas .collections-dialog textarea,
body.app-ventas .collections-credit-field input { width: 100%; min-height: 44px; box-sizing: border-box; padding: 10px 12px; border: 1px solid #c6d9d0; border-radius: 10px; background: #fff; color: #173d33; font: inherit; font-size: 16px; caret-color: #0b6953; }
body.app-ventas .collections-dialog textarea { resize: vertical; min-height: 100px; }
body.app-ventas .collections-dialog textarea::placeholder { color: #5b7268; }
body.app-ventas .collections-dialog [aria-invalid="true"] { border-color: #b12d25; }
body.app-ventas .collections-field-error { color: #a12b24; line-height: 1.45; font-size: 13px; font-weight: 600; }
body.app-ventas .collections-dialog-error { padding: 12px 16px; margin: 0 22px 16px; border: 1px solid #e3b4ac; border-radius: 10px; background: #fff1ed; color: #8b2c22; line-height: 1.5; font-size: 14px; }
body.app-ventas .collections-dialog .modal-actions { position: sticky; bottom: 0; flex-shrink: 0; justify-content: flex-end; margin: 0; padding: 14px 22px; border-top: 1px solid #d6e4dd; background: #f8fcfa; }
body.app-ventas .collections-dialog button { min-height: 44px; font-size: 16px; }
body.app-ventas .collections-dialog button:disabled { opacity: .55; cursor: wait; }
body.app-ventas .collections-history-section { margin-top: 24px; border-top: 1px solid #d6e4dd; padding-top: 16px; }
body.app-ventas .collections-history-section summary { cursor: pointer; min-height: 44px; align-content: center; color: #214e3e; font-weight: 700; font-size: 16px; }
body.app-ventas .collections-history { list-style: none; padding: 0; margin: 8px 0 0; }
body.app-ventas .collections-history li { border-bottom: 1px solid #d6e4dd; padding: 14px 0; }
body.app-ventas .collections-event-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; }
body.app-ventas .collections-event-head span { color: #516b62; font-size: 13px; }
body.app-ventas .collections-history dl { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 12px 0 0; font-size: 13px; }
body.app-ventas .collections-history dt { color: #516b62; }
body.app-ventas .collections-history dd { margin: 4px 0 0; color: #173d33; }
body.app-ventas .collections-history li > p { margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; color: #365d50; font-size: 14px; }
body.app-ventas .collections-credit-field { display: grid; gap: 7px; margin-top: 16px; font-size: 14px; }
body.app-ventas .collections-credit-field .field-help { color: #516b62; font-size: 13px; font-weight: 400; line-height: 1.45; }
body.app-ventas .ventas-collections :focus-visible,
body.app-ventas .collections-dialog :focus-visible,
body.app-ventas .collections-credit-field :focus-visible { outline: 3px solid #0d725b; outline-offset: 3px; }
body.app-ventas .collections-dialog ::selection,
body.app-ventas .ventas-collections ::selection { background: #cce8d9; color: #173d33; }
body.app-ventas .ventas-collections [hidden],
body.app-ventas .collections-dialog [hidden],
body.app-ventas .collections-credit-field[hidden] { display: none !important; }

@media (max-width: 760px) {
  body.app-ventas .collections-table thead { display: none; }
  body.app-ventas .collections-table,
  body.app-ventas .collections-table tbody { display: block; }
  body.app-ventas .collections-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 0; border-bottom: 1px solid #d6e4dd; }
  body.app-ventas .collections-table td { display: block; padding: 0; border: 0; min-width: 0; }
  body.app-ventas .collections-table td::before { display: block; content: attr(data-label); margin-bottom: 5px; color: #516b62; font-size: 12px; font-weight: 600; }
  body.app-ventas .collections-table td:first-child,
  body.app-ventas .collections-table td:last-child { grid-column: 1 / -1; }
  body.app-ventas .collections-row-actions button { flex: 1; }
  body.app-ventas .collections-toolbar { align-items: stretch; }
  body.app-ventas .collections-toolbar label,
  body.app-ventas .collections-toolbar select { width: 100%; }
  body.app-ventas .collections-dialog .collections-form-grid { grid-template-columns: minmax(0, 1fr); }
  body.app-ventas .collections-dialog .modal-header,
  body.app-ventas .collections-dialog .collections-dialog-content { padding: 16px; }
  body.app-ventas .collections-dialog .modal-actions { padding: 12px 16px; }
  body.app-ventas .collections-dialog .modal-actions button { flex: 1 1 auto; }
  body.app-ventas .collections-dialog-error { margin-left: 16px; margin-right: 16px; }
  body.app-ventas .collections-dialog .modal-header h2 { font-size: 20px; }
}
