/* Registers use the same panel, metrics, search, table and dialog language as Clients. */
#suppliers-view,#purchase-orders-view,#purchases-view { container-type:inline-size; }
.purchase-register .panel-head { gap:16px; flex-wrap:wrap; }
.purchase-register .panel-head>div:first-child { flex:1 1 260px; min-width:0; }
.purchase-register .panel-head>button { flex-shrink:0; white-space:nowrap; }
.purchase-register .customer-bi { grid-template-columns:repeat(4,minmax(0,1fr)); }
.purchase-register .customer-toolbar { flex-wrap:wrap; }
.purchase-register .customer-toolbar .search { min-width:0; flex:1 1 260px; }
.purchase-register .customer-filter-tabs { flex-wrap:wrap; }
.purchase-filter { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); }
.purchase-filter select { width:auto; min-width:175px; }
.purchase-table { width:100%; min-width:0; table-layout:fixed; }
.purchase-table th,.purchase-table td { overflow-wrap:anywhere; vertical-align:middle; font-size:13px; }
.purchase-table td .muted { font-size:12px; }
.purchase-table th:first-child { width:25%; }
.purchase-table .purchase-money { white-space:nowrap; }
.purchase-table th:last-child,.purchase-actions-cell { width:92px; }
.purchase-actions-cell .row-actions { display:flex; justify-content:flex-end; gap:6px; }
.planning-table { min-width:940px; table-layout:auto; }
.planning-table th:first-child { width:auto; }
.planning-table th:nth-child(2) { min-width:160px; }
.planning-table th:last-child,.planning-table .purchase-actions-cell { width:44px; }
.planning-table .buy-check-column { width:32px; padding-inline:10px; }
.buy-check-column input { width:16px; height:16px; min-height:0; margin:0; accent-color:var(--primary); }
.purchase-selection-footer { display:flex; flex-wrap:wrap; align-items:center; gap:16px; border-top:1px solid var(--line); margin-top:16px; padding-top:16px; }
.purchase-selection-footer #buy-total { flex:1 1 220px; font-size:13px; color:var(--muted); }
.purchase-selection-footer label { display:grid; gap:5px; font-size:12px; color:var(--muted); }
.purchase-selection-footer input { width:190px; }
.purchase-selection-footer .buy-feedback { flex-basis:100%; margin:0; }
.purchase-dialog .dialog-card { padding:24px; }
.purchase-wide-dialog { width:min(1000px,calc(100vw - 32px)); }
.purchase-dialog .panel-head { align-items:flex-start; gap:16px; margin-bottom:22px; }
.purchase-dialog .panel-head h2 { overflow-wrap:anywhere; }
.purchase-dialog .form { display:grid; gap:20px; }
.purchase-form-group { border:1px solid var(--line); border-radius:8px; padding:16px; margin:0; min-width:0; }
.purchase-form-group legend { padding:0 6px; font-size:13px; font-weight:700; color:var(--primary-dark); }
.purchase-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.purchase-dialog label { display:grid; gap:6px; min-width:0; font-size:13px; color:var(--muted); }
.purchase-dialog input,.purchase-dialog select,.purchase-dialog textarea { width:100%; box-sizing:border-box; min-width:0; }
.purchase-dialog textarea { min-height:80px; resize:vertical; }
.purchase-span-full { grid-column:1/-1; }
.purchase-dialog-footer { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:10px; padding-top:16px; border-top:1px solid var(--line); }
.purchase-dialog-footer .wf-feedback { flex:1 1 200px; margin:0; font-size:13px; }
.wf-feedback:not(:empty) { color:var(--danger); }
.purchase-order-total { text-align:right; font-weight:700; padding:14px; border-radius:8px; background:var(--soft-blue); }
.purchase-detail-summary { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; padding:16px; background:var(--soft-blue); border-radius:8px; margin-bottom:20px; }
.purchase-detail-summary>div { display:grid; gap:6px; min-width:0; overflow-wrap:anywhere; }
.purchase-detail-summary span { font-size:12px; color:var(--muted); }
.purchase-detail-summary strong { font-size:14px; }
.purchase-detail-summary .tag { width:fit-content; }
.purchase-detail-totals { grid-template-columns:repeat(3,minmax(0,1fr)); margin:16px 0; }
.purchase-detail-fields { display:grid; grid-template-columns:170px minmax(0,1fr); gap:12px; font-size:13px; margin:20px 0; }
.purchase-detail-fields dt { color:var(--muted); }
.purchase-detail-fields dd { margin:0; overflow-wrap:anywhere; }
.purchase-history { display:grid; gap:12px; padding-top:12px; }
.purchase-history article { border-left:3px solid var(--primary); padding:4px 12px; }
.purchase-history small { display:block; color:var(--muted); margin-top:4px; }
.purchase-history p { margin:8px 0 0; font-size:13px; }
.purchase-detail-section { margin:20px 0; }
.purchase-detail-section h3 { font-size:14px; margin-bottom:12px; }
.purchase-detail-section p { font-size:13px; line-height:1.65; }
.purchase-receipts,.wf-action-form { margin-top:20px; }
.wf-action-form { display:grid; gap:16px; }
.purchase-pdf-link { text-decoration:none; display:inline-flex; padding:10px 16px; border-radius:8px; }
#buy-settings-modal .panel { padding:0; box-shadow:none; border:0; margin-bottom:24px; }
#buy-settings-modal .buy-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
#buy-detail-modal .customer-bi { grid-template-columns:repeat(2,minmax(0,1fr)); }
@container(max-width:850px) {
 .purchase-register .customer-bi { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .supplier-table th:nth-child(3),.supplier-table td:nth-child(3),.supplier-table th:nth-child(4),.supplier-table td:nth-child(4),.order-table th:nth-child(3),.order-table td:nth-child(3) { display:none; }
 .purchase-register .customer-row-details { display:block; }
 .purchase-table:not(.planning-table) th:first-child { width:32%; }
}
@container(max-width:520px) {
 .purchase-register .customer-toolbar { flex-direction:column; align-items:stretch; }
 .purchase-register .customer-toolbar .search { flex-basis:auto; max-width:none; }
 .purchase-register .customer-bi article { padding:12px; }
 .purchase-register .customer-bi span { font-size:10px; }
 .purchase-register .customer-bi small { display:none; }
 .purchase-filter { justify-content:space-between; }
 .purchase-filter select { flex:1; }
 .supplier-table th:nth-child(2),.supplier-table td:nth-child(2),.order-table th:nth-child(4),.order-table td:nth-child(4) { display:none; }
 .purchase-table:not(.planning-table) th:first-child { width:36%; }
 .purchase-table:not(.planning-table) th:last-child,.purchase-table:not(.planning-table) .purchase-actions-cell { width:44px; }
 .purchase-actions-cell .row-actions { flex-wrap:wrap; }
 .purchase-selection-footer label,.purchase-selection-footer input,.purchase-selection-footer button { width:100%; }
}
@media(max-width:680px) {
 .purchase-dialog .dialog-card { padding:18px; }
 .purchase-form-grid { grid-template-columns:1fr; }
 .wf-lines-table { min-width:680px; }
 .purchase-detail-fields { grid-template-columns:1fr; gap:6px; }
 .purchase-detail-fields dd { margin-bottom:8px; }
 .purchase-dialog-footer { gap:8px; }
 .purchase-dialog-footer .wf-feedback { flex-basis:100%; }
 #buy-settings-modal .buy-fields { grid-template-columns:1fr; }
}

.purchase-static-field { display:grid; gap:6px; align-content:start; padding:10px 0; color:var(--muted); font-size:13px; }
.purchase-static-field strong { color:var(--text); font-size:14px; }

.purchase-step-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; padding-bottom:16px; border-bottom:1px solid var(--line); }
.purchase-step-tabs button { min-height:44px; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--muted); font-size:13px; font-weight:700; }
.purchase-step-tabs button[aria-selected="true"] { background:var(--soft-blue); border-color:var(--primary); color:var(--primary-dark); }
.wf-order-pane[hidden] { display:none !important; }
.purchase-supplier-summary { display:grid; grid-column:1/-1; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; padding:16px; border-radius:8px; background:var(--soft-blue); }
.purchase-supplier-summary > div { display:grid; gap:5px; min-width:0; overflow-wrap:anywhere; }
.purchase-supplier-summary span,.purchase-transaction-summary span { font-size:12px; color:var(--muted); }
.purchase-supplier-summary strong { font-size:13px; }
.purchase-transaction-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; align-items:end; }
.purchase-transaction-summary > div { display:grid; gap:6px; }
.purchase-grand-total { grid-column:span 2; border-radius:8px; padding:12px; background:var(--soft-blue); }
.purchase-grand-total strong { font-size:20px; }
.wf-lines-table { min-width:720px; }
.wf-lines-table tbody { display:table-row-group; }
.wf-lines-table tr.wf-line { display:table-row; }
.wf-lines-table td { padding:8px; }
.wf-lines-table input,.wf-lines-table select { width:100%; min-width:0; box-sizing:border-box; }
.wf-lines-table th:last-child { width:54px; }
.wf-lines-table .wf-line-total { font-weight:700; white-space:nowrap; }
.wf-installment-table { min-width:420px; }
.wf-installment-table input { width:100%; box-sizing:border-box; }
.wf-installment-table th:first-child,.wf-installment-table td:first-child { width:80px; }
.purchase-balance-note { margin:12px 0 0; padding:10px 12px; border-radius:8px; background:#fff3de; color:#855c18; font-size:13px; }
.purchase-balance-note.is-balanced { background:#edf8f0; color:#327244; }
.purchase-step-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.purchase-wizard-footer { position:sticky; bottom:0; z-index:2; background:var(--surface); }
@media(max-width:640px) { .purchase-step-tabs button { padding:9px 5px; font-size:11px; } .purchase-supplier-summary { grid-template-columns:1fr; } .purchase-transaction-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } .purchase-grand-total { grid-column:span 2; } .purchase-step-actions { width:100%; } .purchase-step-actions button { flex:1; } }
