.caf-shell {
  width: 100%;
  min-width: 0;
}

.caf-recurring-supplier-trigger {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.caf-recurring-supplier-trigger img {
  width: 23px;
  height: 23px;
  display: block;
}

.caf-recurring-suppliers-backdrop {
  z-index: 10000 !important;
}

.caf-bergmann-import-backdrop {
  z-index: 10010 !important;
}

.caf-recurring-suppliers-modal {
  width: min(520px, calc(100vw - 32px));
  max-width: 520px;
}

.caf-recurring-suppliers-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.caf-recurring-suppliers-heading h3 {
  margin-bottom: 5px;
}

.caf-recurring-suppliers-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.caf-recurring-suppliers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.caf-recurring-supplier-option {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
}

.caf-bergmann-import-modal {
  width: min(680px, calc(100vw - 32px));
  max-width: 680px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.caf-bergmann-dropzone {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 20px;
  border: 2px dashed #9badc5;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--primary);
  text-align: center;
  cursor: pointer;
}

.caf-bergmann-dropzone span {
  color: #6b7280;
  font-size: 12px;
}

.caf-bergmann-dropzone:hover,
.caf-bergmann-dropzone:focus-visible,
.caf-bergmann-dropzone.is-dragging {
  border-color: var(--primary);
  background: #eef3ff;
  outline: none;
}

.caf-bergmann-preview {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fbfbfd;
}

.caf-bergmann-preview img {
  display: block;
  width: 100%;
  max-height: 330px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.caf-bergmann-preview .small-muted {
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.caf-bergmann-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

@media (max-width: 560px) {
  .caf-recurring-suppliers-grid {
    grid-template-columns: 1fr;
  }
}

.caf-subtitle {
  margin-top: 7px;
}

.caf-loading {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.caf-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 0 0 12px;
}

.caf-summary-grid .status-card {
  min-height: 86px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
}

.caf-summary-grid .status-card span {
  color: #6b7280;
  font-size: 12px;
}

.caf-summary-grid .status-card strong {
  color: var(--primary);
  font-size: 20px;
}

.caf-table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.caf-table-scroll > .table {
  margin-top: 0;
}

.caf-list-table {
  min-width: 1320px;
}

.caf-closing-table {
  min-width: 1120px;
}

.caf-compact-table {
  min-width: 680px;
}

.caf-list-table td,
.caf-closing-table td,
.caf-compact-table td {
  vertical-align: middle;
}

.caf-list-table tr.is-selected td,
.caf-closing-table tr.is-selected td {
  background: #eef3ff;
}

.caf-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.caf-row-actions .ghost-btn,
.caf-row-actions .danger-btn,
.caf-row-actions .icon-btn {
  min-height: 32px;
  padding: 6px 9px;
}

.caf-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: #6b7280;
  font-size: 12px;
}

.caf-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.caf-pagination select {
  width: auto;
  min-width: 72px;
}

.caf-items-table {
  min-width: 1180px;
}

.caf-items-table input,
.caf-items-table select {
  width: 100%;
  min-width: 76px;
}

.caf-items-table [data-caf-item-field="description"] {
  min-width: 260px;
}

.caf-document-totals,
.caf-closing-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.caf-document-totals > div,
.caf-closing-totals > div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfd;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.caf-document-totals span,
.caf-closing-totals span,
.caf-detail-grid span,
.caf-payable-preview span,
.caf-reconciliation-card span {
  color: #6b7280;
  font-size: 11px;
}

.caf-document-totals strong,
.caf-closing-totals strong {
  color: var(--primary);
}

.caf-upload.is-dragging {
  border-color: var(--primary);
  background: #eef3ff;
}

.caf-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
}

.caf-attachment-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfd;
}

.caf-attachment-chip .ghost-btn {
  min-height: 30px;
  padding: 5px 9px;
}

.caf-supplier-results {
  display: none;
  margin-top: 6px;
}

.caf-supplier-results:not(:empty) {
  display: block;
}

.caf-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.caf-detail-grid > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.caf-detail-grid strong {
  overflow-wrap: anywhere;
}

.caf-detail-wide {
  grid-column: 1 / -1;
}

.caf-closing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 12px;
  align-items: start;
}

.caf-flow-card {
  position: sticky;
  top: 12px;
}

.caf-flow-card ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.caf-flow-card li {
  color: #6b7280;
}

.caf-flow-card li strong,
.caf-flow-card li span {
  display: block;
}

.caf-flow-card li strong {
  color: var(--primary);
  margin-bottom: 4px;
}

.caf-flow-card li span {
  font-size: 12px;
  line-height: 1.45;
}

.caf-flow-card li.is-active::marker {
  color: var(--primary);
  font-weight: 900;
}

.caf-closing-footer-actions,
.caf-nfe-footer-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.caf-nfe-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 12px;
  align-items: stretch;
}

.caf-reconciliation-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.caf-reconciliation-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.caf-reconciliation-card > div:last-child {
  border-bottom: 0;
}

.caf-reconciliation-card strong {
  color: var(--primary);
  text-align: right;
}

