.erp-list-layout { min-width: 0; margin-bottom: 14px; border-radius: var(--erp-radius-lg); }

.erp-list-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--erp-space-3); margin-bottom: var(--erp-space-3); }
.erp-list-header h2, .erp-list-header p { margin: 0; }
.erp-list-header h2 { font-size: 18px; }
.erp-list-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.erp-list-count { flex: 0 0 auto; color: var(--muted); font-size: 13px; }

.erp-list-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: flex-end; gap: var(--erp-list-toolbar-gap); margin-bottom: var(--erp-space-3); }
.erp-list-section { display: grid; min-width: 0; gap: var(--erp-space-3); padding: var(--erp-space-4); border: var(--erp-border-width) var(--erp-border-style) var(--erp-border); border-radius: var(--erp-radius-lg); background: var(--erp-surface); box-shadow: var(--erp-shadow-xs); }
.erp-list-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--erp-space-3); }
.erp-list-section-header h3, .erp-list-section-header p { margin: 0; }
.erp-list-section-header h3 { font-size: 17px; }
.erp-list-section-header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.erp-list-section-meta { display: flex; flex: 0 0 auto; align-items: center; gap: var(--erp-space-2); }
.erp-list-section-content { display: grid; min-width: 0; max-height: 340px; overflow: auto; overscroll-behavior: contain; gap: var(--erp-list-gap); }
.erp-list-filters { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: flex-end; gap: var(--erp-space-2); min-width: 0; }
.erp-list-filter { display: grid; flex: 0 1 150px; min-width: 125px; gap: var(--erp-space-1); }
.erp-list-filter > span { color: var(--muted); font-size: 12px; }
.erp-list-filter input, .erp-list-filter select { width: 100%; min-width: 0; }
.erp-list-search { flex: 1 1 280px; min-width: 210px; }
.erp-list-actions { display: flex; flex: 0 0 auto; align-items: center; gap: var(--erp-space-2); }
.erp-list-actions .is-loading .tf-icon { animation: erp-list-spin .8s linear infinite; }

.erp-list-content { display: grid; min-width: 0; max-height: 300px; overflow: auto; overscroll-behavior: contain; gap: var(--erp-list-gap); }
.erp-list-layout.erp-list-layout--page-scroll .erp-list-content { max-height: none; overflow: visible; overscroll-behavior: auto; }
.erp-list-row { display: grid; grid-template-columns: var(--erp-list-columns, minmax(0, 1fr)); align-items: center; gap: var(--erp-space-3); width: 100%; min-width: 0; min-height: var(--erp-list-row-min-height); padding: var(--erp-space-3) var(--erp-space-4); border: var(--erp-border-width) var(--erp-border-style) var(--erp-border); border-radius: var(--erp-radius-md); color: var(--erp-text); background: var(--erp-surface); text-align: left; transition: border-color var(--erp-duration-fast) var(--erp-ease-standard), background-color var(--erp-duration-fast) var(--erp-ease-standard), box-shadow var(--erp-duration-fast) var(--erp-ease-standard); }
.erp-list-row:hover { border-color: var(--erp-border-strong); background: var(--erp-surface-hover); }
.erp-list-row:focus-visible { outline: none; box-shadow: var(--erp-shadow-focus); }
.erp-list-row.is-selected { border-color: var(--erp-primary); background: var(--erp-surface-selected); }
.erp-list-row > * { min-width: 0; }
.erp-list-cell { display: block; min-width: 0; }
.erp-list-cell strong, .erp-list-cell b, .erp-list-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-list-cell small { margin-top: 3px; color: var(--muted); }

.erp-list-status { display: inline-flex; align-items: center; gap: 5px; width: fit-content; min-height: 24px; margin-top: 4px; padding: 4px 8px; border-radius: var(--erp-radius-pill); color: var(--erp-text-secondary); background: var(--erp-surface-muted); font-size: var(--erp-font-size-xs); font-weight: var(--erp-font-weight-semibold); }
.erp-list-status--info { color: var(--erp-info); background: var(--erp-surface-info-subtle); }
.erp-list-status--success { color: var(--erp-success); background: var(--erp-surface-success-subtle); }
.erp-list-status--warning { color: var(--erp-warning); background: var(--erp-surface-warning-subtle); }
.erp-list-status--danger { color: var(--erp-danger); background: var(--erp-surface-danger-subtle); }
.erp-list-amount { justify-self: end; color: var(--erp-text); font-variant-numeric: tabular-nums; font-weight: var(--erp-font-weight-semibold); text-align: right; white-space: nowrap; }

.erp-list-loading, .erp-list-error { display: flex; align-items: center; gap: var(--erp-space-2); margin-bottom: var(--erp-space-2); padding: var(--erp-space-2) var(--erp-space-3); border-radius: var(--erp-radius-md); font-size: var(--erp-font-size-sm); }
.erp-list-loading { color: var(--erp-success); background: var(--erp-surface-success-subtle); }
.erp-list-error { color: var(--erp-danger); background: var(--erp-surface-danger-subtle); }
.erp-list-empty { display: grid; place-items: center; gap: 6px; min-height: 150px; padding: 28px 18px; border: 1px dashed var(--erp-border); border-radius: var(--erp-radius-md); color: var(--muted); background: var(--erp-surface-muted); text-align: center; }
.erp-list-empty strong { color: var(--text); }
.erp-list-empty-action { margin-top: 6px; }

