/* This stylesheet is loaded only by v2.html. v1's generated CSS is untouched. */
:root { color-scheme: light dark; --ink: #172b36; --muted: #536672; --line: #dde6e8; --green: #087f5b; --green-soft: #e4f4ed; --blue: #2459a6; --blue-soft: #e8f0fc; --amber: #805516; --surface: #f6f8f8;
  /* Theme tokens: fills under white text, cards, fields, photo tiles. */
  --green-strong: #087f5b; --blue-strong: #2459a6; --card: #fff; --bg: #eaf0ee; --hover: #eaf0f1; --field-line: #9cadb3; --photo-bg: #dfe7e7; --focus: #a44612; --now: #b4232a; --toast-link: #9fe8cd; --scrub-bg: rgb(255 255 255 / .96); --overlay-from: rgb(255 255 255 / .95); --overlay-to: rgb(255 255 255 / 0); --toast-bg: #172b36; --sleep-bg: #e2eafa; --sleep-sweep: #d4e2f7; --sleep-gradient: linear-gradient(180deg, #d9e4f8 0%, #e8eefb 60%, #eef2fc 100%); --green-hover: #056448; --warn-bg: #fff3d9; --warn-ink: #65410a; --error-bg: #fff0ee; --error-ink: #9b2922; --error-line: #ecc0bd; }
/* Dark theme follows the OS setting. Product photos are shot on white, so in
   dark mode they are dimmed: white turns into a soft grey tile instead of a
   glaring square, and the tile behind matches that grey while loading. */
@media (prefers-color-scheme: dark) {
  :root { --ink: #e3ecea; --muted: #9fb1b6; --line: #2c3b40; --green: #4fd1a1; --green-soft: #173a30; --blue: #8db4f0; --blue-soft: #1c2d48; --amber: #e0b26a; --surface: #141c1f;
    --green-strong: #087f5b; --blue-strong: #2f68c0; --card: #1d272b; --bg: #0e1416; --hover: #26343a; --field-line: #4a5d63; --photo-bg: #bfc3c2; --focus: #ff9d5c; --now: #ff6b6b; --toast-link: #7ee0bd; --scrub-bg: rgb(29 39 43 / .94); --overlay-from: rgb(17 24 27 / .92); --overlay-to: rgb(17 24 27 / 0); --toast-bg: #2f3f45; --sleep-bg: #1e2a44; --sleep-sweep: #34466b; --sleep-gradient: linear-gradient(180deg, #1b2742 0%, #202c48 60%, #232f4b 100%); --green-hover: #06704f; --warn-bg: #3a2c10; --warn-ink: #f3cf85; --error-bg: #3b1a19; --error-ink: #ff9c92; --error-line: #6b2c28; }
  .plate-photo img, .meal-thumbnail img, .plate-chip img, .product-detail-photo img { filter: brightness(.75); }
  .meal-thumbnail { color: #33413f; }
  .plate-scrub { border-color: var(--line); box-shadow: 0 1px 5px rgb(0 0 0 / .4); }
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 16px/1.4 'GTEestiPro', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; color: inherit; border: 0; background: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button, .button-link { min-height: 44px; }
a { color: var(--green); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
input, select { max-width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--field-line); border-radius: 10px; padding: 8px 10px; color: var(--ink); background: var(--card); }
input[type='number'] { appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
.number { font-variant-numeric: tabular-nums; }
.timeline time { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-variant-numeric: tabular-nums; }
.muted, small { color: var(--muted); }
small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-shell { position: fixed; inset: 0; max-width: 760px; margin: auto; display: flex; flex-direction: column; background: var(--surface); }

/* Compact header: date nav + stats in one row. */
.app-header { flex: none; padding: max(4px, env(safe-area-inset-top)) 8px 6px; border-bottom: 1px solid var(--line); background: var(--card); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.date-row, .sheet-header, .row { display: flex; align-items: center; gap: 6px; }
.icon-button { display: grid; place-items: center; flex: none; width: 40px; min-height: 40px; border-radius: 10px; font-size: 20px; }
.icon-button:hover, .secondary:hover { background: var(--hover); }
.brand-button { flex: none; padding: 0; margin: 0; cursor: pointer; }
.brand-button:focus-visible { outline-offset: 1px; border-radius: 28px; }
.brand-icon { display: block; width: 56px; height: 56px; border-radius: 28px; box-shadow: 0 2px 8px #17312b33; }
.date-title { flex: 1; min-width: 0; text-align: center; position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.date-title h1 { font-size: 20px; line-height: 1.2; }
.date-picker { position: absolute; width: 100%; height: 100%; inset: 0; opacity: 0; cursor: pointer; touch-action: pan-y; pointer-events: none; }
.date-picker.picker-native { opacity: 1; position: static; width: auto; height: auto; pointer-events: auto; }
.date-title:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.stats-chip { flex: none; display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 10px; background: var(--surface); font-size: 14px; min-height: 34px; white-space: nowrap; }
.stats-chip strong { display: inline-block; font-weight: 500; }
.stats-chip .chip-food { min-width: 5ch; }
.stats-chip .chip-sleep { min-width: 4.5ch; }
.chip-arrow { color: var(--muted); }
.chip-icon { width: 20px; height: 20px; vertical-align: -4px; }
/* Bottom notifications: statuses overlay the screen and never shift the timeline. */
.notifications { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(92vw, 560px); display: grid; gap: 8px; z-index: 9; pointer-events: none; }
/* Compact floating finish-sleep button: overlays the timeline bottom, takes no layout space. */
.sleep-bar { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 8; width: max-content; max-width: min(92vw, 560px); padding: 0; border: 0; background: none; pointer-events: none; }
.sleep-finish { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; max-width: 100%; min-height: 44px; padding: 10px 16px; border-radius: 999px; background: color-mix(in srgb, var(--blue-strong) 85%, transparent); color: #fff; font-size: 16px; font-weight: 600; box-shadow: 0 4px 14px #2459a633; pointer-events: auto; white-space: nowrap; }
.sleep-finish:hover { filter: brightness(.94); }
.sleep-finish strong { padding: 2px 8px; border-radius: 8px; background: #ffffff2e; font-weight: 700; }
.notifications.above-sleep { bottom: calc(68px + env(safe-area-inset-bottom)); }
.notifications > * { pointer-events: auto; }
.notification { display: block; width: 100%; margin: 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; text-align: left; box-shadow: 0 4px 18px #0002; }
button.notification { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notification.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notification.error { background: var(--error-bg); color: var(--error-ink); }
.notification.info { background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.notification.action { background: var(--blue-soft); color: var(--blue); }
.notification a { color: inherit; }
/* Inside a modal dialog (top layer): same bottom infobar, above the sheet. */
.sheet-status { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(92vw, 560px); margin: 0; }

.main { overflow-y: auto; overscroll-behavior-y: contain; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.segmented button { padding: 4px 10px; border-radius: 8px; min-height: 32px; font-size: 13px; }
.segmented button[aria-pressed='true'] { background: var(--ink); color: var(--card); }
.secondary { padding: 5px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 13px; min-height: 36px; }

/* Day scale: two lanes, every event visible; pushed markers get a tick. */
.timeline { position: relative; flex: none; margin: 0; isolation: isolate; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
.timeline::before { content: ''; position: absolute; top: 20px; bottom: 20px; left: calc(35% - 26px); width: 52px; background: var(--surface); border-inline: 1px solid var(--line); z-index: 1; pointer-events: none; }
.lane-item { display: contents; }
.event-time { position: absolute; left: 35%; width: 48px; transform: translate(-50%, -50%); background: var(--surface); background: linear-gradient(to bottom, transparent 0%, var(--surface) 30%, var(--surface) 70%, transparent 100%); background: linear-gradient(to bottom, rgb(from var(--surface) r g b / 0) 0%, var(--surface) 30%, var(--surface) 70%, rgb(from var(--surface) r g b / 0) 100%); color: var(--ink); text-align: center; font-size: 12px; line-height: 20px; z-index: 3; pointer-events: none; }
.hour-rule { position: absolute; left: calc(35% - 26px); width: 52px; border-top: 1px solid var(--line); z-index: 2; pointer-events: none; }
.hour-rule span { position: absolute; left: 50%; transform: translate(-50%, -50%); color: #8298a3; color: color-mix(in srgb, var(--muted), var(--card) 25%); background: var(--surface); font: 12px/1.3 ui-monospace, monospace; padding: 2px 4px; z-index: 2; }
.sleep-block { position: absolute; right: calc(65% + 32px); left: 2px; background-color: var(--sleep-bg); background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='%237d9bd1' fill-opacity='.45'><circle cx='12' cy='18' r='1.3'/><circle cx='34' cy='8' r='.9'/><circle cx='52' cy='30' r='1.1'/><circle cx='78' cy='14' r='1.4'/><circle cx='104' cy='26' r='.9'/><circle cx='22' cy='52' r='1'/><circle cx='92' cy='50' r='.8'/><circle cx='110' cy='72' r='1.2'/><circle cx='8' cy='84' r='1'/><circle cx='38' cy='96' r='1.4'/><circle cx='70' cy='88' r='.9'/><circle cx='98' cy='104' r='1.1'/><circle cx='56' cy='112' r='1'/><circle cx='20' cy='110' r='.8'/><circle cx='114' cy='40' r='1'/></g><g fill='%238aa5d3' fill-opacity='.55'><g transform='translate(46 70)'><path d='M0 -6Q1.6 -1.6 6 0Q1.6 1.6 0 6Q-1.6 1.6-6 0Q-1.6-1.6 0-6Z'/></g><g transform='translate(88 96) scale(.7)'><path d='M0 -6Q1.6 -1.6 6 0Q1.6 1.6 0 6Q-1.6 1.6-6 0Q-1.6-1.6 0-6Z'/></g><g transform='translate(28 36) scale(.55)'><path d='M0 -6Q1.6 -1.6 6 0Q1.6 1.6 0 6Q-1.6 1.6-6 0Q-1.6-1.6 0-6Z'/></g></g><g transform='translate(66 20) scale(.8)'><path d='M0 -6Q1.6 -1.6 6 0Q1.6 1.6 0 6Q-1.6 1.6-6 0Q-1.6-1.6 0-6Z' fill='%23d8a43c' fill-opacity='.5'/></g></svg>"), url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='83' height='83' viewBox='0 0 83 83'><g fill='%239db4dd' fill-opacity='.45'><circle cx='10' cy='12' r='1'/><circle cx='40' cy='6' r='.8'/><circle cx='66' cy='20' r='1.1'/><circle cx='24' cy='38' r='.9'/><circle cx='52' cy='44' r='1.2'/><circle cx='74' cy='58' r='.8'/><circle cx='12' cy='64' r='1.1'/><circle cx='38' cy='74' r='.9'/><circle cx='62' cy='72' r='1'/></g></svg>"), var(--sleep-gradient); background-repeat: repeat; background-position: 0 0, 30px 41px, 0 0; background-size: 84px 84px, 58px 58px, 100% 100%; border: 0; border-radius: 9px; }
.event-marker { position: absolute; height: 40px; min-height: 40px; width: calc(65% - 44px); padding: 2px 4px; display: flex; justify-content: center; align-items: center; gap: 5px; z-index: 3; white-space: nowrap; }
.event-marker.feed { left: calc(35% + 42px); color: var(--green); flex-direction: column; align-items: stretch; justify-content: flex-start; text-align: left; gap: 0; }
.event-heading { display: flex; flex: none; justify-content: flex-start; align-items: center; gap: 3px; height: 26px; margin-top: 6px; white-space: nowrap; background: var(--card); width: fit-content; max-width: 100%; padding: 0 4px; border-radius: 6px; }
.event-heading > span:last-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; order: -1; font-size: 16px; line-height: 1.2; }
.meal-thumbnails { display: flex; align-items: center; gap: 3px; flex: none; height: 20px; }
.meal-thumbnail { position: relative; flex: none; width: 20px; height: 20px; border: 0; border-radius: 5px; overflow: hidden; background: var(--photo-bg); color: var(--muted); font-size: 13px; line-height: 20px; text-align: center; }
.meal-thumbnail img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.event-components { display: block; white-space: nowrap; overflow: hidden; font-size: 14px; line-height: 16px; color: var(--muted); cursor: grab; background: var(--card); width: fit-content; max-width: 100%; padding: 0 4px; border-radius: 6px; align-self: flex-start; }
.event-components.faded { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 26px), transparent); }
.event-marker.other { right: calc(65% + 42px); width: auto; color: var(--amber); }
.event-marker.sleep { right: calc(65% + 32px); width: auto; min-height: 2px; padding: 0 4px; color: var(--blue); z-index: 2; }
.event-marker.sleep .event-label { overflow: visible; white-space: nowrap; text-align: center; font-size: 13px; background: var(--card); padding: 0 4px; border-radius: 6px; line-height: 1.35; }
.sleep-block.active .event-label { display: inline-block; background: linear-gradient(to right, var(--card) 20%, var(--sleep-sweep) 40%, var(--card) 60%); background-size: 200% 100%; animation: sleep-label-sweep 1.6s ease-in-out infinite; }
@keyframes sleep-label-sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sleep-block.active .event-label { animation: none; background: var(--card); } }
.awake-block { position: absolute; right: calc(65% + 32px); left: 2px; display: flex; align-items: center; justify-content: center; pointer-events: none; color: var(--muted); font-size: 14px; text-align: center; z-index: 2; }
.awake-block span { background: var(--surface); padding: 0 2px; white-space: nowrap; }
.event-marker.feed::before, .event-marker.other::before { content: ''; position: absolute; top: 20px; width: 17px; border-top: 1px solid currentColor; }
.event-marker.feed::before { left: -17px; }
.event-marker.other::before { right: -17px; }
.event-dot { position: absolute; width: 6px; height: 6px; border-radius: 50%; transform: translateY(-50%); z-index: 3; pointer-events: none; }
.event-dot.feed { left: calc(35% + 22.5px); background: var(--green); }
.event-dot.other { right: calc(65% + 22.5px); background: var(--amber); }
.event-marker .event-label { font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.event-marker .diaper-icon { width: 24px; height: 24px; }
.event-marker.pending:not(.sleep) .event-heading > span:last-child { text-decoration: underline dashed var(--focus); text-underline-offset: 3px; }
.event-marker.sleep.pending { border: 2px dashed var(--focus); }
.marker-tick { position: absolute; width: 2px; z-index: 3; pointer-events: none; }
.marker-tick.feed { left: calc(35% + 24.5px); background: var(--green); }
.marker-tick.other { right: calc(65% + 24.5px); background: var(--amber); }
.now-line { position: absolute; left: 0; right: 0; height: 0; border-top: 0; z-index: auto; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: 0; right: 0; top: 0; border-top: 1px solid var(--now); z-index: 1; pointer-events: none; }
.now-line span { position: absolute; left: 35%; transform: translate(-50%, -50%); background: var(--card); color: var(--now); border: 1px solid var(--now); padding: 1px 4px; border-radius: 6px; font: 12px/1.2 ui-monospace, monospace; z-index: 4; }

/* Live selection stays above records and offset from the finger. */
.time-preview { position: absolute; left: 0; right: 0; border-top: 2px solid var(--green); z-index: 5; pointer-events: none; }
.time-preview time { position: absolute; left: 35%; transform: translate(-50%, calc(-100% - 12px)); padding: 5px 9px; border-radius: 8px; background: var(--green-strong); color: #fff; font-size: 20px; box-shadow: 0 2px 8px #17312b33; }

/* Start menu after picking a time: dimmed main screen, big icon buttons bottom-right. */
.quick-veil { position: fixed; inset: 0; z-index: 6; background: #122e2b66; }
.quick-icons { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); width: min(100%, 760px); max-height: 34dvh; overflow-y: auto; z-index: 7; display: grid; gap: 8px; padding: 4px 10px; pointer-events: none; }
.quick-time { justify-self: end; margin-right: 6px; padding: 4px 12px; border-radius: 10px; background: var(--card); box-shadow: 0 4px 14px #0003; font-size: 20px; pointer-events: auto; }
.quick-row { display: flex; justify-content: flex-end; gap: 8px; }
.quick-row-single { margin-top: 0; }
.quick-btn { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 61px; min-height: 61px; padding: 6px 8px; border-radius: 14px; background: var(--card); box-shadow: 0 6px 20px #0003; font-size: 24px; line-height: 1; pointer-events: auto; }
.quick-btn img { width: 35px; height: 35px; object-fit: contain; }
.quick-btn strong { font-size: 18px; }
.quick-feed { background: var(--green-soft); color: var(--green); }
@media (max-width: 359px) { .quick-btn { min-width: 51px; min-height: 51px; font-size: 21px; } .quick-btn img { width: 29px; height: 29px; } }

.empty-state { margin: 18px 14px; padding: 20px; border: 1px dashed var(--field-line); border-radius: 14px; color: var(--muted); text-align: center; }
.main .empty-state { font-size: 20px; }
.pending-label { color: var(--amber); font-size: 13px; }
.auth-screen { margin: auto; max-width: 380px; padding: 28px; text-align: center; display: grid; gap: 18px; }
.auth-screen h1 { font-size: 28px; }
.auth-screen .version { padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: var(--muted); vertical-align: middle; }
.auth-screen #g_id_signin { min-height: 44px; display: flex; justify-content: center; }
.toast { display: flex; align-items: center; gap: 12px; width: auto; justify-self: center; max-width: 100%; padding: 8px 12px; border-radius: 12px; background: var(--toast-bg); color: #fff; box-shadow: 0 4px 18px #0002; font-size: 14px; text-align: center; }
.toast button { color: var(--toast-link); font-weight: 500; text-decoration: underline; min-height: 32px; }

dialog { color: var(--ink); background: var(--card); width: min(100%, 640px); max-width: 100%; max-height: 90vh; max-height: 90dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 60px #17312b33; overflow-y: auto; overscroll-behavior: contain; }
dialog::backdrop { background: #122e2b66; }
.sheet-header { position: sticky; top: 0; z-index: 5; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.sheet-heading { outline: none; }
.sheet-body { padding: 16px 18px max(20px, env(safe-area-inset-bottom)); }
.sheet-body form, .form-stack { display: grid; gap: 16px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span, .field > label, .field-label { color: var(--muted); font-size: 13px; }
.time-control { display: flex; gap: 6px; }
.time-control input { width: 100%; }
.time-control button { font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; }
.form-hint { color: var(--muted); font-size: 13px; }
.volume-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.volume-presets button { min-width: 45px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.volume-presets button[aria-pressed='true'] { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.primary { display: block; width: 100%; padding: 12px 16px; min-height: 48px; border-radius: 12px; color: #fff; background: var(--green-strong); font-weight: 500; }
.primary:hover { background: var(--green-hover); }
.secondary { display: inline-block; }
dialog .secondary { min-height: 44px; }
.danger { display: block; width: 100%; padding: 12px 16px; min-height: 48px; border-radius: 12px; color: var(--error-ink); background: var(--error-bg); border: 1px solid var(--error-line); }
.form-error { color: var(--error-ink); background: var(--error-bg); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.products { max-height: 36vh; max-height: 36dvh; min-height: 100px; overflow-y: auto; border-block: 1px solid var(--line); }
.product-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px 60px 36px; align-items: center; gap: 5px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.product-row:last-child { border-bottom: 0; }
.product-name { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.product-row button { border-radius: 9px; background: var(--surface); font-size: 20px; }
.product-row input { width: 60px; padding: 8px 4px; text-align: center; }
/* Plate v2 concept: full-height dialog, two-column photo cards, slider full-width,
   manual input over the photo, footer pinned to the bottom with chosen items. */
dialog.dialog-plate[open] { display: flex; flex-direction: column; width: min(100%, 640px); height: 94dvh; max-height: 94dvh; margin: auto auto 0; overflow: hidden; }
.dialog-plate .sheet-header { flex: none; }
.dialog-plate .sheet-body-plate { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 10px 10px max(12px, env(safe-area-inset-bottom)); overflow: hidden; }
.dialog-plate .compose-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.dialog-plate .compose-fields { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.dialog-plate .compose-fields > .form-stack { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.plate-sheet { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; position: relative; }
.plate-search-wrap { position: relative; flex: none; }
.plate-search-wrap .plate-search { width: 100%; padding-right: 44px; }
.plate-search-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 36px; min-height: 36px; border-radius: 10px; font-size: 22px; line-height: 1; color: var(--muted); background: transparent; }
.plate-search-clear:hover { background: var(--hover); color: var(--ink); }
/* Hide native search clear — only the custom button stays, visible with or without focus. */
.plate-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.plate-search::-ms-clear { display: none; }
.products-plate { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; border: 0; }
.plate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px 0 8px; }
.plate-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--card); scroll-margin-top: 8px; }
.plate-card.active { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.plate-photo { position: relative; aspect-ratio: 1 / 1; background: var(--photo-bg); overflow: hidden; }
.plate-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.plate-info { display: block; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; text-align: left; cursor: pointer; touch-action: manipulation; }
.plate-info img { pointer-events: none; }
.plate-overlay { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 1px; padding: 24px 90px 7px 8px; background: linear-gradient(to top, var(--overlay-from), var(--overlay-to)); color: var(--ink); pointer-events: none; }
.plate-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; font-weight: 600; line-height: 1.2; }
.plate-overlay small { color: var(--muted); opacity: 1; font-size: 12px; }
/* Unified volume control: press-and-hold in the photo input, scrub left/right
   across the full screen width; quick tap opens inline manual entry.
   Fill grows with volume; text inverts where the fill passes under it. */
.plate-scrub { position: absolute; right: 6px; bottom: 6px; display: flex; align-items: center; justify-content: center; min-width: 76px; min-height: 35px; padding: 4px 12px; border-radius: 12px; border: 1px solid rgb(23 43 54 / .22); overflow: hidden; background: var(--scrub-bg); box-shadow: 0 1px 5px rgb(23 43 54 / .22); color: var(--ink); font-weight: 700; cursor: ew-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
.plate-scrub[data-active='false'] { opacity: .78; }
.plate-scrub[data-active='false']:focus, .plate-scrub[data-active='false']:focus-within { opacity: 1; }
.plate-scrub-text { position: relative; z-index: 1; }
.plate-scrub-text-fill { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: inherit; color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / .45); background: var(--green-strong); clip-path: inset(0 calc(100% - var(--fill, 0%)) 0 0); pointer-events: none; }
.plate-scrub-edit { position: relative; z-index: 3; width: 72px; min-height: 0; margin: 0; padding: 2px 4px; border: 1px solid var(--green); border-radius: 8px; background: var(--card); text-align: center; font-weight: 700; touch-action: auto; }
.plate-scrub:focus-visible { outline-offset: 1px; }
.plate-footer { flex: none; position: sticky; bottom: 0; display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); background: var(--card); }
.plate-chosen { display: flex; flex-wrap: wrap; gap: 6px; max-height: 19dvh; overflow-y: auto; }
.plate-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; max-width: 100%; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; text-align: left; }
.plate-chip img { width: 30px; height: 30px; flex: none; border-radius: 8px; object-fit: cover; background: var(--photo-bg); }
.plate-chip-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.plate-chip-vol { flex: none; font-weight: 700; color: var(--green); }
/* Full product info (v1 productTooltip): full photo, specs, badges, note. */
.product-detail { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgb(18 46 43 / .55); }
.product-detail-card { width: min(calc(100vw - 48px), 360px); max-height: calc(100dvh - 48px); overflow-y: auto; border-radius: 14px; background: var(--card); box-shadow: 0 10px 40px rgb(23 43 54 / .3); }
.product-detail-photo { aspect-ratio: 16 / 9; background: var(--photo-bg); overflow: hidden; border-radius: 14px 14px 0 0; }
.product-detail-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-detail-body { display: grid; gap: 10px; padding: 14px; }
.product-detail-kicker { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.product-detail-body h3 { font-size: 18px; line-height: 1.25; }
.product-detail-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.product-detail-specs div { padding: 8px; border-radius: 10px; background: var(--surface); }
.product-detail-specs dt { font-size: 12px; color: var(--muted); }
.product-detail-specs dd { margin: 4px 0 0; font-size: 16px; font-weight: 600; }
.product-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.product-detail-badges span { padding: 3px 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); }
.product-detail-note { font-size: 14px; }
.record-view { gap: 12px; }
.record-main { margin-top: 2px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.record-components { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.record-components li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; }
.record-view .pending-label { margin-top: 8px; }
.record-actions { display: flex; gap: 8px; }
.record-actions .primary, .record-actions .danger { flex: 1; width: auto; min-height: 44px; padding: 10px 12px; }
.stats-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.stats-summary div { padding: 10px 6px; border-radius: 12px; background: var(--surface); text-align: center; }
.stats-summary dt { font-size: 12px; color: var(--muted); }
.stats-summary dd { margin: 5px 0 0; font-size: 18px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.stats-table th, .stats-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table th { color: var(--muted); font-weight: 400; font-size: 12px; }
.stats-table td button { padding: 0; min-height: 32px; text-align: left; color: var(--green); font-size: 14px; }
.queue-list { display: grid; gap: 12px; margin: 14px 0; }
.queue-item { padding: 12px; border: 1px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.menu-list { display: grid; gap: 8px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 16px; text-decoration: none; }
.queue-item p { font-size: 14px; margin: 6px 0; }
@media (min-width: 600px) { .app-header { padding-inline: 16px; } dialog { margin-bottom: 20px; border-radius: 22px; } }
@media (max-width: 359px) { .sheet-body { padding-inline: 12px; } .time-control { flex-wrap: wrap; } .time-control button { width: 100%; } .event-heading > span:last-child { font-size: 14px; } .stats-chip { gap: 6px; padding-inline: 6px; } }
@media (max-height: 500px) { .stats-chip { min-height: 30px; padding-block: 2px; } dialog { max-height: 96dvh; } }
@media (prefers-reduced-motion: no-preference) {
  /* Barely-visible color transitions for every interactive state change. */
  button, a, input, select, .menu-item, .stats-chip, .icon-button, .sleep-finish, .quick-btn, .volume-presets button, .product-row button, .segmented button, .secondary, .primary, .danger { transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease, opacity .14s ease, filter .14s ease; }
  button:not(:disabled):active { filter: brightness(.94); }
  /* Enter-only fades: x-show toggles display instantly on hide, so only
     showing animates. Opacity never shifts geometry asserted by e2e. */
  .event-marker:not(.active), .hour-rule, .event-time, .event-dot, .marker-tick, .awake-block, .now-line, .time-preview { animation: v2-fade .14s ease-out; }
  .auth-screen, .empty-state, .form-error, .notification, .toast, .sheet-status, .queue-item, .sheet-body form, .sheet-body section { animation: v2-fade .16s ease-out; }
  /* Floating layers rise a few pixels; `translate` composes with the
     centering `transform`, so no position jump on unsupported browsers. */
  .quick-icons, .sleep-finish { animation: v2-rise .16s ease-out; }
  dialog[open] { animation: v2-sheet-in .18s ease-out; }
  dialog::backdrop { animation: v2-backdrop-in .18s ease-out; }
  @keyframes v2-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes v2-rise { from { opacity: 0; translate: 0 4px; } to { opacity: 1; translate: 0 0; } }
  @keyframes v2-sheet-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
  @keyframes v2-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
}
