/* One responsive owner for the standalone app: desktop, tablet, then phone. */
html{scroll-padding-bottom:110px;-webkit-text-size-adjust:100%}
.mobile-document-switcher,.mobile-editor-sections,.mobile-packet-link,.mobile-label{display:none}
.review-actions{display:grid;gap:10px;margin-top:20px}
.review-summary{grid-area:summary}.pdf-pages{grid-area:pages}
.review{grid-template-areas:"summary pages"}
.packet-contents{margin-top:12px}
.zoom-controls{display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:14px}
.zoom-controls button{min-width:44px;min-height:44px;padding:8px 12px}
#zoom-level{min-width:50px;text-align:center;font-size:12px;color:var(--muted)}
.pdf-viewport{overflow:auto;max-height:75dvh;overscroll-behavior:contain;scrollbar-gutter:stable;touch-action:pan-x pan-y pinch-zoom}
.pdf-viewport .pdf-page{max-width:none;min-width:100%}
.pdf-loading{display:flex;align-items:center;justify-content:center;gap:10px;color:var(--muted);font-size:13px;padding:14px;min-height:44px}
.compact-summary strong,.summary-row strong{overflow-wrap:anywhere;min-width:0}
.field label{overflow-wrap:anywhere}
#profile-dialog{max-height:min(90dvh,var(--visible-height,90dvh))}
#profile-body{display:grid;grid-template-rows:auto minmax(0,1fr) auto;max-height:inherit}
.dialog-content{overflow-y:auto;overscroll-behavior:contain}
.dialog-head,.dialog-footer{position:relative}