.caf-divergence-fields {
  margin-top: 12px;
}

.caf-xml-preview {
  margin-top: 12px;
  box-shadow: none;
}

.caf-supplier-xml-import-section {
  border-color: #9bb7dc;
  background: linear-gradient(135deg, #f7faff 0%, #ffffff 100%);
}

.caf-supplier-file-import-section {
  border-color: #a8b8ca;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.caf-supplier-file-import-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.caf-supplier-file-import-layout p {
  margin: 0 0 12px;
  line-height: 1.5;
}

.caf-supplier-import-choice {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px dashed #a8b8ca;
  border-radius: 12px;
  background: #fff;
}

.caf-supplier-import-choice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.caf-supplier-xml-import-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 2.2fr);
  gap: 16px;
  align-items: start;
}

.caf-supplier-xml-import-layout p {
  margin: 0 0 12px;
  line-height: 1.5;
}

.caf-supplier-xml-result {
  min-height: 86px;
  padding: 14px;
  border: 1px dashed #9bb7dc;
  border-radius: 12px;
  background: #fff;
}

.caf-supplier-xml-fields {
  margin-bottom: 12px;
}

.caf-supplier-xml-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.caf-supplier-xml-summary > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.caf-supplier-xml-summary span,
.caf-supplier-xml-summary small {
  color: var(--muted);
  font-size: 11px;
}

.caf-supplier-xml-summary strong {
  overflow-wrap: anywhere;
}

.caf-supplier-xml-success {
  margin-top: 12px;
  color: #067647;
  font-size: 12px;
  font-weight: 700;
}

.caf-front-feedback {
  position: fixed;
  inset: 0;
  z-index: 2147483647 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
}

.caf-front-feedback-card {
  width: min(440px, 94vw);
  padding: 28px;
  border: 1px solid #b7c5d8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.38);
  text-align: center;
}

.caf-front-feedback-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  background: #dcfae6;
  color: #067647;
  font-size: 34px;
  font-weight: 800;
}

.caf-front-feedback-error .caf-front-feedback-icon {
  background: #fee4e2;
  color: #b42318;
}

.caf-front-feedback-card h2 {
  margin: 0;
  color: #101828;
  font-size: 22px;
}

.caf-front-feedback-card p {
  margin: 10px 0 20px;
  color: #475467;
  line-height: 1.5;
}

.caf-front-feedback-card .primary-btn {
  min-width: 110px;
  justify-content: center;
}

html[data-theme="dark"] .caf-supplier-xml-import-section {
  border-color: #39577d;
  background: linear-gradient(135deg, #172234 0%, #151b26 100%);
}

html[data-theme="dark"] .caf-front-feedback-card {
  border-color: #344054;
  background: #151b26;
}

html[data-theme="dark"] .caf-front-feedback-card h2 {
  color: #f2f4f7;
}

html[data-theme="dark"] .caf-front-feedback-card p {
  color: #98a2b3;
}

html[data-theme="dark"] .caf-supplier-file-import-section {
  border-color: #42556b;
  background: linear-gradient(135deg, #19222e 0%, #151b26 100%);
}

html[data-theme="dark"] .caf-supplier-import-choice {
  border-color: #42556b;
  background: #111722;
}

html[data-theme="dark"] .caf-supplier-xml-result {
  border-color: #39577d;
  background: #111722;
}

.caf-payable-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.caf-payable-preview > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
}

.caf-payable-preview > div:last-child {
  border-right: 0;
}

.caf-payable-preview strong {
  color: var(--primary);
  overflow-wrap: anywhere;
}

.caf-justification-modal {
  width: min(520px, 94vw);
}

.caf-justification-modal textarea {
  width: 100%;
}

html[data-theme="dark"] .caf-list-table tr.is-selected td,
html[data-theme="dark"] .caf-closing-table tr.is-selected td,
html[data-theme="dark"] .caf-document-totals > div,
html[data-theme="dark"] .caf-closing-totals > div,
html[data-theme="dark"] .caf-attachment-chip {
  background: #151b26;
}

@media (max-width: 1100px) {
  .caf-closing-layout,
  .caf-nfe-grid {
    grid-template-columns: 1fr;
  }

  .caf-flow-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .caf-supplier-file-import-layout,
  .caf-supplier-xml-import-layout {
    grid-template-columns: 1fr;
  }

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

  .caf-pagination,
  .caf-pagination-controls,
  .caf-closing-footer-actions,
  .caf-nfe-footer-actions {
    align-items: stretch;
  }

  .caf-pagination-controls,
  .caf-closing-footer-actions,
  .caf-nfe-footer-actions {
    width: 100%;
    flex-direction: column;
  }

  .caf-pagination-controls button,
  .caf-closing-footer-actions button,
  .caf-nfe-footer-actions button {
    width: 100%;
    justify-content: center;
  }

  .caf-payable-preview {
    grid-template-columns: 1fr;
  }

  .caf-payable-preview > div {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .caf-payable-preview > div:last-child {
    border-bottom: 0;
  }
}
