/* Shared visual system. Layout/interaction rules stay in styles.css and growth.css.
   ui-page-head, ui-segmented, ui-card, ui-inset, ui-metrics and ui-action own
   the appearance of shared page components. Do not add per-page color overrides. */
:root {
 --ui-page-max:1120px; --ui-gutter:16px; --ui-gap:16px; --ui-pad:16px;
 --ui-surface:var(--card); --ui-inset:rgba(255,255,255,.035);
 --ui-border:var(--line); --ui-radius:8px; --ui-title:16px;
 --ui-control-height:36px; --ui-accent:var(--blue);
}
@media(max-width:600px){:root{--ui-gutter:12px;--ui-gap:12px;--ui-pad:12px}}
/* Same content rail on all six destinations; the home grid and clock remain intact. */
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot){width:100%;max-width:var(--ui-page-max);margin:0 auto;padding-left:var(--ui-gutter);padding-right:var(--ui-gutter);padding-top:12px;gap:var(--ui-gap)}
body.growth-ready.gx-legacy:not(.simple-theme) #app{display:block;height:auto;min-height:calc(100dvh - 130px);overflow:visible;padding-bottom:150px}
body.growth-ready:not(.simple-theme) #growthRoot{padding-bottom:150px}
body.growth-ready:not(.simple-theme) #mobileCloudLogin{width:calc(100% - 2 * var(--ui-gutter));max-width:calc(var(--ui-page-max) - 2 * var(--ui-gutter));margin:8px auto 0}
body.growth-ready:not(.simple-theme) :is(#historyView,#vaccineView){border:0;background:transparent;box-shadow:none;border-radius:0;overflow:visible}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-page-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:var(--ui-pad);margin:0 0 var(--ui-gap);border:1px solid var(--ui-border);border-radius:var(--ui-radius);background:var(--ui-surface);box-shadow:none;min-width:0}
body.growth-ready:not(.simple-theme) .ui-page-head h2{font-size:var(--ui-title);font-weight:750;line-height:1.5;margin:0;color:var(--ink)}
body.growth-ready:not(.simple-theme) .ui-page-head p{font-size:12px;line-height:1.5;color:var(--muted);margin:4px 0 0}
body.growth-ready:not(.simple-theme) .ui-page-head :is(.history-actions,.history-switch-group){display:flex;flex-wrap:wrap;gap:8px;min-width:0;max-width:100%;justify-content:flex-start}
.history-growth-switch:empty{display:none}
/* One segmented control, adapted from the original history view. */
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-segmented{display:flex;flex-wrap:wrap;gap:4px;padding:4px;min-height:40px;margin:0;border:1px solid var(--ui-border);border-radius:22px;background:var(--ui-inset);overflow:visible;max-width:100%;width:fit-content}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-segmented button{height:32px;min-height:32px;width:auto;flex:0 0 auto;white-space:nowrap;padding:0 12px;border:0;border-radius:18px;background:transparent;color:var(--muted);font-size:12px;font-weight:700;line-height:1.4;box-shadow:none}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-segmented button.active{background:var(--ink);color:var(--bg)}
/* Primary modules and their inner data areas use only two surface levels. */
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-card{min-width:0;padding:var(--ui-pad);margin:0 0 var(--ui-gap);background:var(--ui-surface);border:1px solid var(--ui-border);border-radius:var(--ui-radius);box-shadow:none}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-inset{background:var(--ui-inset);border:0;border-radius:var(--ui-radius);box-shadow:none;padding:12px}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px;margin:12px 0}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-metrics>div{padding:0;border:0;min-width:0}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-metrics strong{font-size:22px;font-weight:750;line-height:1.4;color:var(--ink);margin-top:4px;font-variant-numeric:tabular-nums}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-metrics :is(small,span){font-size:12px;line-height:1.5;color:var(--muted)}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-card :is(h2,h3){font-size:15px;font-weight:700;line-height:1.5;color:var(--ink);margin:0 0 12px}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-card .gx-actions :is(h2,h3){margin:0}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-list-item{background:var(--ui-inset)!important;border:0!important;border-bottom:1px solid var(--ui-border)!important;border-radius:var(--ui-radius)!important;box-shadow:none;color:var(--ink)}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .gx-actions{gap:8px;margin:0 0 12px}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-action{display:inline-flex;align-items:center;justify-content:center;min-height:var(--ui-control-height);height:auto;padding:8px 12px;border:1px solid rgba(111,166,216,.32);border-radius:var(--ui-radius);background:rgba(111,166,216,.10);color:#b3d6f5;font-size:12px;font-weight:700;line-height:1.5;white-space:nowrap;box-shadow:none}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-action:focus-visible,body.growth-ready .ui-segmented button:focus-visible{outline:2px solid var(--ui-accent);outline-offset:2px}
/* Legacy host adapters: geometry only, all surfaces use the same tokens. */
body.growth-ready:not(.simple-theme) :is(.history-list,.history-chart,.history-timeline,.vaccine-content){padding:0;background:transparent;overflow:visible}
body.growth-ready:not(.simple-theme) :is(#healthRecordsContent,#healthVaccineContent){padding:0;background:transparent;min-width:0}
body.growth-ready:not(.simple-theme) .vaccine-head{background:var(--ui-surface);border:1px solid var(--ui-border);border-radius:var(--ui-radius);padding:var(--ui-pad);margin-bottom:var(--ui-gap);gap:12px;flex-wrap:wrap}
body.growth-ready:not(.simple-theme) .stats-grid{gap:var(--ui-gap)}
body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-group{padding:0;border:0;background:transparent;box-shadow:none}
body.growth-ready:not(.simple-theme) .tile.meal{background:var(--ui-surface);border-color:var(--ui-border);border-radius:var(--ui-radius)}
@media(max-width:600px){
 body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
 body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .growth-latest-card{grid-template-columns:repeat(3,minmax(0,1fr))}
 body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-metrics strong{font-size:20px}
 body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-page-head{align-items:flex-start;flex-direction:column}
 body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-segmented button{padding:0 10px}
}
@media(max-width:360px){
 body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-segmented:has(button:nth-child(4)){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
 body.growth-ready:not(.simple-theme) :is(#app,#growthRoot) .ui-metrics strong{font-size:18px}
}

/* Shared multiline fields: old record notes and newer forms use the same input skin. */
:is(.modal,.gx-dialog-content) textarea {
 display:block;width:100%;max-width:100%;min-width:0;min-height:80px;
 box-sizing:border-box;padding:10px 12px;resize:vertical;
 border:1px solid var(--line);border-radius:var(--ui-radius);
 background:var(--card-2);color:var(--ink);font:inherit;font-size:14px;
 font-weight:400;line-height:1.5;outline:none;color-scheme:dark;
}
:is(.modal,.gx-dialog-content) textarea::placeholder{color:var(--muted);opacity:.75}
:is(.modal,.gx-dialog-content) textarea:focus{border-color:var(--green-2);box-shadow:0 0 0 3px rgba(29,185,84,.18)}
@media(max-width:600px){:is(.modal,.gx-dialog-content) textarea{font-size:16px}}
/* Native date/time controls must shrink inside every legacy and growth form, including WebKit. */
input:is([type="datetime-local"],[type="date"],[type="time"]){display:block;width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important;padding-left:12px;padding-right:12px;overflow:hidden}
:is(.field,.gx-field,.edit-field,.vaccine-form-grid,.gx-inline,.gx-range,.modal,.gx-dialog-content){min-width:0;max-width:100%;box-sizing:border-box}
input:is([type="datetime-local"],[type="date"],[type="time"])::-webkit-date-and-time-value{min-width:0;text-align:left}
input:is([type="datetime-local"],[type="date"],[type="time"])::-webkit-datetime-edit{min-width:0;padding:0}
.theme2-routine-options{display:flex;flex-wrap:wrap;gap:4px 16px}
/* Keep the clock's geometry and ticking text; crossfade only its two content layers. */
#clock{position:relative}
#clockTime{display:block;transition:opacity .22s ease .2s}
#routineReminder{display:none}
body.simple-theme #routineReminder{position:absolute;inset:-.1em 0;display:flex;align-items:center;justify-content:center;overflow:hidden;opacity:0;pointer-events:none;transition:opacity .22s ease;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:inherit;font-weight:inherit;line-height:1.1;text-shadow:none}
#routineReminderText{display:block;flex:none;white-space:nowrap;max-width:none}
body.simple-theme #clock.routine-reminder-on #clockTime{opacity:0;transition-delay:0s}
body.simple-theme #clock.routine-reminder-on #routineReminder{opacity:1;transition-delay:.2s}
body.simple-theme #routineReminder.is-long{justify-content:flex-start}
body.simple-theme #clock.routine-reminder-on #routineReminder.is-long #routineReminderText{animation:routine-reminder-scroll var(--reminder-duration,18s) linear var(--reminder-delay,1s) both}
@keyframes routine-reminder-scroll{from{transform:translateX(0)}to{transform:translateX(var(--reminder-travel,0px))}}
body.simple-theme.routine-reminder-active .simple-vaccine-reminder span{animation:none;transform:none;padding-left:0;min-width:0;overflow:hidden;text-overflow:ellipsis}
body.simple-theme.routine-reminder-active .simple-vaccine-reminder{box-shadow:none;opacity:.75}
body.simple-theme .tablet-care-item{color:#d0d8d2;background:rgba(255,255,255,.045)}
body.simple-theme .tablet-care-item.is-recorded{color:#92a799;border-color:var(--line);background:transparent;opacity:.65}
@media(prefers-reduced-motion:reduce){#clockTime,body.simple-theme #routineReminder{transition:none}body.simple-theme #clock.routine-reminder-on #routineReminder.is-long #routineReminderText{animation:none;white-space:nowrap;font-size:inherit}body.simple-theme #routineReminder{overflow:auto;pointer-events:auto}}

@media(max-width:600px){input:is([type="datetime-local"],[type="date"],[type="time"]){font-size:16px}}
input:is([type="datetime-local"],[type="date"],[type="time"])::-webkit-datetime-edit-fields-wrapper{min-width:0;max-width:100%;padding:0}

/* One persistent sleep shortcut before all ordinary page containers. */
#globalSleepSlot{width:100%;max-width:var(--ui-page-max);margin:0 auto;padding:12px var(--ui-gutter) 14px;box-sizing:border-box}
#globalSleepSlot[hidden]{display:none!important}
.global-sleep-bar{display:block;width:100%;min-height:44px;padding:10px 12px;border:1px solid var(--ui-border);border-radius:var(--ui-radius);background:#383149;color:#d5c6ff;text-align:left;font-size:13px;line-height:1.5;cursor:pointer}
.global-sleep-bar:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
body.growth-ready.has-global-sleep:not(.simple-theme) :is(#app,#growthRoot){padding-top:0}