@media(min-width:901px){
 .editor-screen{padding-top:18px}
 .editor-screen .title-row{margin-bottom:16px}
 .editor-screen #back-search{padding:0;font-size:13px;line-height:20px}
 .editor-screen .title-row h1{font-size:29px;margin:7px 0 5px}
 .editor-screen .tabs{margin-bottom:16px}
 .editor-screen .tabs button{padding:9px 8px}
 .editor-screen .card{padding:18px}
 .editor-screen h2{margin-bottom:14px}
 .editor-screen .field-grid{gap:16px}
 .editor-screen .checks{margin:16px 0 14px}
 .editor-screen .parties textarea{min-height:58px}
 .editor-screen .parties #contract-details{margin-top:12px}
 .editor-screen .clauses details{padding:10px 0}
 .editor-screen .editor-actions{min-height:64px;padding-top:10px;padding-bottom:10px}
}
@media(min-width:1100px) and (max-height:1100px){
 .editor-screen{padding-top:14px}.editor-screen .title-row{margin-bottom:12px}
 .editor-screen .tabs{margin-bottom:14px}.editor-screen .card{padding:16px}
 .editor-screen h2{margin-bottom:12px}.editor-screen .checks{margin:14px 0 12px}
 .editor-screen .parties>.field-grid{gap:10px 16px}
 .editor-screen .parties #contract-details{margin-top:8px}
 .editor-screen .clauses{padding:14px 16px}.editor-screen .clauses h2{margin-bottom:6px}
 .editor-screen .clauses details{padding:7px 0}
}
@media(max-width:1100px) and (min-width:901px){
 .editor-screen .editor-layout{grid-template-columns:minmax(0,1.7fr) minmax(270px,1fr)}
 .editor-screen .field-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:900px){
 .keyboard-open .editor-actions,.keyboard-open .review-actions{visibility:hidden;pointer-events:none}
 button,a.download,summary,.check{min-height:44px;touch-action:manipulation}
 input:not([type=checkbox]),textarea,.editor-screen input:not([type=checkbox]),.editor-screen textarea,.select-trigger{font-size:16px;min-height:48px}
 .select-option{min-height:48px;font-size:16px}
 .deadline>.date-toggle{position:static;min-height:44px;font-size:13px;padding:6px 0;text-align:left}
 .input-unit span{top:17px}
 main{padding:26px 4% 50px}
 .editor-screen .editor-layout{grid-template-columns:1fr}
 .editor-screen .field-grid,.field-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .editor-screen .title-row{align-items:flex-start}.editor-screen .title-row h1{font-size:26px}
 .editor-screen .title-row>button{white-space:nowrap}
 .editor-screen{padding-bottom:125px}
 .editor-actions{padding:12px 4%;gap:10px}
 .editor-actions button{padding:10px 12px}
 .editor-screen .tabs button{min-width:74px;font-size:13px}
 .property-picker{grid-template-columns:minmax(0,1fr) 250px}
 .picker-main{padding:24px}.picker-defaults{padding:24px 20px}
 .header-actions .select-control{width:220px}
 .review{grid-template-columns:1fr;grid-template-areas:"pages" "summary"}
 .review-summary{grid-template-columns:1fr 1fr}
 .review-summary>.card:first-child{grid-row:span 2}
 .profile-field-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:650px){
 html{scroll-padding-bottom:calc(110px + env(safe-area-inset-bottom))}
 body{min-width:0}
 header,body:has(.editor-screen) header{height:auto;min-height:0;padding:12px 16px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px}
 .brand{gap:10px;min-width:0}.mark{width:32px;height:32px;font-size:22px}
 .brand-copy strong{font-size:18px}.brand-copy small{font-size:9px}
 .header-actions{display:contents}
 .header-actions .select-control{grid-column:1/-1;width:100%;max-width:none}
 .preferences-button{padding:8px 0 8px 10px;font-size:12px;min-height:44px}
 main,.search-screen,.editor-screen{padding:20px 16px 32px}
 h1,.editor-screen .title-row h1{font-size:25px;letter-spacing:-.6px;line-height:1.2;overflow-wrap:anywhere}
 h2,.editor-screen h2{font-size:19px;margin-bottom:16px}
 .subtitle,.editor-screen .subtitle{font-size:13px;line-height:1.6;overflow-wrap:anywhere}
 .card,.editor-screen .card{padding:18px;border-radius:10px}
 .stack,.editor-screen .stack{gap:14px}
 button,a.download{min-height:44px;touch-action:manipulation}
 input:not([type=checkbox]),textarea,.editor-screen input:not([type=checkbox]),.editor-screen textarea,.select-trigger{font-size:16px;min-height:48px}
 .editor-screen input:not([type=checkbox]){height:48px;padding:11px 12px}
 input[type=date]{min-width:0;appearance:none}
 textarea,.editor-screen textarea{min-height:90px;line-height:1.5}
 .editor-screen .field-grid,.editor-screen .field-grid.two,.field-grid,.field-grid.two{grid-template-columns:minmax(0,1fr);gap:18px}
 .editor-screen .terms-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 12px}
 .field label,.editor-screen label{font-size:13px;line-height:1.4}
 .field,.editor-screen .field{gap:7px}
 small{font-size:12px;line-height:1.6}
 .input-unit span{top:17px;font-size:12px}
 .checks,.editor-screen .checks{display:grid;grid-template-columns:1fr;gap:4px;margin:12px 0}
 .check,.editor-screen .check{font-size:14px;min-height:44px;line-height:1.5;gap:11px}
 input[type=checkbox]{width:20px;height:20px;flex:none;margin:0}
 summary,.editor-screen summary{min-height:44px;font-size:14px;line-height:1.4}
 .editor-screen details{padding:8px 0}
 .editor-screen .details-content{padding-top:14px}
 .editor-screen .title-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:start;margin-bottom:18px}
 .editor-screen .title-row>div{display:contents}
 .editor-screen .title-row .subtitle{grid-column:1/-1;grid-row:3}
 .editor-screen #back-search{grid-column:1;grid-row:1;font-size:12px;min-height:44px;padding:0;text-align:left}
 .editor-screen .title-row h1{grid-column:1/-1;grid-row:2;margin:2px 0 8px}
 .editor-screen .title-row>button{grid-column:2;grid-row:1;font-size:12px;padding:8px 10px;margin:0}
 .editor-screen .tabs{display:none}
 .mobile-document-switcher{display:grid;gap:7px;margin-bottom:14px}
 .mobile-document-switcher>label{font-size:12px;color:var(--muted)}
 .mobile-editor-sections{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;background:#e9eff8;border-radius:8px;margin-bottom:16px;scroll-margin-top:12px}
 .mobile-editor-sections button{border:0;background:transparent;font-size:13px;padding:10px;min-height:44px;color:#5e7596}
 .mobile-editor-sections button[aria-pressed=true]{background:#fff;color:#1d4fb0;box-shadow:0 1px 4px #17264012}
 .editor-screen[data-mobile-panel=terms] .editor-rail,.editor-screen[data-mobile-panel=packet] .editor-main{display:none}
 .deadline>.date-toggle{position:static;min-height:44px;line-height:1.3;margin-top:2px;font-size:13px;padding:6px 0;text-align:left}
 .deadline>[data-date-field]{margin-top:4px;grid-column:1/-1}
 .packet-options{gap:4px;margin-top:12px}
 .option-note{margin:-4px 0 8px 31px;font-size:12px}
 .compact-summary{font-size:14px;line-height:1.5;gap:16px}
 .included-document{font-size:14px}
 .card-description{font-size:13px;line-height:1.6}
 .editor-screen{padding-bottom:calc(132px + env(safe-area-inset-bottom))}
 .editor-screen .editor-actions{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px;padding:8px 16px calc(12px + env(safe-area-inset-bottom));min-height:0;align-items:center}
 .editor-actions #draft-status{display:block;font-size:11px;margin:0;line-height:1.4}
 .mobile-packet-link{display:block;font-size:12px!important;min-height:32px;padding:4px 0!important}
 .editor-actions .actions{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr 1.3fr;gap:8px;width:100%}
 .editor-actions button{font-size:12px;min-height:46px;padding:10px 8px}
 .desktop-label{display:none}.mobile-label{display:inline}
 .editor-screen~#status,.review-screen~#status{bottom:calc(112px + env(safe-area-inset-bottom))}
 #status{left:16px;right:16px;max-width:none;font-size:13px;padding:13px 16px;bottom:calc(16px + env(safe-area-inset-bottom))}
 .select-trigger{padding:11px 14px}
 .select-option{min-height:48px;font-size:16px;padding:12px}
 .select-menu{max-width:calc(100vw - 24px)}
 .search-heading{margin-bottom:22px}.search-heading h1{font-size:27px}
 .search-heading .subtitle{font-size:14px;line-height:1.6}
 .property-picker{grid-template-columns:1fr;border-radius:10px}
 .picker-main{padding:18px}
 .picker-defaults{border-left:0;border-top:1px solid #e2e9f3;padding:20px}
 .picker-label{align-items:flex-start;gap:8px;flex-wrap:wrap}.picker-label label{font-size:12px}
 .source-badge{font-size:10px;padding:4px 8px}
 .search-control input{font-size:16px;min-height:56px}
 .clear-search{min-height:44px;width:44px;height:44px;right:4px}
 .search-help{font-size:12px;margin:12px 0 18px}
 .search-empty,.search-loading{min-height:170px}.search-empty{padding:24px 16px}
 .result-marker,.result-arrow{display:none}
 .picker-main .result{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:16px 12px}
 .result-address strong{font-size:14px;line-height:1.5}.result-address small{font-size:11px;line-height:1.6}
 .result-price{font-size:13px}.result-heading{font-size:11px}
 .manual-entry{align-items:flex-start;flex-direction:column;gap:4px;margin-top:20px;padding-top:14px;font-size:12px}
 .manual-entry button{font-size:13px}
 .default-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
 .default-metrics strong{font-size:23px}.default-metrics span{font-size:12px}
 .defaults-heading{margin-bottom:14px}.defaults-heading button{font-size:13px;min-width:44px}
 .picker-defaults h2{font-size:18px;margin-bottom:18px}
 .defaults-note{font-size:12px}
 .review-screen{padding-bottom:calc(108px + env(safe-area-inset-bottom))}
 .review-screen>#back-editor{font-size:13px;text-align:left}
 .review-screen>h1{font-size:27px;margin-top:8px}
 .review-screen>.subtitle{margin-bottom:18px}
 .review{grid-template-columns:1fr;grid-template-areas:"pages" "summary";gap:18px}
 .review-summary{grid-template-columns:1fr}.review-summary>.card:first-child{grid-row:auto}
 .pdf-pages{padding:10px;border-radius:10px}
 .page-controls{gap:6px;margin-bottom:10px;font-size:12px}
 .page-controls button{font-size:12px;padding:8px 10px;min-height:44px}
 .zoom-controls{gap:8px;margin-bottom:10px}.zoom-controls button{min-height:44px}
 .pdf-viewport{max-height:65dvh;scrollbar-gutter:auto}
 .summary-row{font-size:14px;line-height:1.5;padding:10px 0}
 .review-actions{position:fixed;bottom:0;left:0;right:0;z-index:10;display:grid;grid-template-columns:1fr 1.2fr;gap:10px;background:#fff;border-top:1px solid var(--border);padding:12px 16px calc(12px + env(safe-area-inset-bottom));margin:0}
 .review-actions .download,.review-actions button{font-size:13px;min-height:46px;padding:12px 8px}
 .review-actions:not(.saved) .download{background:#fff;color:#2456ae;border:1px solid #cad6e5}
 .review-actions.saved{grid-template-columns:1fr}
 #profile-dialog{width:100%;height:min(100dvh,var(--visible-height,100dvh));max-width:none;max-height:min(100dvh,var(--visible-height,100dvh));margin:0;border:0;border-radius:0}
 #profile-body{height:100%;max-height:100%}
 .dialog-head{padding:12px 16px max(12px,env(safe-area-inset-top));gap:12px;border-bottom:1px solid var(--border)}
 .dialog-head h2{font-size:20px;margin:0}
 .dialog-head button{min-height:44px;font-size:13px}
 .dialog-content{padding:18px 16px 24px}
 .dialog-content>p{font-size:13px;line-height:1.7;margin-top:0}
 .profile-field-grid{grid-template-columns:minmax(0,1fr);gap:18px}
 .dialog-content .check{margin:4px 0}
 .dialog-footer{display:grid;grid-template-columns:1fr 1.25fr;padding:12px 16px calc(12px + env(safe-area-inset-bottom));gap:10px}
 .dialog-footer button{min-height:48px;font-size:13px;padding:10px 8px}
 .working-dialog{width:calc(100vw - 40px);padding:28px 24px 22px;max-height:calc(var(--visible-height,100dvh) - 32px)}
 .working-dialog h2{font-size:22px}.working-dialog #working-description{font-size:14px}
 .history{max-height:none;padding:0}.history button{min-height:54px;line-height:1.5}
}
@media(max-width:360px){
 .editor-screen .terms-grid{grid-template-columns:1fr}
 .result-price{grid-column:1;grid-row:2;color:#617b9e}
 .editor-screen .title-row{grid-template-columns:minmax(0,1fr) auto}.editor-screen .title-row>button{font-size:11px;padding:8px}
 .page-controls{flex-wrap:wrap}.page-controls #page-number{order:-1;flex-basis:100%;text-align:center}
 .page-controls button{flex:1}.dialog-footer{grid-template-columns:1fr}
}
@media(max-height:500px) and (max-width:900px){
 .working-dialog{padding:20px;max-height:calc(100dvh - 24px)}
 .working-graphic{width:50px;height:50px;margin-bottom:12px}.working-graphic .spinner{width:44px;height:44px}
 .working-dialog h2{font-size:19px}.working-dialog #working-description{margin-bottom:12px}
}
@media(prefers-reduced-motion:reduce){
 *,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
}