.erp-list-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--erp-space-3); }
.erp-list-kpi { min-width: 0; padding: var(--erp-space-4); border: var(--erp-border-width) var(--erp-border-style) var(--erp-border); border-radius: var(--erp-radius-md); background: var(--erp-surface); box-shadow: var(--erp-shadow-xs); }
.erp-list-kpi span { display: block; color: var(--muted); font-size: 13px; }
.erp-list-kpi strong { display: block; margin-top: 5px; color: var(--erp-text); font-size: 28px; font-variant-numeric: tabular-nums; }
.erp-list-kpi--warning { border-left: 4px solid var(--erp-warning); }
.erp-list-kpi--success { border-left: 4px solid var(--erp-success); }
.erp-list-kpi--danger { border-left: 4px solid var(--erp-danger); }

.erp-list-tabs { display: flex; flex-wrap: wrap; gap: var(--erp-space-2); }
.erp-list-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--erp-control-height-md); padding: 8px 13px; border: var(--erp-border-width) var(--erp-border-style) var(--erp-border); border-radius: var(--erp-radius-md); color: var(--erp-text); background: var(--erp-surface); }
.erp-list-tabs button span { min-width: 22px; padding: 2px 6px; border-radius: var(--erp-radius-pill); color: var(--erp-text-muted); background: var(--erp-surface-muted); font-size: var(--erp-font-size-xs); font-variant-numeric: tabular-nums; }
.erp-list-tabs button.is-selected { border-color: var(--erp-primary); color: var(--erp-primary-active); background: var(--erp-surface-selected); font-weight: var(--erp-font-weight-semibold); }
.erp-list-tabs button:focus-visible { outline: none; box-shadow: var(--erp-shadow-focus); }

.erp-table-shell { width: 100%; max-width: 100%; overflow: auto; overscroll-behavior: contain; }

@keyframes erp-list-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .erp-list-row { transition: none; }
  .erp-list-actions .is-loading .tf-icon { animation: none; }
}

@media (max-width: 760px) {
  .erp-list-toolbar { display: flex; align-items: stretch; flex-direction: column; }
  .erp-list-filters { flex-wrap: wrap; }
  .erp-list-search { flex-basis: 100%; min-width: 100%; }
  .erp-list-filter { flex: 1 1 calc(33.333% - 6px); min-width: 120px; }
  .erp-list-actions { justify-content: flex-end; }
}

@media (max-width: 480px) {
  .erp-list-header { align-items: flex-start; }
  .erp-list-section { padding: 12px; }
  .erp-list-section-header { align-items: flex-start; flex-direction: column; }
  .erp-list-section-meta { width: 100%; justify-content: space-between; }
  .erp-list-section-content { max-height: none; overflow: visible; }
  .erp-list-filters { display: grid; grid-template-columns: 1fr; }
  .erp-list-filter, .erp-list-search { min-width: 0; }
  .erp-list-actions { display: grid; grid-template-columns: repeat(2, 44px); justify-content: end; }
  .erp-list-row { grid-template-columns: minmax(0, 1fr) auto; min-height: auto; gap: var(--erp-space-2) var(--erp-space-3); padding: var(--erp-space-3); }
  .erp-list-cell--primary { order: 1; }
  .erp-list-amount { order: 2; align-self: start; }
  .erp-list-cell--status { order: 3; grid-column: 1 / -1; }
  .erp-list-cell--detail { order: 4; grid-column: 1 / -1; }
  .erp-list-cell--company { order: 5; grid-column: 1 / -1; }
  .erp-list-cell--company b, .erp-list-cell--company small { display: inline; margin-right: 6px; }
  .erp-list-kpis { grid-template-columns: 1fr; }
  .erp-list-kpi { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
  .erp-list-kpi strong { margin-top: 0; font-size: 24px; }
  .erp-list-tabs { display: grid; grid-template-columns: 1fr; }
  .erp-list-tabs button { width: 100%; min-height: 44px; }

  .erp-table-shell.is-mobile-cards { overflow: visible; }
  .erp-table-shell.is-mobile-cards table { display: block; min-width: 0; }
  .erp-table-shell.is-mobile-cards thead { display: none; }
  .erp-table-shell.is-mobile-cards tbody { display: grid; gap: var(--erp-list-gap); }
  .erp-table-shell.is-mobile-cards tr { display: grid; gap: 7px; padding: var(--erp-space-3); border: var(--erp-border-width) var(--erp-border-style) var(--erp-border); border-radius: var(--erp-radius-md); background: var(--erp-surface); }
  .erp-table-shell.is-mobile-cards td { display: grid; grid-template-columns: minmax(86px, 105px) minmax(0, 1fr); align-items: start; gap: 8px; min-width: 0; padding: 0; border: 0; }
  .erp-table-shell.is-mobile-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 500; }
  .erp-table-shell.is-mobile-cards td[data-label=""] { display: block; }
  .erp-table-shell.is-mobile-cards td[data-label=""]::before { content: none; }
  .erp-table-shell.is-mobile-cards td button { min-height: 44px; }
}
