/* Shared interaction contract. Nutrition and operation state remain in their services. */
#modal .sheet { max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px); }
#modalBody { min-height:0; overscroll-behavior:contain; scroll-padding-block:64px 24px; }
#modalBody :is(h1,h2) { overflow-wrap:anywhere; padding-inline-end:48px; min-height:44px; }
#modal :is(button,input,select,textarea,summary):focus-visible,
#profileDrawer :is(button,input,select,textarea,summary):focus-visible,
#aiChat :is(button,input,select,textarea,summary):focus-visible {
  outline:3px solid var(--ink); outline-offset:3px;
}
/* Profile and shopping-list fields share the custom picker's single focus ring.
   Scoped importance also resolves Harmony's generic focus rule and legacy halos. */
#profileDrawer #profileForm :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not(.profile-sex-picker-native):focus-visible,
#modal .finance-market-edit-modal :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not(.profile-sex-picker-native):focus-visible {
  border-color:var(--blue)!important;
  outline:2px solid var(--blue)!important;
  outline-offset:2px;
  box-shadow:none!important;
}
/* The birth field needs the same room for its ring as the adjacent gender field. */
#profileDrawer #profileForm .profile-identity-grid > label:has(> #profileBirthDate) { overflow:visible!important; }
/* Reserve the ring plus its offset within the modal's scrolling viewport. */
#modal .finance-market-edit-modal { padding-inline:4px; }
#modal button:disabled { cursor:not-allowed; opacity:.7; box-shadow:none; color:var(--text); background:var(--surface-2); }
#modal button:enabled:active { filter:brightness(.94); }
#modal .sheet-close { min-width:44px; min-height:44px; }
.guide-overlay-close { position:absolute; top:20px; right:20px; z-index:2; width:48px; height:48px; border:1px solid var(--line); border-radius:50%; background:var(--control-surface); color:var(--ink); font-size:24px; }
.guide-overlay-close:focus-visible { outline:3px solid var(--ink); outline-offset:3px; }
#modal .planning-confirmation-actions { gap:12px; flex-wrap:wrap; }
#modal .planning-choice-modal > .soft,
#modal .planning-choice-modal > .primary { margin-block-start:10px; min-height:44px; }
#modal .planning-choice-modal > p { line-height:1.55; }
/* Keep small decision labels readable with the existing light-theme palette. */
:root:is(:not([data-visual-theme]),[data-visual-theme="default"]) :is(
  #modal .planning-choice-modal,
  #modal .planning-confirmation-actions,
  #profileDrawer .profile-save-footer,
  #aiChat .copilot-plan-actions,
  #aiChat .adjustment-consent
) button.primary:enabled { background:var(--blue-deep); color:var(--surface); }
@media (max-width:480px) {
  #modal .planning-confirmation-actions > button { flex:1 1 140px; white-space:normal; }
}
@media (prefers-reduced-motion:reduce) {
  #modal *, #profileDrawer *, #aiChat * { scroll-behavior:auto; }
}
#modal.weight-check-sheet .sheet-close { display:grid!important; }
#modal .weight-change-actions { display:flex; flex-wrap:wrap; gap:10px; }
#modal .weight-change-actions > button { flex:1 1 140px; min-height:44px; white-space:normal; }
#modal #weightCheckinError { color:var(--ink); border-inline-start:3px solid currentColor; padding-inline-start:10px; }
/* Dark payment heroes use a dark surface, not the light primary-button surface. */
:root:is([data-visual-theme="dark"],[data-visual-theme="osyra"]) #modal .premium-hero :is(h2,p,.premium-badge) {
  color:var(--pay-ink)!important;
}
/* Keep the Google label paired with its button's final background/text palette. */
:root:is([data-visual-theme="dark"],[data-visual-theme="osyra"]) #modal .purchase-auth-actions .social span:not(.social-icon) {
  color:inherit!important;
}
/* Today review: one decision, readable before/after and reachable exit. */
#modal .today-review-modal :is(p,li,h3,section) { color:var(--ink); overflow-wrap:anywhere; }
#modal .today-review-modal button, #modal .today-review-return button { min-height:44px; white-space:normal; }
#modal .today-review-modal .storage-confirm-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
#modal .today-review-modal .storage-confirm-actions button { flex:1 1 150px; }
#modal .today-review-changes { display:grid; gap:12px; margin-block:16px; }
#modal .today-review-changes article, #modal .today-review-missing li { padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); }
#modal .today-review-changes h3 { margin:0 0 8px; font-size:16px; }
#modal .today-review-changes article>div { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
#modal .today-review-changes p { margin:6px 0 0; font-size:13px; line-height:1.5; }
#modal .today-review-missing { display:grid; list-style:none; padding:0; gap:12px; }
#modal .today-review-impact { display:flex; align-items:flex-start; gap:10px; margin-top:14px; }
#modal .today-review-impact input { flex:none; min-width:24px; min-height:24px; }
#modal .today-review-return { margin-bottom:16px; padding:12px; border:1px solid var(--line); border-radius:12px; color:var(--ink); background:var(--surface-2); }
#modal .today-review-return p { color:var(--ink); font-size:13px; }
