:root { --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #6b7280; --accent: #2563eb; --warn: #b45309; --ok: #15803d; --border: #e5e7eb; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #111318; --card: #1b1f27; --text: #e8eaf0; --muted: #9aa3b2; --accent: #60a5fa; --warn: #fbbf24; --ok: #4ade80; --border: #2a2f3a; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 8px 0 16px; }
.header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=file], textarea, input[type=email], input[type=password], input[type=datetime-local] { width: 100%; margin-bottom: 12px; font: inherit; color: inherit; }
textarea, input[type=email], input[type=password], input[type=datetime-local] { padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: transparent; }
textarea { min-height: 70px; }
button { width: 100%; padding: 12px; font: inherit; font-weight: 600; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { width: auto; padding: 4px 0; background: none; color: var(--muted); font-weight: 400; font-size: .9rem; }
.previews, .photos { display: flex; gap: 8px; overflow-x: auto; }
.previews { margin-bottom: 12px; padding: 6px 6px 0 0; } /* room for the × that sticks out */
.staged { position: relative; flex: none; }
.staged img { display: block; height: 72px; border-radius: 6px; }
.staged .remove { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; padding: 0; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; font-size: 16px; line-height: 24px; }
.photos { margin: 8px 0; }
.photos img { display: block; height: 64px; border-radius: 6px; }
.dish { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.meta { color: var(--muted); font-size: .85rem; }
/* Meal card: compact, so at least two fit on a phone screen */
.card.meal { padding: 10px 14px; margin-bottom: 10px; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 2px; }
.macros span { display: block; font-size: .8rem; color: var(--muted); }
.macros b { font-size: 1.35rem; }
.suggestion { margin-top: 6px; }
.suggestion b { font-size: 1.15rem; }
.badge { display: inline-block; vertical-align: middle; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.ref { border-color: var(--ok); color: var(--ok); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }
.chips .badge { padding: 1px 8px; }
.chip { font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--border); color: var(--muted); }
details { margin-top: 6px; color: var(--muted); font-size: .9rem; }
details summary { cursor: pointer; }
details p { margin: 8px 0; }
.history { margin: 0; padding-left: 18px; }
.tech { font-size: .8rem; }
.card.new { animation: highlight 3s ease-out; }
@keyframes highlight { from { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok); } }
.day-header { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0 -16px 12px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.day-header b { font-size: 1.05rem; }
.refine { margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.add-photos { display: inline-block; margin-bottom: 12px; padding: 8px 14px; border: 1px dashed var(--accent); border-radius: 8px; color: var(--accent); font-weight: 600; cursor: pointer; }
.visually-hidden:focus-visible + .add-photos { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-buttons { display: flex; gap: 8px; margin-bottom: 12px; }
.photo-buttons .add-photos { flex: 1; margin: 0; text-align: center; padding: 12px; }
.eaten-at { margin: -4px 0 12px; }
.eaten-at summary { cursor: pointer; }
.eaten-at input { margin: 8px 0 0; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
button.delete { width: 32px; height: 32px; margin: -6px -8px 0 0; padding: 0; background: none; color: var(--muted); font-size: 1rem; font-weight: 400; }
.warn { color: var(--warn); font-weight: 600; }
.nowrap { white-space: nowrap; }
