/* Analysis owns compact composition; shared workspace tokens own its appearance. */
.profit-decision { min-width:0; color:var(--ink); font-size:14px; line-height:1.7; container-type:inline-size; container-name:profit-review; }
.profit-decision *, .profit-decision *::before, .profit-decision *::after { box-sizing:border-box; }
.pd-heading h2 { margin:0; color:var(--ink); font-size:var(--workspace-section-heading-size); font-weight:var(--workspace-heading-weight); line-height:var(--workspace-section-heading-leading); }
.pd-heading p { margin:5px 0 0; color:var(--muted); }
.profit-decision .pd-metrics { margin:16px 0 0; }
.pd-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; padding:16px 0; border-block:1px solid var(--line); }
.pd-metrics > div { min-width:0; padding-right:20px; border-right:1px solid var(--line); }
.pd-metrics > div:last-child { border-right:0; padding-right:0; }
.pd-metrics dt { color:var(--muted); font-size:14px; }
.pd-metrics dd { margin:6px 0 0; font-size:24px; line-height:1.4; font-weight:700; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.pd-negative { color:var(--loss); }
.pd-coverage { display:flex; flex-wrap:wrap; gap:4px 16px; margin:10px 0 14px; color:var(--muted); font-size:13px; }
.pd-coverage strong { color:var(--ink); font-weight:600; }
.pd-filters { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; margin:0 0 16px; }
.pd-filters > button { display:flex; align-items:center; justify-content:space-between; gap:6px; min-width:0; min-height:44px; padding:8px 10px; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--muted); font:inherit; font-size:13px; line-height:1.5; cursor:pointer; white-space:nowrap; }
.pd-filters > button > span { display:inline-flex; align-items:baseline; gap:3px; flex-shrink:0; font-weight:600; font-variant-numeric:tabular-nums; }
.pd-filters > button small { font-size:11px; font-weight:400; }
.pd-filters > button[aria-pressed=true] { border-color:var(--brand); background:var(--home-icon-wash); color:var(--brand-dark); }
.pd-records { min-width:0; padding-top:4px; }
.pd-section-heading { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px 12px; margin-bottom:12px; }
.pd-section-heading h3 { margin:0; color:var(--ink); font-size:var(--workspace-section-heading-size); font-weight:var(--workspace-heading-weight); line-height:var(--workspace-section-heading-leading); }
.pd-sort { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); min-width:0; }
.pd-sort select { width:auto; max-width:100%; min-width:0; min-height:44px; padding:8px 10px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:var(--panel); font-size:14px; cursor:pointer; }
.profit-decision .secondary-button, .profit-decision .primary-button { min-height:44px; padding:8px 12px; font-size:14px; line-height:1.5; white-space:normal; }
.pd-focused { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:4px 12px; margin-bottom:10px; border-bottom:1px solid var(--line); padding-bottom:8px; }
.pd-focused .text-button { min-height:44px; padding:4px 0; font-size:14px; }
.pd-table-scroll { min-width:0; max-width:100%; overflow-x:auto; scrollbar-gutter:stable; }
.pd-table { width:100%; min-width:660px; border-collapse:collapse; font-variant-numeric:tabular-nums; }
.pd-table th, .pd-table td { padding:12px 8px; border-bottom:1px solid var(--line); text-align:right; vertical-align:top; font-size:14px; line-height:1.6; }
.pd-table thead th { color:var(--muted); background:var(--panel-strong); font-weight:600; white-space:nowrap; }
.pd-table th:first-child { width:33%; text-align:left; }
.pd-table td:last-child { text-align:left; }
.pd-table tbody th { font-weight:400; overflow-wrap:anywhere; }
.pd-table tbody th strong { font-size:14px; font-weight:600; }
.pd-table tbody th span, .pd-table td small { display:block; margin-top:3px; font-size:12px; color:var(--muted); }
.pd-table td small.pd-negative { color:var(--loss); }
.pd-row-actions { display:flex; flex-wrap:wrap; align-items:center; gap:2px 8px; }
.pd-row-actions .text-button { min-height:44px; padding:4px 2px; font-size:14px; white-space:nowrap; }
.pd-row-actions .secondary-button { white-space:nowrap; }
.pd-expanded-row[hidden] { display:none !important; }
.pd-expanded-row td { padding:16px; text-align:left; background:var(--panel-strong); }
.pd-job-details { max-width:100%; min-width:0; }
.pd-job-details p { margin:8px 0; }
.pd-cost-breakdown { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px 16px; margin:0; padding-bottom:10px; }
.pd-cost-breakdown > div { min-width:0; }
.pd-cost-breakdown dt { color:var(--muted); font-size:13px; overflow-wrap:anywhere; }
.pd-cost-breakdown dd { margin:3px 0 0; font-size:15px; font-weight:600; overflow-wrap:anywhere; }
.pd-record-section { margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.pd-record-section h4 { margin:0 0 8px; font-size:16px; font-weight:700; }
.pd-record-edit { margin-top:12px; border-top:1px solid var(--line); }
.profit-decision summary { min-height:44px; padding:10px 0; cursor:pointer; color:var(--brand-dark); font-size:14px; }
.profit-decision summary:hover { text-decoration:underline; text-underline-offset:3px; }
.pd-record-edit form { margin:0; }
.pd-budget-fields { min-width:0; margin:0; padding:0; border:0; }
.pd-form-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px 16px; }
.pd-field { display:grid; gap:5px; min-width:0; font-size:14px; }
.pd-field > span:first-child { color:var(--ink); font-weight:500; }
.pd-input-unit { display:flex; align-items:center; gap:8px; min-width:0; }
.pd-input-unit > span { flex-shrink:0; color:var(--muted); font-size:13px; }
.pd-field input { width:100%; min-width:0; min-height:44px; padding:8px 10px; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--ink); font-size:16px; line-height:1.5; }
.pd-field input:hover:not(:disabled) { border-color:var(--muted); }
.pd-budget-fields:disabled input { background:var(--panel-strong); color:var(--muted); }
.pd-check { display:grid; grid-template-columns:20px minmax(0,1fr); gap:10px; align-items:start; min-height:44px; padding:11px 0; margin:4px 0; color:var(--ink); font-size:14px; cursor:pointer; }
.pd-check input[type=checkbox] { width:18px; height:18px; min-height:0; margin:3px 0 0; padding:0; accent-color:var(--brand); }
.pd-help { color:var(--muted); font-size:13px; line-height:1.8; }
.pd-error { min-height:22px; margin:8px 0 4px; color:var(--loss); font-size:14px; line-height:1.7; }
.pd-field [aria-invalid=true] { border-color:var(--loss); }
.pd-form-actions { display:flex; flex-wrap:wrap; gap:8px 16px; }
.pd-form-actions .text-button { min-height:44px; padding:4px 0; font-size:14px; }
.pd-pagination { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:8px 16px; padding-top:12px; color:var(--muted); font-size:13px; }
.pd-pagination > div { display:flex; align-items:center; gap:12px; }
.pd-empty { margin:0; padding:16px 0; color:var(--muted); }
.pd-basis { margin-top:16px; padding-top:8px; border-top:1px solid var(--line); }
.pd-basis p { margin:8px 0; color:var(--muted); font-size:13px; }
.pd-status { margin:8px 0 0; color:var(--muted); font-size:14px; min-height:22px; }
.pd-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.profit-decision :is(button,select,input,summary,[tabindex]):focus-visible { outline:3px solid var(--brand); outline-offset:3px; }
.profit-decision button:hover:not(:disabled) { filter:brightness(.97); }
.profit-decision button:active:not(:disabled) { filter:brightness(.93); }
.profit-decision button:disabled { cursor:not-allowed; opacity:.6; }

