/* BackTax 1.37.3 — large screens. One centred container, gutters growing with the viewport, and a MAXIMUM width:
   width = min(100% − 2 × gutter, 1680 px); beyond that the extra space is a centred margin. Header, content and
   footer share the same edges. Long text keeps about 90 characters per line; search fields at most 640 px.
   Everything is inside min-width:1440px: below that width nothing changes. */
@media (min-width:1440px){
:root{--bt-gutter:clamp(16px,2.4vw,64px);--bt-wide-max:1680px;
 --bt-app-w:min(calc(100vw - var(--qb-side-w,272px) - 2 * var(--bt-gutter)),var(--bt-wide-max))}

/* ---- application pages (fixed sidebar) ---- */
body.bt-legacy-nav > :is(main,.shell,.wrap),body.bt-legacy-nav.bt-module-page > main,
body.bt-legacy-nav > .bt-submission-link{max-width:var(--bt-app-w)!important}
/* page stylesheets pin their own main (summary, documents, reader, modules: 1100–1200 px) with higher specificity:
   :is(#bt-main-content,*) lifts this rule above them whatever the load order */
body.bt-legacy-nav > :is(main,.shell,.wrap):is(#bt-main-content,*){max-width:var(--bt-app-w)!important;width:100%!important}
/* header buttons stay aligned with the content edges instead of the screen edges */
body.bt-legacy-nav > :is(header,.bar-top){padding-inline:calc(max(var(--bt-gutter),(100vw - var(--qb-side-w,272px) - var(--bt-app-w)) / 2) + clamp(16px,2.2vw,30px))!important}
body.bt-legacy-nav main :is(p,li,dd,blockquote,figcaption,.bt-notice):not(td *):not(th *){max-width:90ch}
body.bt-legacy-nav main :is(.cards,.bt-summary-metrics){grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))!important}

/* document reading: the proposals to verify beside the recognised pages */
body.bt-document-reader main.bt-reader{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:24px;align-items:start}
body.bt-document-reader main.bt-reader > *{grid-column:1 / -1;min-width:0}
body.bt-document-reader main.bt-reader > #suggestions{grid-column:1}
body.bt-document-reader main.bt-reader > #suggestions + section{grid-column:2;grid-row:span 1}

/* FEIE worksheet: the worksheet beside its explanation */
body.bt-legacy-nav main.bt-feie{display:grid!important;grid-template-columns:minmax(0,3fr) minmax(320px,2fr);column-gap:24px;align-items:start}
main.bt-feie > *{grid-column:1 / -1;min-width:0}
main.bt-feie > .bt-notice{grid-column:2;grid-row:3 / span 2;margin-top:14px}
main.bt-feie > .bt-sheet{grid-column:1}

/* Form 1116: comparison beside the explanation of the computation */
.bt-side-by-side{display:grid;grid-template-columns:minmax(0,3fr) minmax(320px,2fr);gap:24px;align-items:start}
.bt-side-by-side > *{min-width:0}

/* search fields stay short (the 1 680 px cap keeps row actions near their text) */
:is(body.bt-legacy-nav,body.bt-wide) main input[type=search]{max-width:640px}
/* ---- console, expert and other stand-alone pages ---- */
body.bt-wide > :is(header,footer){padding-inline:max(var(--bt-gutter),calc((100% - var(--bt-wide-max)) / 2))!important}
body.bt-wide > :is(main,.wrap,.shell){width:min(calc(100% - 2 * var(--bt-gutter)),var(--bt-wide-max))!important;max-width:none!important;margin-inline:auto!important;box-sizing:border-box}
body.bt-wide main :is(p,li,dd,blockquote,figcaption):not(td *):not(th *){max-width:90ch}
/* Super console home: its cards side by side */
body.bt-wide.bt-cards > main{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,620px),1fr));column-gap:20px;align-items:start}
body.bt-wide.bt-cards > main > *{grid-column:1 / -1;min-width:0}
body.bt-wide.bt-cards > main > :is(section.card,.card){grid-column:auto}

/* ---- public site: wider feature grid and screenshots, prose at a readable length ---- */
body.bt-site .wrap{max-width:min(calc(100vw - 2 * var(--bt-gutter)),var(--bt-wide-max))!important;padding-inline:0!important}
body.bt-site section > .wrap > :is(p,ul,ol,details),body.bt-site .hero p,body.bt-site .card p{max-width:85ch}
body.bt-site .grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
body.bt-site .step{grid-template-columns:minmax(0,1fr) minmax(0,1.8fr)}

/* ---- text pages: readable column ---- */
body.bt-text :is(main,.wrap) :is(p,li,.body){max-width:85ch}
}
