/* A stable header and footer surround one scrolling form area. */
:root[data-theme] .modal{width:min(660px,calc(100vw - 32px));padding:24px;border-radius:24px;max-height:calc(100dvh - 40px)}
:root[data-theme] .modal.wide{width:min(860px,calc(100vw - 32px))}
:root[data-theme] .modal-head{gap:16px;margin-bottom:16px;align-items:start}
:root[data-theme] .modal-head h2{font-size:24px;line-height:1.2;letter-spacing:-.6px}
:root[data-theme] .modal-head p{font-size:13px;line-height:1.5;margin-top:8px}
:root[data-theme] .modal-head>button{flex-shrink:0;width:44px;height:44px;min-height:44px;padding:0}
:root[data-theme] .modal :is(button,input,select){min-height:44px;touch-action:manipulation}
:root[data-theme] .modal :is(input,select,textarea){font-size:16px}
:root[data-theme] .modal :is(input[type=checkbox],input[type=radio]){width:22px;height:22px;min-height:22px;flex-shrink:0;accent-color:var(--button)}
:root[data-theme] .modal .field{font-size:13px;gap:7px;position:relative;min-width:0}
:root[data-theme] .modal textarea{min-height:90px;resize:vertical}
:root[data-theme] .modal .form-grid{gap:18px}
:root[data-theme] .modal .has-touch-form{display:flex;flex-direction:column;overflow:hidden;min-height:0;padding:0;scrollbar-gutter:auto}
:root[data-theme] .touch-form{display:flex;flex-direction:column;min-height:0;overflow:hidden;gap:0}
:root[data-theme] .form-scroll{overflow-y:auto;overscroll-behavior:contain;min-height:0;padding:3px 5px 20px 2px;scrollbar-gutter:stable;scroll-padding-block:20px}
:root[data-theme] .modal-body .form-footer{flex-shrink:0;position:static;margin:0;padding:16px 0 0;border-top:1px solid var(--line);background:var(--surface);display:flex;justify-content:flex-end;align-items:center;gap:10px}
:root[data-theme] .modal-body .form-footer button{min-height:48px;min-width:110px;font-size:14px;padding:12px 18px}
:root[data-theme] .form-section{background:var(--surface-2);border:1px solid var(--line);border-radius:16px;padding:18px;margin:0;min-width:0}
:root[data-theme] section.form-section{background:transparent;padding:0;border:0}
:root[data-theme] .form-section-head{margin-bottom:18px}
:root[data-theme] .form-section-head h3{font-size:17px;letter-spacing:-.3px;margin:0 0 5px}
:root[data-theme] .form-section-head p{color:var(--muted);font-size:12px;line-height:1.5;margin:0}
:root[data-theme] .form-section-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
:root[data-theme] .form-section summary{display:grid;grid-template-columns:1fr auto;align-items:center;gap:6px;cursor:pointer;min-height:44px;list-style:none}
:root[data-theme] .form-section summary span{font-weight:600;font-size:14px}
:root[data-theme] .form-section summary small{grid-column:1;font-size:12px;color:var(--muted);line-height:1.5;font-weight:400}
:root[data-theme] .form-section summary:after{content:'+';grid-column:2;grid-row:1 / span 2;font-size:24px;color:var(--muted)}
:root[data-theme] .form-section[open] summary:after{content:'−'}
:root[data-theme] .form-section[open] summary{margin-bottom:18px}
:root[data-theme] .form-section summary::-webkit-details-marker{display:none}
:root[data-theme] .required-marker{font-size:10px;color:var(--muted);font-weight:400;order:3}
:root[data-theme] .form-draft{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 18px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;color:var(--muted);font-size:12px;line-height:1.4;background:var(--surface-2)}
:root[data-theme] .form-draft button{font-size:12px;background:transparent;flex-shrink:0;border:0;padding:6px 10px}
:root[data-theme] .form-note{font-size:12px;line-height:1.6;color:var(--muted);margin:0;grid-column:1 / -1}
:root[data-theme] .modal .consent{display:flex;align-items:center;gap:12px;min-height:44px;font-size:12px;line-height:1.5}
:root[data-theme] .wizard-progress{flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px;font-size:13px;color:var(--muted)}
:root[data-theme] .wizard-progress strong{color:var(--ink);font-size:15px}
:root[data-theme] .wizard-progress progress{width:100px;height:6px;accent-color:var(--button)}
:root[data-theme] .wizard-footer>span{font-size:11px;line-height:1.4;margin-right:auto;max-width:180px}
:root[data-theme] .wizard-footer>.actions{flex-wrap:nowrap}
:root[data-theme] .review-edit{display:flex;flex-wrap:wrap;gap:8px;margin-top:18px}
:root[data-theme] #modal-error:not(:empty){flex-shrink:0;padding:12px;margin-bottom:12px;max-height:100px;overflow:auto;color:var(--negative);background:var(--negative-bg);border-radius:12px;font-size:13px;line-height:1.5}
:root[data-theme] #modal-error .error{margin:0;padding:0;border:0;background:transparent;color:inherit}
@media(max-width:600px){
 :root[data-theme] .modal,:root[data-theme] .modal.wide{width:calc(100vw - 16px);max-height:calc(100dvh - 16px);padding:18px 14px;border-radius:20px}
 :root[data-theme] .modal-backdrop{padding:8px}
 :root[data-theme] .modal-head h2{font-size:21px}
 :root[data-theme] .form-section-fields,:root[data-theme] .modal .form-grid{grid-template-columns:1fr}
 :root[data-theme] .form-section{padding:14px}
 :root[data-theme] .modal-body .form-footer{padding-top:12px}
 :root[data-theme] .modal-body .form-footer>button{flex:1;min-width:0}
 :root[data-theme] .wizard-footer{flex-wrap:wrap}
 :root[data-theme] .wizard-footer>span{max-width:none;width:100%}
 :root[data-theme] .wizard-footer>.actions{width:100%}
 :root[data-theme] .wizard-footer>.actions>button{flex:1;min-width:0}
}
@media(max-height:550px){:root[data-theme] .modal-head p{display:none}:root[data-theme] .modal{max-height:calc(100dvh - 12px);padding:14px}:root[data-theme] .modal-head{margin-bottom:10px}:root[data-theme] .wizard-progress{margin-bottom:10px}}
:root[data-theme] .modal-backdrop{height:var(--form-viewport-height,100dvh);top:var(--form-viewport-top,0px);bottom:auto;box-sizing:border-box}
:root[data-theme] .modal{max-height:calc(var(--form-viewport-height,100dvh) - 40px)}
@media(max-width:600px){:root[data-theme] .modal,:root[data-theme] .modal.wide{max-height:calc(var(--form-viewport-height,100dvh) - 16px)}}
@media(max-height:550px){:root[data-theme] .modal{max-height:calc(var(--form-viewport-height,100dvh) - 12px)}}
@media print{:root[data-theme] .modal,:root[data-theme] .modal-body,:root[data-theme] .form-scroll{max-height:none;height:auto;overflow:visible}:root[data-theme] .modal-backdrop{height:auto;top:0}:root[data-theme] .touch-form{display:block;overflow:visible}:root[data-theme] .form-footer,:root[data-theme] .form-draft{display:none}}