@container profit-review (max-width:720px) {
 .pd-metrics { grid-template-columns:1fr; gap:0; padding:0; }
 .pd-metrics > div { display:grid; grid-template-columns:minmax(0,1fr) fit-content(65%); gap:8px 12px; padding:10px 0; align-items:center; border-right:0; }
 .pd-metrics > div + div { border-top:1px solid var(--line); }
 .pd-metrics dd { margin:0; font-size:22px; text-align:right; }
 .pd-table { min-width:0; display:block; }
 .pd-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
 .pd-table tbody { display:block; }
 .pd-table tbody tr:not(.pd-expanded-row) { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px 10px; padding:12px 0; border-bottom:1px solid var(--line); }
 .pd-table th, .pd-table td { display:block; width:auto !important; padding:0; border:0; text-align:left; overflow-wrap:anywhere; }
 .pd-table th:first-child { grid-column:1/-1; }
 .pd-table td::before { display:block; content:attr(data-label); color:var(--muted); font-size:12px; margin-bottom:2px; }
 .pd-table td:last-child { grid-column:1/-1; }
 .pd-table td:last-child::before { display:none; }
 .pd-row-actions { flex-wrap:wrap; gap:4px 12px; }
 .pd-row-actions .secondary-button { margin-left:auto; }
 .pd-expanded-row { display:block; padding:14px 12px; margin:0; background:var(--panel-strong); border-bottom:1px solid var(--line); }
 .pd-expanded-row td { padding:0; }
 .pd-expanded-row td::before { display:none; }
 .pd-cost-breakdown { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
 .pd-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@container profit-review (max-width:500px) {
 .pd-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .pd-section-heading { align-items:stretch; }
 .pd-sort { width:100%; }
 .pd-sort select { flex:1; width:100%; font-size:13px; }
 .pd-form-grid { grid-template-columns:1fr; }
 .pd-coverage { flex-direction:column; gap:3px; }
 .pd-pagination > div { width:100%; justify-content:space-between; }
 .pd-metrics dd { font-size:21px; }
}
@media(forced-colors:active) {
 .profit-decision :is(button,select,input,summary,[tabindex]):focus-visible { outline-color:Highlight; }
 .pd-negative { color:Mark; }
 .pd-filters > button[aria-pressed=true] { outline:2px solid Highlight; }
}
