/* Shared layout primitives. Keep spacing in the container that owns the flow. */
.page-stack { display:flex; flex-direction:column; gap:24px; }
.page-stack > :is(.page-head,.summary-grid,.section-title,.intake-pagination) { margin-block:0; }
.page-stack > .notice + .notice { margin-top:0; }
.page-stack > .section-title { margin-bottom:-8px; }
.content-stack { display:flex; flex-direction:column; align-items:stretch; gap:16px; min-width:0; }
.content-stack > * { margin-block:0; }
.content-stack > :is(p,h2,h3,h4,.eyebrow,.plan-price,dl) { margin-block:0; }
.content-stack > :is(.btn,.text-link,svg,.badge) { align-self:flex-start; }
.content-stack > .btn.full { align-self:stretch; }
.content-stack > .notice + .notice { margin-top:0; }
.intake-forwarding-intro { display:grid; gap:10px; }
.intake-guidance { gap:8px; }
.intake-review { gap:18px; }
.intake-results { gap:20px; }
.intake-results > .intake-pagination { margin-top:0; }
.intake-forwarding > .btn { max-width:100%; }
.intake-message > div:first-child { display:grid; gap:8px; }
.intake-message h3 { margin:0; }
.intake-message > .stack { align-items:flex-start; }
.value-sources { line-height:1.65; }
.value-sources summary { cursor:pointer; }
.value-sources[open] > p { margin-top:12px; }

/* All columns can shrink to their actual available width. */
.section-grid { align-items:start; }
:is(.section-grid,.split,.form-grid,.feature-grid,.summary-grid) > * { min-width:0; }
.form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.split { grid-template-columns:repeat(2,minmax(0,1fr)); }
.two-metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
dl.card-body, .card-body > dl, dl.quote-details { margin-block:0; }
.stack > h3:first-child { margin-top:0; }
.notice > div, .record-head > *, .quote-heading, .next-copy { min-width:0; overflow-wrap:anywhere; }
.card-body :is(p,h2,h3), .summary-card, .intake-pagination { overflow-wrap:anywhere; }

/* Keep headings readable when a page has many actions. */
.page-head { flex-wrap:wrap; align-items:flex-start; }
.page-head > :first-child:not(.btn) { flex:1 1 480px; min-width:0; }
.page-head > .actions { flex:0 1 auto; max-width:100%; align-self:flex-end; }
.page-head > .btn { max-width:100%; align-self:flex-end; }
.page-head h1 { overflow-wrap:anywhere; }
.case-title-row { align-items:flex-start; }
.case-title-row h1 { flex-basis:100%; }
.section-title { flex-wrap:wrap; }
.btn { max-width:100%; }
:is(.app-shell,.modal,.supplier-page) .btn:not(.icon) { white-space:normal; overflow-wrap:anywhere; }
.filter-pill { border:1px solid transparent; line-height:1.4; }
.filter-pill.active { border-color:var(--line); }

/* Checkboxes are controls, not full-width text fields. */
input:is([type=checkbox],[type=radio]) { width:18px; height:18px; min-width:18px; min-height:18px; padding:0; flex:0 0 18px; }
.checkbox-line input,.checkbox input { margin:2px 0 0; }
.checkbox-line,.checkbox { min-width:0; overflow-wrap:anywhere; }

/* Match the top bar and banners to the content container, even on wide screens. */
.app-main { --page-gutter:38px; }
.app-main > :is(.topbar,.demo-banner) { padding-inline:max(var(--page-gutter),calc((100% - 1524px)/2)); }
.topbar { gap:16px; }
.topbar > .actions { min-width:0; flex-wrap:nowrap; }
.breadcrumbs { min-width:0; flex-wrap:wrap; line-height:1.5; }
.top-meta { flex-shrink:0; }
.sidebar { height:100dvh; overflow-y:auto; overscroll-behavior:contain; }
.sidebar > * { flex-shrink:0; }
.sidebar .nav-spacer { flex:1 0 24px; }
.profile-info strong { white-space:nowrap; }

/* The next action uses one alignment grid instead of a fixed mobile offset. */
.next-action { display:grid; grid-template-columns:36px minmax(0,1fr) auto; align-items:center; }
.next-action .next-copy { min-width:0; }
.next-action .btn { margin-left:0; }
.quote-header { align-items:flex-start; }
.quote-header > .quote-price { flex-shrink:0; max-width:45%; overflow-wrap:anywhere; }
.quote-heading { padding-top:2px; }
.quote-details { gap:20px; }

@media (max-width:1150px) {
 .app-main { --page-gutter:25px; }
 .section-grid { grid-template-columns:minmax(0,1fr); }
 .case-aside { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
 .case-aside .side-card { margin:0; }
 .toolbar { flex-wrap:wrap; }
 .toolbar > .filter-pills { flex:1 1 400px; }
}
@media (max-width:850px) {
 .app-main { --page-gutter:20px; }
 .page-head > :first-child:not(.btn) { flex-basis:100%; }
 .page-head > :is(.actions,.btn) { align-self:flex-start; }
 .next-action { grid-template-columns:36px minmax(0,1fr); }
 .next-action > .btn { grid-column:2; justify-self:start; }
 .split { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:600px) {
 .page-stack { gap:22px; }
 .page-head { gap:16px; }
 .page-head > :first-child:not(.btn) { flex-basis:auto; }
 .page-head > .actions { width:100%; }
 .content-stack { gap:14px; }
 .intake-guidance { gap:8px; }
 .intake-review { gap:16px; }
 .intake-results { gap:18px; }
 .form-grid,.case-aside { grid-template-columns:minmax(0,1fr); }
 .toolbar > .filter-pills { flex:initial; }
 .form-grid .full-width { grid-column:auto; }
 .quote-header .quote-price { max-width:100%; padding-left:0; }
 .quote-price .sample-quote-notice { max-width:none; }
 .quote-details { grid-template-columns:minmax(0,1fr); }
 .next-action { gap:12px; }
 .modal-header { gap:12px; align-items:flex-start; }
 .modal-header h2 { min-width:0; overflow-wrap:anywhere; }
 .modal-header .btn.icon { flex:none; }
 .intake-pagination .help { flex-basis:100%; order:-1; text-align:center; }
 .team-table { overflow:visible; }
 .team-table table,.team-table tbody { display:block; width:100%; min-width:0; }
 .team-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
 .team-table tbody tr { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; padding:18px; border-bottom:1px solid var(--line); }
 .team-table tbody tr:last-child { border:0; }
 .team-table td { padding:0; border:0; min-width:0; overflow-wrap:anywhere; }
 .team-table td:first-child { grid-column:1/-1; }
 .team-table td:nth-child(2) { grid-column:1; }
 .team-table td:nth-child(3) { grid-column:2; text-align:right; }
 .team-table td:last-child { grid-column:1/-1; }
 .team-table td .badge { white-space:normal; }
}
@media (max-width:370px) {
 .two-metric-grid { grid-template-columns:minmax(0,1fr); }
 .topbar { gap:8px; }
 .breadcrumbs { gap:5px; font-size:10px; }
 .topbar > .actions { gap:6px; }
}
