/* One stable frame for settings, account tools, administration and reporting.
   Feature controllers still own their fields and permission checks. */
.modal-backdrop.settings-surface {
  padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
  place-items:center; overflow:hidden;
}
.modal-backdrop.settings-surface > .modal {
  width:min(760px,100%); max-width:760px !important;
  height:calc(100dvh - max(20px,env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  max-height:calc(100dvh - max(20px,env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  min-height:0; margin:0; border:1px solid var(--line); border-radius:16px;
  overflow:hidden; background:var(--surface); color:var(--ink);
}
.modal-backdrop.settings-surface > .modal > .modal-head {
  flex:none; min-height:64px; height:64px; padding:10px 16px; gap:8px;
  display:flex; align-items:center; background:var(--surface); color:var(--ink);
  border-bottom:1px solid var(--line);
}
.modal-backdrop.settings-surface .modal-head h2 { margin:0; font-size:21px; line-height:1.2; font-weight:650; }
.modal-backdrop.settings-surface .modal-head [data-icon-close] { margin-left:auto; width:44px; min-height:44px; border:0; padding:0; font-size:25px; background:transparent; color:var(--primary-dark); box-shadow:none; }
.modal-backdrop.settings-surface > .modal > .modal-body { flex:1; min-height:0; overflow:auto; padding:18px; }
#preferencesModal .preferences-layout { display:flex; flex-direction:column; min-height:0; flex:1; }
#preferencesModal .preferences-content { padding:0 18px 18px; min-width:0; min-height:0; overflow:auto; overscroll-behavior:contain; }
#preferencesModal .preferences-section { display:grid; align-content:start; gap:20px; }
#preferencesModal .settings-group h3,.settings-preference-group h3,#preferencesModal #profileExpirationHeading { margin:0 0 6px; color:var(--muted); font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
#preferencesModal .settings-row { min-height:48px; padding:10px 0; font-size:15px; }
#preferencesModal .settings-row svg { width:20px; height:20px; }
.settings-inline { display:flex; align-items:center; justify-content:space-between; gap:14px; min-height:48px; font-size:15px; }
#preferencesAppearanceSection { padding-top:16px; }
#preferencesModal .preferences-theme-options { display:flex; flex:none; gap:0; border:1px solid var(--line-strong); border-radius:9px; overflow:hidden; }
#preferencesModal .preferences-theme-options button { display:block; min-height:40px; padding:8px 16px; border:0; border-radius:0; font-size:14px; background:var(--surface); color:var(--ink); }
#preferencesModal .preferences-theme-options button[aria-pressed="true"] { background:var(--primary); color:var(--surface); }
#preferencesModal .settings-preference-group,#preferencesModal .expiration-preferences { border-top:1px solid var(--line); padding:16px 0 0; }
#preferencesModal .expiration-preferences { display:grid; gap:10px; }
#preferencesModal .expiration-preferences .pref-icon { display:none; }
#preferencesModal .pref-fields { display:grid; grid-template-columns:1fr; gap:10px; padding:0; }
#preferencesModal .pref-field { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:15px; }
#preferencesModal .pref-field select { width:140px; min-height:40px; padding:8px 10px; font-size:16px; }
#preferencesModal #saveExpirationPreferences { justify-self:end; min-height:40px; padding:8px 12px; font-size:14px; }
#preferencesModal #pushNotificationsBtn { width:auto; max-width:180px; min-height:40px; padding:8px 12px; font-size:14px; }
.settings-help { margin:8px 0 0; color:var(--muted); font-size:13px; line-height:1.5; }
.settings-confidence { display:flex; align-items:center; gap:6px; }
#settingsImportConfidence { width:82px; min-height:40px; padding:8px; font-size:16px; }
#settingsImportStatus:empty,#expirationPreferencesStatus:empty { display:none; }
#preferencesModal .settings-identity { padding:18px 0 4px; }
#preferencesModal .settings-identity .account-avatar { --avatar-size:40px; width:40px; height:40px; }
#preferencesModal .settings-identity strong { font-size:16px; }
#profileModal.settings-surface .pref-content { padding:18px; }
#profileModal.settings-surface .pref-header { background:var(--surface); }
.report-workspace-actions { flex:none; padding:10px 18px; border-bottom:1px solid var(--line); }
.report-workspace-actions:not(:has(button:not([hidden]))) { display:none; }
.report-workspace-actions button { display:flex; align-items:center; gap:8px; min-height:40px; padding:8px 12px; font-size:14px; }
.report-workspace-actions svg { width:18px; height:18px; }
#managementImpactModal.settings-surface .management-impact-body { padding:0; display:block; }
#tabStrip > [data-district-tool] { display:flex; align-items:center; gap:7px; }
#tabStrip > [data-district-tool] svg { width:18px; height:18px; }
@media (max-width:360px) { #preferencesModal .preferences-content { padding:0 14px 14px; } #preferencesModal .preferences-theme-options button { padding:8px 12px; } }
.settings-identity { display:flex; align-items:center; gap:14px; padding:20px 0 8px; min-width:0; }
.settings-identity > div { display:grid; gap:4px; min-width:0; }
.settings-identity strong { color:var(--ink); font-size:17px; }
.settings-identity span:not(.account-avatar) { color:var(--muted); font-size:13px; overflow-wrap:anywhere; }
.settings-identity .account-avatar { --avatar-size:48px; width:48px; height:48px; flex:none; }
.settings-list { display:grid; gap:0; }
.settings-row { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:54px; padding:14px 0; border:0; border-bottom:1px solid var(--line); border-radius:0; background:transparent; box-shadow:none; color:var(--ink); text-align:left; font-size:16px; font-weight:550; white-space:normal; }
.settings-row > span:first-of-type { flex:1; }
.settings-row > span:last-child[aria-hidden] { color:var(--muted); font-size:24px; font-weight:400; }
.settings-row svg { width:23px; height:23px; flex:none; fill:none; stroke:var(--primary-dark); stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
@media (hover:hover) and (pointer:fine) { .settings-row:hover { background:var(--surface-2); box-shadow:none; transform:none; } }
.settings-row:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.settings-row.settings-signout { margin-top:6px; color:var(--danger); border-bottom:0; border-top:0; }
.settings-scope { margin:20px 0 0; color:var(--muted); font-size:13px; }
.settings-field { display:grid; gap:12px; color:var(--ink); font-size:16px; }
.settings-field input { width:90px; font-size:16px; }
@media (hover:hover) and (pointer:fine) { .settings-back:hover { background:var(--surface-2); transform:none; box-shadow:none; } }
#spaceSettingsModal .modal-body { gap:20px; }
.settings-group { display:grid; gap:0; }
.settings-group h3 { margin:0; padding:0 0 6px; color:var(--muted); font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.settings-group:not(:has(button:not([hidden]))) { display:none; }
#spaceSettingsModal .space-settings-list { display:grid; gap:0; }
#spaceSettingsModal .space-settings-row { min-height:52px; padding:0; }
#spaceSettingsModal .space-settings-row button { min-height:52px; font-size:15px; }
#spaceSettingsModal .space-settings-name { padding:8px 0 12px; }
#spaceSettingsModal .settings-row { min-height:52px; font-size:15px; }
#spaceSettingsModal .space-settings-row:not(:has(button:not([hidden]))) { display:none; }
#spaceSettingsModal .space-settings-name:not(:has(button:not(:disabled))) { display:none; }
#spaceSettingsModal .space-settings-danger { margin-top:0; border-top:1px solid var(--line); }
#panel-stock .stock-space-actions > #openSpaceSettingsBtn { flex:0 0 48px; width:48px; min-height:48px; }
#panel-stock .stock-space-title { font-size:clamp(24px,6vw,36px); }
#panel-stock .stock-space-identity > .eyebrow { margin:0 0 8px; font-size:12px; }
.district-tools-nav:not(:has(button:not([hidden]))) { display:none; }
.district-tools-nav { border-top:1px solid var(--line); }
#tabStrip > [data-district-tool] { background:transparent; border:0; box-shadow:none; color:var(--ink); }
.settings-list > .settings-row:last-child { border-bottom:0; }

/* Shared, full-size navigation affordances; no glyph-based tiny back links. */
#preferencesModal .preferences-modal-title { display:flex; align-items:center; gap:8px; min-width:0; }
.settings-back { display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; min-height:44px; margin:0; padding:10px; border:0; border-radius:8px; color:var(--primary-dark); background:transparent; box-shadow:none; touch-action:manipulation; }
.settings-back svg { width:24px; height:24px; pointer-events:none; }
.modal-head:has(>.settings-back) { align-items:center !important; gap:8px !important; }
.modal-head:has(>.settings-back)>h2 { flex:1; }
#preferencesModal button,#profileModal button,#changePassModal button { touch-action:manipulation; }
.profile-autofill span { display:grid; gap:4px; }
.profile-autofill small { color:var(--muted); font-size:13px; line-height:1.45; font-weight:400; }
#profileSignatureFields { display:grid; gap:12px; }
#profileSignatureFields>button { justify-self:start; }
.password-intro { margin:0 0 8px; color:var(--muted); font-size:15px; line-height:1.5; }
#changePasswordForm { display:grid; gap:20px; }
.password-field { display:grid; gap:8px; font-size:15px; font-weight:600; }
.password-input { display:flex; align-items:center; border:1px solid var(--line-strong); border-radius:9px; background:var(--surface); overflow:hidden; }
.password-input:focus-within { outline:2px solid var(--primary); outline-offset:1px; }
.password-input input { flex:1; width:0; min-width:0; min-height:48px; padding:10px 12px; border:0; background:transparent; outline:none; box-shadow:none; font-size:16px; }
.password-input button { flex:none; width:46px; min-height:46px; border:0; background:transparent; color:var(--muted); padding:12px; box-shadow:none; }
.password-input svg { width:22px; height:22px; pointer-events:none; }
.password-field small { color:var(--muted); font-weight:400; font-size:13px; }
#cpMatchStatus { margin:0; font-size:14px; color:var(--primary-dark); }
#cpMatchStatus:empty { display:none; }
.signature-import-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:8px 0; }
#signatureImageScaleControl { display:flex; align-items:center; gap:10px; font-size:14px; flex:1; min-width:200px; }
#signatureImageScale { flex:1; width:80px; min-height:44px; padding:0; }
#signatureImageScaleValue { min-width:42px; font-variant-numeric:tabular-nums; }


#changePassModal .password-input input { border:0; border-radius:0; outline:0; box-shadow:none; }

@media(orientation:landscape) and (max-height:600px) {
  .signature-import-toolbar { position:absolute; z-index:2; bottom:4px; left:12px; right:12px; padding:3px 8px; margin:0; background:#151b2beF; border-radius:8px; }
  .signature-import-toolbar button { min-height:40px; padding:6px 12px; }
  #signatureImageScaleControl { min-width:180px; }
}

#preferencesModal:not([hidden]):not([data-settings-navigation]) > .modal { animation:appSurfaceOpen var(--motion-pop-duration) both; transform-origin:center; }
.settings-surface[data-settings-navigation] > .modal { animation:none; }
@media (prefers-reduced-motion:reduce) {
  #preferencesModal:not([hidden]):not([data-settings-navigation]) > .modal { animation:none; }
  .mobile-nav-drawer,.notification-menu.runtime-positioned,.account-panel.runtime-positioned,.theme-menu { animation:none; }
}

#preferencesModal .pref-card-heading { background:transparent; padding:0; min-height:24px; }
#preferencesModal .pref-field select { flex:0 0 140px; }
#preferencesModal #pushNotificationsBtn { white-space:normal; }
#sourceUpdatesModal.settings-surface { z-index:125; }
body:has(#sourceUpdatesModal:not([hidden])) #managementImpactModal { visibility:hidden; }
.settings-surface .settings-back { color:var(--primary-dark); }
