/* A consistent administrator form system: fixed context and actions, section navigation,
   restrained surfaces, and field labels distinct from entered values. */
:is(#sheet-row-editor,#sheet-location-editor,#import-organization-dialog){--form-bg:#f3f6f8;--form-card:#fff;--form-border:#d5e0e7;--form-text:#17384a;--form-muted:#526b79;--form-accent:#007e87;--form-selected:#e5f3f4;font-family:system-ui,-apple-system,'Segoe UI',sans-serif;color:var(--form-text);background:var(--form-card);border:1px solid var(--form-border);border-radius:14px;box-shadow:0 24px 80px #092b3b40}
:is(#sheet-row-editor,#sheet-location-editor){width:min(1080px,calc(100vw - 40px));height:calc(100dvh - 48px);max-height:calc(100dvh - 48px)}
:is(#sheet-row-editor,#sheet-location-editor) form{flex:1;min-height:0}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-header{position:relative;padding:22px 70px 20px 28px;background:var(--form-card)}
.admin-form-eyebrow{display:block;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--form-accent);margin-bottom:7px}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-header h2{font:700 24px/1.25 system-ui;margin:0 0 6px;color:var(--form-text)}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-header p{font-size:13px;line-height:1.5;color:var(--form-muted);overflow-wrap:anywhere}
.admin-form-close{position:absolute;right:22px;top:22px;width:36px;height:36px;min-height:0;padding:0;border:1px solid var(--form-border);border-radius:8px;background:var(--form-card);color:var(--form-muted);font:24px/1 system-ui;cursor:pointer}
:is(#sheet-row-editor,#sheet-location-editor) .admin-form-layout{display:grid;grid-template-columns:180px minmax(0,1fr);gap:24px;align-items:start;padding:24px;background:var(--form-bg);scroll-padding-top:24px;flex:1;scrollbar-gutter:stable}
.admin-form-nav{position:sticky;top:0;display:flex;flex-direction:column;gap:4px;max-height:calc(100dvh - 260px);overflow:auto}
.admin-form-nav>p{margin:0 0 10px;padding:0 12px;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--form-muted);font-weight:700}
.admin-form-nav button{font:500 13px/1.45 system-ui;text-align:left;border:1px solid transparent;background:transparent;border-radius:7px;padding:10px 12px;color:var(--form-muted);cursor:pointer;min-height:40px}
.admin-form-nav button:hover{background:var(--form-card)}
.admin-form-nav button[aria-current]{color:var(--form-accent);background:var(--form-selected);border-color:var(--form-accent);font-weight:650}
.admin-form-content{min-width:0}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-section{position:relative;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;padding:24px;margin:0 0 20px;border:1px solid var(--form-border);border-radius:10px;background:var(--form-card);min-width:0;scroll-margin-top:24px}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-section>legend{float:left;width:100%;grid-column:1/-1;padding:0 0 14px;margin:0;border-bottom:1px solid var(--form-border);font:650 16px/1.4 system-ui;color:var(--form-text)}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-field{font:600 13px/1.5 system-ui;gap:7px;color:var(--form-text)}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-field :is(input:not([type=checkbox]),select,textarea){background:var(--form-card);color:var(--form-text);border:1px solid #9fb3c0;border-radius:6px;padding:10px 12px;min-height:42px;font:400 14px/1.5 system-ui;box-shadow:0 1px 2px #102f4010}
:is(#sheet-row-editor,#sheet-location-editor) :is(input,select,textarea,button):focus-visible{outline:3px solid #d6a82c;outline-offset:2px}
:is(#sheet-row-editor,#sheet-location-editor) .admin-form-wide{grid-column:1/-1}
#sheet-row-editor textarea{min-height:104px;resize:vertical}
#sheet-row-editor .sheet-row-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 14px;padding:14px 0 0;border-top:1px solid var(--form-border)}
#sheet-row-editor .sheet-row-choices legend{font:600 13px/1.5 system-ui;padding:0 0 8px}
#sheet-row-editor .sheet-row-choices label{display:flex;align-items:flex-start;gap:9px;padding:8px;margin:0;border-radius:5px;font:400 13px/1.45 system-ui;cursor:pointer}
#sheet-row-editor .sheet-row-choices label:has(input:checked){background:var(--form-selected)}
#sheet-row-editor .sheet-row-choices input{flex:none;width:17px;height:17px;margin:1px 0;accent-color:var(--form-accent)}
#sheet-row-editor .sheet-row-structured{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 16px;padding:14px 0;border-top:1px solid var(--form-border)}
#sheet-row-editor .sheet-row-structured>strong{font-size:13px;font-weight:600}
#sheet-row-editor .sheet-row-structured>p{grid-column:1;margin:0;font-size:13px;color:var(--form-muted);line-height:1.55}
#sheet-row-editor .sheet-row-structured>button{grid-column:2;grid-row:1/3;align-self:center;font:600 12px/1.3 system-ui;max-width:160px;padding:8px 10px;min-height:36px;border-color:var(--form-border);border-radius:6px}
#sheet-row-editor .sheet-row-structured>div{grid-column:1/-1}
#sheet-location-editor .location-editor-privacy{grid-template-columns:1fr}
#sheet-location-editor .location-editor-privacy label{background:var(--form-bg);padding:12px;border-radius:6px;gap:10px;font-weight:400}
#sheet-location-editor .location-editor-privacy input{accent-color:var(--form-accent)}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-footer{padding:16px 24px;background:var(--form-card);border-color:var(--form-border)}
.admin-form-save-hint{margin-right:auto;font-size:12px;color:var(--form-muted);max-width:220px}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-footer button{font:600 14px/1.4 system-ui;min-width:90px;border-radius:7px;padding:10px 18px}
:is(#sheet-row-editor,#sheet-location-editor) .location-editor-status:not(:empty){padding:10px;border-radius:6px;background:var(--form-selected);color:var(--form-text)}
/* Read-only companion uses the same hierarchy and surfaces. */
#import-organization-dialog{width:min(1200px,calc(100vw - 40px))}
#import-organization-dialog .import-organization-header{padding:22px 28px;background:var(--form-card)}
#import-organization-dialog .import-organization-header p{font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--form-accent);margin-bottom:6px}
#import-organization-dialog .import-organization-header h2{font:700 23px/1.3 system-ui;color:var(--form-text)}
#import-organization-dialog .import-organization-body{background:var(--form-bg);padding:22px 28px;scroll-padding-top:20px}
#import-organization-dialog .import-organization-body>p[role=status]{display:inline-block;background:var(--form-selected);color:var(--form-accent);border-radius:6px;padding:7px 11px;font-size:12px;margin:0 0 10px}
#import-organization-dialog .import-organization-context{background:var(--form-card);border:1px solid var(--form-border);border-radius:8px;padding:12px 16px;margin:8px 0;font-size:13px}
#import-organization-dialog .freedom-detail{border:0;padding:12px 0 0;margin:0;font-size:13px}
#import-organization-dialog .admin-review-completeness{font-size:13px;color:var(--form-muted);line-height:1.7;margin:16px 0 8px}
#import-organization-dialog .admin-review-method{font-size:12px;color:var(--form-muted);margin:8px 0}
#import-organization-dialog .admin-review-hide-unanswered{font:600 12px/1.4 system-ui;min-height:32px;padding:7px 12px;border:1px solid var(--form-border);border-radius:6px}
#import-organization-dialog .admin-review-layout{grid-template-columns:190px minmax(0,1fr);gap:24px}
#import-organization-dialog .admin-review-section-nav{background:transparent;gap:4px;top:0}
#import-organization-dialog .admin-review-section-nav a{font:500 13px/1.45 system-ui;color:var(--form-muted);text-decoration:none;padding:10px 12px;border:1px solid transparent;border-radius:7px}
#import-organization-dialog .admin-review-section-nav a[aria-current]{color:var(--form-accent);background:var(--form-selected);border-color:var(--form-accent);font-weight:650}
#import-organization-dialog .admin-review-section{background:var(--form-card);border:1px solid var(--form-border);border-radius:10px;padding:20px 24px;margin:0 0 20px;scroll-margin-top:20px}
#import-organization-dialog .admin-review-section h3{font:650 17px/1.4 system-ui;color:var(--form-text);margin:0;padding:0 0 14px;border-bottom:1px solid var(--form-border)}
#import-organization-dialog .admin-review-pair{padding:16px 0;border-color:var(--form-border);gap:24px}
#import-organization-dialog .admin-review-pair dt{font:500 13px/1.55 system-ui;color:var(--form-muted)}
#import-organization-dialog .admin-review-pair dd{font:400 14px/1.6 system-ui;color:var(--form-text);overflow-wrap:anywhere}
#import-organization-dialog .admin-review-note{font-size:11px}
#import-organization-dialog .import-organization-footer{background:var(--form-card);padding:14px 28px}
body.high-contrast :is(#sheet-row-editor,#sheet-location-editor,#import-organization-dialog){--form-bg:#111;--form-card:#000;--form-border:#fff;--form-text:#fff;--form-muted:#fff;--form-accent:#ff0;--form-selected:#252525}
body.high-contrast #import-organization-dialog .admin-review-section-nav{background:var(--form-bg)}
@media(max-width:700px){
 :is(#sheet-row-editor,#sheet-location-editor,#import-organization-dialog){width:calc(100vw - 16px);height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}
 :is(#sheet-row-editor,#sheet-location-editor) .location-editor-header{padding:16px 60px 16px 16px}
 :is(#sheet-row-editor,#sheet-location-editor) .location-editor-header h2{font-size:21px}.admin-form-close{top:16px;right:16px}.admin-form-eyebrow{font-size:10px}
 :is(#sheet-row-editor,#sheet-location-editor) .admin-form-layout{display:block;padding:12px;scroll-padding-top:70px}
 .admin-form-nav{position:sticky;z-index:2;top:-12px;flex-direction:row;max-height:none;overflow-x:auto;background:var(--form-bg);padding:8px 0 12px;margin:0 0 12px}.admin-form-nav>p{display:none}.admin-form-nav button{flex:none;max-width:180px;font-size:12px;padding:8px 10px}
 :is(#sheet-row-editor,#sheet-location-editor) .location-editor-section{padding:16px;grid-template-columns:1fr;gap:16px;scroll-margin-top:70px}
 #sheet-row-editor .sheet-row-choices{grid-template-columns:1fr}#sheet-row-editor .sheet-row-structured{grid-template-columns:1fr}#sheet-row-editor .sheet-row-structured>button{grid-column:1;grid-row:auto;justify-self:start;max-width:none}
 .admin-form-save-hint{display:none}:is(#sheet-row-editor,#sheet-location-editor) .location-editor-footer{padding:12px 16px}
 #import-organization-dialog .import-organization-header{padding:16px;gap:12px}#import-organization-dialog .import-organization-header h2{font-size:19px}#import-organization-dialog .import-organization-body{padding:12px}#import-organization-dialog .admin-review-layout{display:block}#import-organization-dialog .admin-review-section{padding:16px}#import-organization-dialog .admin-review-section-nav{position:static;display:flex;margin-bottom:12px}#import-organization-dialog .admin-review-pair{grid-template-columns:1fr;gap:6px}#import-organization-dialog .import-organization-footer{padding:12px 16px}
}
@media(forced-colors:active){:is(#sheet-row-editor,#sheet-location-editor,#import-organization-dialog){--form-bg:Canvas;--form-card:Canvas;--form-border:CanvasText;--form-text:CanvasText;--form-muted:CanvasText;--form-accent:LinkText;--form-selected:Canvas}}
body:has(:is(#sheet-row-editor,#sheet-location-editor)[open]){overflow:hidden}
:is(#sheet-row-editor,#sheet-location-editor) [hidden]{display:none!important}
#sheet-row-editor .location-editor-field[data-field$=".name"]{grid-column:1/-1}
/* Focused selection dialogs share the form system without competing scroll areas. */
dialog.admin-selection-dialog{--form-bg:#f3f6f8;--form-card:#fff;--form-border:#d5e0e7;--form-text:#17384a;--form-muted:#526b79;--form-accent:#007e87;--form-selected:#e5f3f4;width:min(940px,calc(100vw - 40px));max-width:calc(100vw - 40px);max-height:calc(100dvh - 48px);padding:0;overflow:hidden;border:1px solid var(--form-border);border-radius:14px;background:var(--form-card);color:var(--form-text);font:14px/1.5 system-ui;box-shadow:0 24px 80px #092b3b40;box-sizing:border-box}
dialog.admin-selection-dialog[open]{display:flex;flex-direction:column}
dialog.admin-selection-dialog>form{display:flex;flex-direction:column;min-height:0;margin:0;max-height:none;overflow:hidden}
.admin-selection-header{position:relative;flex:none;padding:22px 70px 20px 28px;border-bottom:1px solid var(--form-border);background:var(--form-card)}
.admin-selection-header h2{font:700 24px/1.25 system-ui;color:var(--form-text);margin:0 0 6px}
.admin-selection-header p{margin:0;font-size:13px;color:var(--form-muted);overflow-wrap:anywhere}
.admin-selection-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:24px;background:var(--form-bg)}
.admin-selection-intro{font-size:13px;color:var(--form-muted);margin:0 0 18px;line-height:1.6}
.admin-selection-footer{flex:none;display:flex;justify-content:flex-end;align-items:center;gap:10px;flex-wrap:wrap;padding:16px 24px;border-top:1px solid var(--form-border);background:var(--form-card)}
.admin-selection-footer [role=status]{flex-basis:100%;margin:0;color:var(--form-text);font-size:13px}
.admin-selection-footer [role=status]:empty{display:none}
.admin-selection-dialog .admin-selection-footer button{margin:0;min-height:42px;border-radius:7px;padding:10px 18px;font:600 14px/1.4 system-ui}
.admin-selection-dialog .admin-form-close{min-height:0;margin:0}
.admin-selection-body :is(fieldset,.service-item,.program-population-section){min-width:0;border:1px solid var(--form-border);border-radius:9px;background:var(--form-card);padding:18px;margin:0 0 16px}
.admin-selection-body legend{font:650 15px/1.4 system-ui;color:var(--form-text);padding:0 6px}
.admin-selection-body label:has(>input:is([type=checkbox],[type=radio])){display:flex;align-items:flex-start;gap:10px;min-height:38px;margin:0;padding:9px 10px;border-radius:6px;font:400 14px/1.45 system-ui;cursor:pointer;overflow-wrap:anywhere}
.admin-selection-body label:has(>input:checked){background:var(--form-selected)}
.admin-selection-body input:is([type=checkbox],[type=radio]){flex:none;width:18px;height:18px;min-height:0;margin:1px 0 0;accent-color:var(--form-accent)}
.admin-selection-body :is(input:not([type=checkbox]):not([type=radio]),select,textarea){box-sizing:border-box;max-width:100%;background:var(--form-card);color:var(--form-text);border:1px solid #9fb3c0;border-radius:6px;padding:10px 12px;font:400 14px/1.5 system-ui}
.admin-selection-body textarea{width:100%;min-height:90px}
.admin-selection-dialog :is(input,select,textarea,button,a):focus-visible{outline:3px solid #d6a82c;outline-offset:2px}
.admin-selection-body .freedom-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}
.admin-selection-body .freedom-fields fieldset{margin:0;padding:16px}
.admin-selection-body .freedom-fields legend{padding:0;max-width:100%}
.admin-selection-body .freedom-fields legend label{font-weight:700}
.admin-selection-body .service-picker{padding:20px}
.admin-selection-body .service-option-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.admin-selection-body .service-item{margin:0;padding:10px}
.admin-selection-body .service-item>.check-row{font-weight:650}
.admin-selection-body .service-suboptions{margin:8px 0 0 16px;padding:0 0 0 10px;border-left:2px solid var(--form-border)}
.admin-selection-body .service-suboptions label{font-size:13px}
.admin-selection-body .help-text{font-size:13px;color:var(--form-muted);line-height:1.6}
.admin-selection-dialog [hidden]{display:none!important}
body:has(.admin-selection-dialog[open]){overflow:hidden}
body.high-contrast .admin-selection-dialog{--form-bg:#111;--form-card:#000;--form-border:#fff;--form-text:#fff;--form-muted:#fff;--form-accent:#ff0;--form-selected:#252525}
@media(max-width:700px){dialog.admin-selection-dialog{width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}.admin-selection-header{padding:16px 60px 16px 16px}.admin-selection-header h2{font-size:21px}.admin-selection-body{padding:14px}.admin-selection-body .freedom-fields,.admin-selection-body .service-option-grid{grid-template-columns:1fr}.admin-selection-footer{padding:12px 16px}.admin-selection-footer>button{flex:1}.admin-selection-body .service-picker{padding:12px}.admin-selection-body .service-suboptions{margin-left:6px}}
@media(forced-colors:active){.admin-selection-dialog{--form-bg:Canvas;--form-card:Canvas;--form-border:CanvasText;--form-text:CanvasText;--form-muted:CanvasText;--form-accent:LinkText;--form-selected:Canvas}}
:is(#sheet-selection-editor,#freedom-classification-editor){width:min(940px,calc(100vw - 40px));max-width:calc(100vw - 40px);height:calc(100dvh - 48px);max-height:calc(100dvh - 48px)}
#freedom-classification-editor>form{flex:1;min-height:0}
@media(max-width:700px){:is(#sheet-selection-editor,#freedom-classification-editor){width:calc(100vw - 16px);max-width:calc(100vw - 16px);height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}}
#freedom-classification-editor .freedom-fields fieldset{margin:0!important;padding:16px}
#freedom-classification-editor .freedom-fields label{margin:0!important}
#freedom-classification-editor .freedom-fields legend{margin:0 0 6px;padding:0;float:none}
#sheet-selection-editor .admin-selection-body label{margin:0}
#sheet-selection-editor .service-item .check-row{border:0;box-shadow:none}
