.shell.wide { width: min(1580px, calc(100% - 32px)); }
.summary-grid.four { grid-template-columns: 1.2fr repeat(4, 1fr); }
.heading-actions { display: flex; gap: 10px; }
.table-wrap { overflow-x: hidden; }
.review-table { width: 100%; min-width: 0; table-layout: fixed; }
.review-table th, .review-table td { padding: 12px 9px; overflow-wrap: anywhere; }
.review-table th:nth-child(1) { width: 42px; }
.review-table th:nth-child(2) { width: 18%; }
.review-table th:nth-child(3) { width: 25%; }
.review-table th:nth-child(4) { width: 12%; }
.review-table th:nth-child(5) { width: 13%; }
.review-table th:nth-child(6) { width: 12%; }
.review-table th:nth-child(7) { width: 13%; }
.review-table th:nth-child(8) { width: 10%; }
.review-table td { min-width: 0; vertical-align: top; }
.review-table td strong { display: block; }
.review-table td small { max-width: 100%; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.invoice-line-entry { margin-bottom: 9px; }
.invoice-line-entry textarea, .invoice-line-entry small { display: block; }
.invoice-line-entry small { margin-top: 2px; }
.invoice-line-description { width: 100%; min-height: 68px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: inherit; line-height: 1.4; resize: vertical; }
.invoice-line-description:focus { border-color: var(--blue); outline: 3px solid rgba(34, 105, 184, .13); }
.invoice-line-description:disabled { background: #f2f4f7; color: var(--muted); }
.invoice-reference { padding-top: 4px; border-top: 1px solid var(--line); }
.invoice-amount { min-width: 0; }
.invoice-amount .paid-amount { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.invoice-amount label { display: block; color: var(--ink); font-size: 12px; font-weight: 700; text-align: left; }
.invoice-amount input { width: 100%; min-width: 0; margin-top: 4px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: inherit; text-align: right; }
.invoice-amount input:focus { border-color: var(--blue); outline: 3px solid rgba(34, 105, 184, .13); }
.invoice-amount input:disabled { background: #f2f4f7; color: var(--muted); }
.review-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 14px 15px; border: 1px solid #c9d8ea; border-radius: 9px; background: #f5f9ff; }
.review-actions p { margin: 0; color: var(--muted); }
.settlement-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 10px; margin-bottom: 18px; }
.settlement-item { padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; background: #fafbfd; }
.settlement-item span, .settlement-item small { display: block; color: var(--muted); }
.settlement-item strong { display: block; margin: 3px 0 1px; font-size: 20px; }
.confirm-row { display: flex; align-items: flex-start; gap: 11px; padding: 15px; border: 1px solid #c9d8ea; border-radius: 9px; background: #f5f9ff; cursor: pointer; }
.confirm-row input { flex: 0 0 auto; margin-top: 2px; }
.batch-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 17px; }
.batch-actions p { margin: 0; color: var(--muted); }
.result-download { display: block; margin-top: 5px; }
.status.existing { color: #4f5f78; background: #edf0f5; }
.status.created { color: var(--green); background: var(--green-soft); }
.status.failed { color: var(--red); background: var(--red-soft); }

@media (max-width: 1040px) {
  .summary-grid.four { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { overflow: visible; border: 0; }
  .review-table, .review-table thead, .review-table tbody { display: block; width: 100%; }
  .review-table thead tr { display: flex; align-items: center; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #f8f9fb; }
  .review-table thead th { display: none; }
  .review-table thead th.check { display: flex; align-items: center; width: 100%; padding: 0; text-align: left; }
  .review-table thead th.check::after { content: 'Select all new invoices'; margin-left: 9px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  .review-table tbody { margin-top: 10px; }
  .review-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
  .review-table tbody td { display: block; width: auto !important; padding: 11px 13px; border-bottom: 1px solid var(--line); }
  .review-table tbody td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
  .review-table tbody td.check { grid-column: 1 / -1; }
  .review-table tbody td:nth-last-child(-n + 2) { border-bottom: 0; }
}

@media (max-width: 640px) {
  .shell.wide { width: min(100% - 20px, 1580px); }
  .summary-grid.four { grid-template-columns: 1fr; }
  .review-table tbody tr { grid-template-columns: minmax(0, 1fr); }
  .review-table tbody td:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  .heading-actions, .batch-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .review-actions { align-items: stretch; flex-direction: column; }
  .heading-actions .button, .batch-actions .button { width: 100%; }
}
