.commercial-form { padding: clamp(1rem, 2.5vw, 2rem); margin-bottom: 1rem; }
.commercial-form > * + * { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.intro.actions > :first-child { margin-right: auto; }
.inline { display: inline; margin-left: .6rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; align-items: start; }
.commercial-form label { display: block; font-weight: 650; margin-bottom: .25rem; }
.commercial-form textarea { display: block; width: 100%; min-height: 76px; margin-top: .25rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--text); background: var(--surface); }
.commercial-form input[type=checkbox] { width: 1.1rem; min-height: 0; accent-color: var(--pemi-orange); }
.commercial-form fieldset { min-width: 0; margin: .65rem 0; padding: .85rem; border: 1px solid var(--line); border-radius: 8px; }
.commercial-form legend { padding-inline: .45rem; font-weight: 700; }
.commercial-form fieldset button { margin-top: .65rem; }
.commercial-form .errorlist { padding: .55rem 1.5rem; border-left: 4px solid var(--pemi-orange); background: var(--surface-raised); }
.marked-delete { text-decoration: line-through; }
.login-form { max-width: 36rem; }
.totals { padding: .8rem 1.2rem; font-weight: 650; border-top: 2px solid var(--pemi-orange); text-align: right; }
.totals p strong { display: inline-block; min-width: 8rem; }
@media (max-width: 600px) { .totals { text-align: left; } }

.commercial-form .form-section { padding: .6rem .85rem .85rem; }
.form-section .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem 1rem; }
.field { min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-help { display: block; margin: .25rem 0; color: var(--muted); font-size: .88rem; }
.commercial-form .field .errorlist { margin: .25rem 0 0; padding: .25rem .55rem; list-style: none; font-size: .85rem; }
.field-invalid [aria-invalid="true"] { border-color: var(--pemi-orange); }
.quote-table-wrap { margin-top: .6rem; border: 1px solid var(--line); border-radius: 8px; }
.quote-table th, .quote-table td { padding: .45rem .5rem; vertical-align: top; }
.quote-table th { white-space: nowrap; }
.quote-table .designation-cell { width: 34%; min-width: 12rem; }
.quote-table td:not(.designation-cell) input:not([type=checkbox]) { min-width: 4.5rem; padding: .35rem; }
.quote-table input { min-height: 38px; }
.quote-table .field > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.quote-table details .field > label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
.quote-table details { margin: .35rem 0; font-size: .88rem; }
.quote-table details .field { margin-top: .4rem; }
.quote-table summary { cursor: pointer; }
.line-total, .quote-table th:nth-last-child(2) { text-align: right; }
.line-total span { display: block; padding-top: .45rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.line-remove, .quote-table th:last-child { text-align: center; }
.line-remove input { margin-top: .65rem; }
.quote-table .marked-delete > :not(.line-remove) { text-decoration: line-through; background: var(--surface-raised); }
.quote-table-footer { justify-content: space-between; margin-top: .6rem; }
.quote-table-footer .totals { padding: .5rem 0; }

@media (max-width: 1100px) {
  .form-section .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-table { min-width: 52rem; }
}
@media (max-width: 600px) {
  .form-section .field-grid { grid-template-columns: 1fr; }
  .quote-table { min-width: 0; }
  .quote-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; }
  .quote-table td, .quote-table td:last-child { display: block; text-align: left; }
  .quote-table td::before { display: block; margin-bottom: .2rem; }
  .quote-table .designation-cell { grid-column: 1 / -1; width: auto; min-width: 0; }
}

.invoice-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; }
.invoice-summary dd { margin-top: .2rem; font-size: 1.12rem; font-weight: 700; }
.invoice-due { border-left: 3px solid var(--pemi-orange); padding-left: .65rem; }
.invoice-status { display: inline-block; padding: .2rem .55rem; border-radius: 6px; background: var(--surface-raised); font-size: .88rem; font-weight: 650; }
.invoice-status-draft { border-left: 3px solid var(--pemi-orange); }
.invoice-main-actions { border-top: 1px solid var(--line); padding-top: 1rem; }
.invoice-section-heading, .invoice-payments li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.invoice-payments { list-style: none; padding: 0; }
.invoice-payments li { padding: .6rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.invoice-secondary summary { cursor: pointer; font-weight: 700; }
.invoice-secondary { margin-top: 1rem; }
.invoice-step { max-width: 46rem; }
.invoice-list td:nth-child(4), .invoice-list td:last-child, .invoice-due dd { font-variant-numeric: tabular-nums; }

@media (max-width: 950px) { .invoice-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .invoice-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-summary > :first-child, .invoice-due { grid-column: 1 / -1; }
  .invoice-main-actions > .primary, .invoice-step .actions > * { width: 100%; text-align: center; }
}

.bank-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 1rem; align-items: start; }
.bank-workspace h2, .bank-candidate, .bank-allocations li { overflow-wrap: anywhere; }
.bank-workspace summary { cursor: pointer; font-weight: 650; }
.bank-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bank-totals dd { margin-top: .15rem; }
.bank-subform { display: grid; gap: .4rem; margin-top: .6rem; justify-items: start; }
.bank-subform label { width: 100%; }
.bank-allocations { list-style: none; padding: 0; }
.bank-allocations li { border-top: 1px solid var(--line); padding: .65rem 0; }
.bank-candidate { display: grid; grid-template-columns: minmax(0, 1fr) minmax(8rem, .5fr); gap: .65rem; border-top: 1px solid var(--line); padding: .75rem 0; }
.bank-candidate small, .bank-allocations small { display: block; }
.bank-candidate .bank-check { font-weight: 400; }
.bank-workspace form[method=get] input { flex: 1 1 12rem; width: auto; min-width: 0; }
@media (max-width: 850px) { .bank-workspace { grid-template-columns: 1fr; } }
@media (max-width: 460px) { .bank-candidate { grid-template-columns: 1fr; } }
.catalog-dialog { color: var(--text); background: var(--surface); width: min(46rem, calc(100vw - 1.5rem)); max-height: min(85dvh, 51rem); overflow: auto; }
.catalog-dialog::backdrop { background: rgb(0 0 0 / .7); }
.catalog-dialog > .actions { justify-content: space-between; }
.catalog-results { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.catalog-results button { width: 100%; text-align: left; white-space: normal; }
