:root{--em-bg:#f7f8f3;--em-panel:#fff;--em-text:#182c25;--em-muted:#52665d;--em-line:#c8d7ce;--em-brand:#165c43;--em-tint:#edf6ee;--em-focus:#9b4800;--em-radius:1rem}
:root[data-theme="dark"],:root.dark{--em-bg:#111e19;--em-panel:#1c2c24;--em-text:#f0f6ed;--em-muted:#b9cbbd;--em-line:#456352;--em-brand:#abdfb6;--em-tint:#263e30;--em-focus:#ffbb77}
.em-page{color-scheme:light;margin:0;background:var(--em-bg);color:var(--em-text);font:1rem/1.6 system-ui,sans-serif;min-height:100vh}
.em-shell{box-sizing:border-box;width:min(100% - 2rem,75rem);margin:0 auto;padding:2rem 0 4rem}
.em-shell h1,.em-shell h2,.em-shell h3{line-height:1.2;overflow-wrap:anywhere}.em-shell h1{font-size:clamp(2rem,5vw,3.5rem);letter-spacing:-.04em}.em-shell h2{font-size:1.5rem}
.em-shell a{color:var(--em-brand);text-underline-offset:.2em}.em-shell p{max-width:70ch}.em-shell small,.em-muted{color:var(--em-muted)}
.em-card{background:var(--em-panel);border:.0625rem solid var(--em-line);border-radius:var(--em-radius);padding:1.5rem;min-width:0;overflow-wrap:anywhere}
.em-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,18rem),1fr));gap:1rem}.em-toolbar{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;margin:1rem 0}
.em-field{display:flex;flex-direction:column;gap:.4rem;min-width:0}.em-shell label{font-weight:600}.em-shell form{max-width:100%}
.em-shell input:not([type="checkbox"]):not([type="radio"]),.em-shell select,.em-shell textarea{box-sizing:border-box;min-height:2.75rem;max-width:100%;width:100%;border:.0625rem solid var(--em-line);border-radius:.5rem;padding:.65rem .8rem;background:var(--em-panel);color:var(--em-text);font:inherit}
.em-shell input[type="checkbox"],.em-shell input[type="radio"]{accent-color:var(--em-brand);width:1.25rem;height:1.25rem}.em-shell label:has(input[type="checkbox"]),.em-shell label:has(input[type="radio"]){display:flex;align-items:center;gap:.6rem;min-height:2.75rem}
.em-button,.em-shell button,.em-help-dialog button{box-sizing:border-box;display:inline-flex;justify-content:center;align-items:center;gap:.5rem;min-height:2.75rem;min-width:2.75rem;padding:.65rem 1rem;border:.0625rem solid var(--em-brand);border-radius:.6rem;background:var(--em-brand);color:var(--em-panel);font:600 1rem/1.4 system-ui,sans-serif;text-decoration:none;cursor:pointer;white-space:normal}
.em-button.secondary,.em-shell button.secondary{background:var(--em-panel);color:var(--em-brand)}.em-shell button:disabled,.em-button[aria-disabled="true"]{opacity:.55;cursor:not-allowed}
.em-note{border-inline-start:.25rem solid var(--em-brand);background:var(--em-tint);padding:1rem;border-radius:.35rem;color:var(--em-text)}.em-status{display:inline-block;padding:.2rem .7rem;border-radius:2rem;background:var(--em-tint);color:var(--em-text);font-size:.875rem;font-weight:600;overflow-wrap:anywhere}
.em-info,.em-shell button[data-meal-help]{border-radius:50%;padding:.4rem;vertical-align:middle;background:transparent;color:var(--em-brand);font-family:Georgia,serif;font-style:italic}
.em-shell :focus-visible,.em-help-dialog :focus-visible{outline:.2rem solid var(--em-focus);outline-offset:.2rem}.em-shell table{width:100%;border-collapse:collapse}.em-shell th,.em-shell td{padding:.75rem;text-align:start;border-bottom:.0625rem solid var(--em-line);overflow-wrap:anywhere}.em-table-scroll{overflow:auto;max-width:100%}
.em-help-dialog{box-sizing:border-box;max-width:min(35rem,calc(100vw - 2rem));max-height:calc(100dvh - 2rem);overflow:auto;border:.0625rem solid var(--em-line);border-radius:1rem;padding:1.5rem;color:var(--em-text);background:var(--em-panel);font:1rem/1.6 system-ui,sans-serif;box-shadow:0 1rem 4rem #0004}.em-help-dialog::backdrop{background:#06150dc4}.em-help-dialog h2{font-size:1.5rem;line-height:1.25;margin-top:0}
@media(max-width:30rem){.em-shell{width:calc(100% - 1rem);padding-top:1rem}.em-card{padding:1rem}.em-toolbar>*{max-width:100%}}
@media(prefers-reduced-motion:reduce){.em-shell *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}

/* Native hidden state must win over button/grid display rules. */
.em-shell [hidden]{display:none!important}
.em-shell>.em-card+.em-card{margin-top:1.25rem}
.em-shell fieldset.em-card{display:grid;gap:1rem;margin:1.25rem 0;padding-top:1rem}
.em-shell fieldset.em-card>button{justify-self:start}
.em-shell fieldset .em-grid{align-items:end}
.em-shell legend{font-weight:700;padding:0 .35rem}
:root[data-theme="dark"] .em-page,:root.dark .em-page{color-scheme:dark}
