/* House Manager — Gmail-style Material 3: bluish-white canvas, white rounded content sheet,
   left navigation drawer with pill highlights, pill search bar, flat bordered lists, soft label tints.
   Mobile first. Breakpoints: 700px (two columns), 1024px (drawer docks), 1100px (full week grid). */
:root {
	--bg: #F6F8FC;          /* canvas behind the content sheet */
	--paper: #FFFFFF;       /* content sheet, lists, dialogs */
	--sunk: #F0F4F9;        /* hover rows, inputs */
	--high: #E9EEF6;        /* search bar, pressed */
	--ink: #1F1F1F;
	--muted: #444746;
	--line: #E2E6EB;
	--outline: #747775;
	--accent: #0B57D0;
	--accent-ink: #FFFFFF;
	--accent-soft: #D3E3FD;
	--accent-soft-ink: #041E49;
	--compose: #C2E7FF;
	--compose-ink: #001D35;
	--danger: #B3261E;
	--danger-soft: #F9DEDC;
	--inverse: #303030;
	--inverse-ink: #F2F2F2;
	--inverse-accent: #A8C7FA;
	--b: #7D5F12; --b-soft: #FBF0D2;
	--l: #2D6A3A; --l-soft: #E2F1E5;
	--d: #9A3B31; --d-soft: #FBE7E4;
	--s: #4652A0; --s-soft: #E7E9F8;
	--on-soft: #1F1F1F; --on-soft-muted: #444746;
	--b-ink: #7D5F12; --l-ink: #2D6A3A; --d-ink: #9A3B31; --s-ink: #4652A0; --danger-ink: #1F1F1F;
	--e1: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
	--e2: 0 1px 2px rgba(60, 64, 67, .3), 0 2px 6px 2px rgba(60, 64, 67, .15);
	--e3: 0 4px 8px 3px rgba(60, 64, 67, .15), 0 1px 3px rgba(60, 64, 67, .3);
	--font: Roboto, "Segoe UI", system-ui, sans-serif;
	--head: "Google Sans", "Product Sans", Roboto, "Segoe UI", system-ui, sans-serif;
	--nav-h: 72px;
	--drawer: 256px;
	color-scheme: light;
}
/* Theme: data-theme="light" / "dark" on <html> (Settings, per device); no attribute = follow the device */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0B0E13; --paper: #12161D; --sunk: #1A1F27; --high: #232A34; --ink: #E8ECF2; --muted: #A7B0BE;
		--line: #262D38; --outline: #6B7686; --accent: #78A1E2; --accent-ink: #0B0E13; --accent-soft: #8EB2EB; --accent-soft-ink: #0B0E13;
		--compose: #8EB2EB; --compose-ink: #0B0E13;
		--danger: #DF9098; --danger-soft: #D1757E; --danger-ink: #0B0E13; --inverse: #E8ECF2; --inverse-ink: #12161D; --inverse-accent: #5C8BD6;
		--b: #EED263; --b-soft: #EED263; --l: #9DE1D6; --l-soft: #9DE1D6; --d: #DF9098; --d-soft: #DF9098; --s: #CC9DF1; --s-soft: #CC9DF1;
		--on-soft: #0B0E13; --on-soft-muted: #2E3542;
		--b-ink: #0B0E13; --l-ink: #0B0E13; --d-ink: #0B0E13; --s-ink: #0B0E13;
		--e1: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px 1px rgba(0, 0, 0, .25);
		--e2: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 6px 2px rgba(0, 0, 0, .25);
		--e3: 0 4px 8px 3px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5);
		color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--bg: #0B0E13; --paper: #12161D; --sunk: #1A1F27; --high: #232A34; --ink: #E8ECF2; --muted: #A7B0BE;
	--line: #262D38; --outline: #6B7686; --accent: #78A1E2; --accent-ink: #0B0E13; --accent-soft: #8EB2EB; --accent-soft-ink: #0B0E13;
	--compose: #8EB2EB; --compose-ink: #0B0E13;
	--danger: #DF9098; --danger-soft: #D1757E; --danger-ink: #0B0E13; --inverse: #E8ECF2; --inverse-ink: #12161D; --inverse-accent: #5C8BD6;
	--b: #EED263; --b-soft: #EED263; --l: #9DE1D6; --l-soft: #9DE1D6; --d: #DF9098; --d-soft: #DF9098; --s: #CC9DF1; --s-soft: #CC9DF1;
	--on-soft: #0B0E13; --on-soft-muted: #2E3542;
	--b-ink: #0B0E13; --l-ink: #0B0E13; --d-ink: #0B0E13; --s-ink: #0B0E13;
	--e1: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px 1px rgba(0, 0, 0, .25);
	--e2: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 6px 2px rgba(0, 0, 0, .25);
	--e3: 0 4px 8px 3px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .5);
	color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--font); letter-spacing: .01em; padding-bottom: env(safe-area-inset-bottom, 0px); }
body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
h1, h2, h3 { margin: 0; font-family: var(--head); font-weight: 400; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 18px; font-weight: 500; }
h3 { font-size: 15px; font-weight: 500; letter-spacing: .01em; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

.mi {
	font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1;
	display: inline-block; width: 1em; height: 1em; overflow: hidden; flex: none; text-transform: none; letter-spacing: normal;
	white-space: nowrap; direction: ltr; font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; user-select: none;
	font-variation-settings: "FILL" 0, "opsz" 24;
}
.mi.fill { font-variation-settings: "FILL" 1, "opsz" 24; }
.mi.sm { font-size: 20px; font-variation-settings: "FILL" 0, "opsz" 20; }
.mi.xs { font-size: 18px; font-variation-settings: "FILL" 0, "opsz" 20; }

/* ---------- Top bar: menu, brand, pill search, avatar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--paper); padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner {
	display: flex; align-items: center; gap: 2px; height: 48px; margin: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
	background: var(--high); border-radius: 5px; padding: 0 4px;
}
.topbar.is-scrolled .topbar-inner { box-shadow: var(--e1); }
.brand { display: none; }
.gsearch { flex: 1; min-width: 0; display: flex; align-items: center; height: 100%; }
.gsearch input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 16px; color: var(--ink); padding: 0 4px; }
.gsearch input::placeholder { color: var(--muted); }
.gsearch input:focus { outline: none; }
.gsearch .icon-btn.go { display: none; }
.avatar {
	height: 32px; min-width: 32px; padding: 0 10px; border-radius: 5px; display: grid; place-items: center; text-decoration: none; flex: none; margin: 0 4px;
	background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 14px; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
	border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
	color: var(--muted); cursor: pointer; text-decoration: none; flex: none; position: relative;
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.icon-btn.tonal { background: var(--sunk); color: var(--ink); }

/* ---------- Navigation drawer ---------- */
.drawer {
	position: fixed; z-index: 45; top: 0; bottom: 0; left: 0; width: min(304px, 86vw); background: var(--bg);
	padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 16px max(0px, env(safe-area-inset-left, 0px));
	overflow-y: auto; transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, 0, 0, 1); border-radius: 0 5px 5px 0;
}
.drawer-open .drawer { transform: none; box-shadow: var(--e3); }
.scrim { position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .32); }
.drawer-brand { display: flex; align-items: center; gap: 10px; padding: 8px 16px 16px 24px; font-family: var(--head); font-size: 20px; color: var(--ink); text-decoration: none; }
.drawer-brand .mi { color: var(--accent); }
.logo { flex: none; width: 24px; height: 24px; color: var(--accent); }
.d-head { font-size: 13px; font-weight: 500; color: var(--muted); padding: 16px 0 6px 26px; letter-spacing: .02em; }
.d-item {
	display: flex; align-items: center; gap: 18px; height: 36px; padding: 0 16px 0 26px; border-radius: 0 5px 5px 0;
	color: var(--ink); text-decoration: none; font-size: 14px; white-space: nowrap;
}
.d-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.d-item .mi { font-size: 20px; color: var(--muted); font-variation-settings: "FILL" 0, "opsz" 20; }
.d-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 700; }
.d-item[aria-current="page"] .mi { color: var(--accent-soft-ink); font-variation-settings: "FILL" 1, "opsz" 20; }
.d-item .count { margin-left: auto; font-size: 12px; font-weight: 500; }
.d-sep { height: 1px; background: var(--line); margin: 12px 16px 4px 26px; }

/* ---------- Bottom navigation (phones, Food section) ---------- */
.navbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--sunk);
	display: grid; grid-template-columns: repeat(5, 1fr);
	padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.navbar a {
	height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
	color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; letter-spacing: .02em;
}
.nav-ind { width: 56px; height: 32px; border-radius: 5px; display: grid; place-items: center; transition: background .2s; }
.navbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.navbar a[aria-current="page"] .nav-ind { background: var(--accent-soft); color: var(--accent-soft-ink); }

/* ---------- Page ---------- */
.shell { min-width: 0; }
.main {
	min-width: 0; padding-block: 4px 32px;
	padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.backbar { margin: -4px 0 6px -8px; }
.narrow { max-width: 760px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; min-height: 44px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 16px; min-width: 0; }
.panel.flat { background: var(--sunk); border-color: transparent; }
.hint { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; margin: 0 0 12px; }

/* Tablet and desktop: Gmail frame — canvas with a docked side menu and a white rounded content sheet */
@media (min-width: 600px) {
	body { background: var(--bg); }
	body.has-nav { padding-bottom: 0; }
	.navbar { display: none; }
	.topbar { background: var(--bg); }
	.topbar-inner { height: 64px; margin: 0; background: transparent; border-radius: 0; padding: 0 16px 0 8px; gap: 4px; }
	.topbar.is-scrolled .topbar-inner { box-shadow: none; }
	.brand { display: flex; align-items: center; gap: 10px; width: calc(var(--drawer) - 56px); padding-left: 6px; font-family: var(--head); font-size: 22px; color: var(--ink); text-decoration: none; white-space: nowrap; }
	.brand .mi { color: var(--accent); font-variation-settings: "FILL" 1, "opsz" 24; }
	.gsearch { flex: 0 1 720px; height: 48px; background: var(--high); border-radius: 5px; padding: 0 4px; }
	.gsearch:focus-within { background: var(--paper); box-shadow: var(--e1); }
	.topbar .avatar { margin-left: auto; }
	.shell { display: grid; grid-template-columns: var(--drawer) minmax(0, 1fr); align-items: start; }
	.drawer { position: sticky; top: 64px; height: calc(100vh - 64px); width: auto; transform: none; background: transparent; padding: 4px 12px 16px 0; border-radius: 0; box-shadow: none !important; transition: none; }
	.drawer-brand { display: none; }
	.scrim { display: none; }
	.main {
		background: var(--paper); border-radius: 5px; margin: 0 16px 16px 0; padding: 16px 24px 32px;
		min-height: calc(100vh - 64px - 16px);
	}
	body.drawer-mini { --drawer: 80px; }
	.drawer-mini .d-item { padding: 0; width: 56px; margin-left: 12px; justify-content: center; border-radius: 5px; }
	.drawer-mini .d-item span:not(.mi), .drawer-mini .d-head, .drawer-mini .d-sep { display: none; }
	.drawer-mini .brand span:not(.mi):not(.logo) { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 20px 0 16px;
	border-radius: 5px; border: 1px solid var(--outline); background: transparent; color: var(--accent);
	font-weight: 500; font-size: 14px; letter-spacing: .02em; text-decoration: none; cursor: pointer; white-space: nowrap;
	transition: background .15s, box-shadow .15s;
}
.btn:not(:has(.mi)) { padding: 0 20px; }
.btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.btn .mi { font-size: 18px; font-variation-settings: "FILL" 0, "opsz" 20; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); box-shadow: var(--e1); filter: brightness(1.06); }
.btn-tonal { background: var(--accent-soft); border-color: transparent; color: var(--accent-soft-ink); }
.btn-tonal:hover { background: var(--accent-soft); box-shadow: var(--e1); }
.btn-text { border-color: transparent; padding: 0 12px; }
.btn-danger { color: var(--danger); border-color: var(--line); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger.btn-primary { background: var(--danger); color: var(--paper); }
.btn-small { height: 32px; padding: 0 14px 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; box-shadow: none; }

.fab {
	position: fixed; z-index: 15; right: max(16px, env(safe-area-inset-right, 0px));
	bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
	display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px 0 16px; border-radius: 5px; border: 0;
	background: var(--accent-soft); color: var(--accent-soft-ink); box-shadow: var(--e3); font-weight: 500; font-size: 15px; cursor: pointer;
}
.fab:hover { filter: brightness(.97); }
@media (min-width: 900px) { .fab { bottom: 24px; } }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .label { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .04em; }
.input, select.input, textarea.input {
	width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--outline); border-radius: 5px;
	background: transparent; font-size: 16px; color: var(--ink);
}
select.input { background: var(--paper); }
textarea.input { min-height: 80px; resize: vertical; line-height: 1.45; }
.input:hover { border-color: var(--ink); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.search { position: relative; }
.search .mi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 48px; border-radius: 5px; background: var(--sunk); border-color: transparent; min-height: 52px; }
.search .input:focus { background: var(--paper); }
.check { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.check input, .shop-item input[type="checkbox"], .prep-task input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; min-height: 48px; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 5px; border: 2px solid var(--outline); background: var(--high); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .2s, border-color .2s; }
.switch input::after { content: ""; position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline); transition: all .2s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { left: 22px; top: 2px; width: 24px; height: 24px; background: var(--accent-ink); }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
	display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 16px; border: 1px solid var(--outline);
	border-radius: 5px; background: transparent; font-weight: 500; font-size: 14px; white-space: nowrap; cursor: pointer; color: var(--muted);
}
.chip .mi { font-size: 18px; font-variation-settings: "FILL" 0, "opsz" 20; margin-left: -6px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent-soft-ink); }
.chip[aria-pressed="true"]::before {
	content: "check"; font-family: "Material Symbols Rounded"; font-size: 18px; margin-left: -6px; font-feature-settings: "liga";
	width: 18px; overflow: hidden; line-height: 1;
}
.chip[aria-pressed="true"] .mi { display: none; }

/* Segmented button */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--outline); border-radius: 5px; overflow: hidden; }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; font-weight: 500; font-size: 14px; cursor: pointer; color: var(--ink); border-left: 1px solid var(--outline); padding: 0 8px; text-align: center; }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent-soft-ink); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -3px; }
.seg .mi { font-size: 18px; font-variation-settings: "FILL" 0, "opsz" 20; }

/* ---------- Meal colors ---------- */
.t-b { --c: var(--b); --soft: var(--b-soft); --c-ink: var(--b-ink); }
.t-l { --c: var(--l); --soft: var(--l-soft); --c-ink: var(--l-ink); }
.t-d { --c: var(--d); --soft: var(--d-soft); --c-ink: var(--d-ink); }
.t-s { --c: var(--s); --soft: var(--s-soft); --c-ink: var(--s-ink); }
.tag {
	display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px 0 6px; border-radius: 5px;
	color: var(--c); background: var(--soft); font-size: 12px; font-weight: 500; letter-spacing: .03em; white-space: nowrap;
}
.tag .mi { font-size: 16px; font-variation-settings: "FILL" 1, "opsz" 20; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--sunk); border-radius: 5px; padding: 2px 8px; white-space: nowrap; }
.badge .mi { font-size: 16px; }

/* ---------- Week navigator ---------- */
.weeknav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.weeknav h1 { font-size: 22px; padding: 0 6px; white-space: nowrap; }

/* ---------- Plan ---------- */
.week { display: grid; gap: 12px; padding-bottom: 72px; }
.day { background: var(--paper); border-radius: 5px; padding: 12px 12px 8px; min-width: 0; scroll-margin-top: 80px; box-shadow: var(--e1); }
.day.is-today { box-shadow: inset 0 0 0 2px var(--accent), var(--e1); }
.day-head { display: flex; align-items: center; gap: 10px; margin: 0 0 4px 2px; }
.day-head .dnum {
	width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 500;
	background: var(--sunk); color: var(--ink);
}
.day.is-today .dnum { background: var(--accent); color: var(--accent-ink); }
.day-head h2 { font-size: 16px; font-weight: 500; }
.day-head .today-pill { font-size: 12px; color: var(--accent); font-weight: 500; }
.slot { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 6px; border-radius: 5px; transition: background .15s; min-width: 0; }
.slot-head { display: flex; align-items: center; gap: 2px; min-height: 32px; }
.slot-label { color: var(--c); display: grid; place-items: center; width: 32px; height: 32px; flex: none; }
.slot-label .mi { font-variation-settings: "FILL" 1, "opsz" 24; opacity: .85; }
.slot-label .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.slot-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.slot-list:empty { display: none; }
.slot-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meal {
	display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; text-align: left; cursor: pointer;
	border: 0; background: var(--soft); color: var(--ink); border-radius: 5px; padding: 8px 6px 8px 12px;
	font-weight: 500; font-size: 15px; line-height: 1.25; touch-action: manipulation; user-select: none; -webkit-user-select: none;
	-webkit-touch-callout: none; transition: box-shadow .15s, transform .15s;
}
.meal:hover { box-shadow: var(--e1); }
.meal .meal-text { flex: 1; min-width: 0; }
.meal small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.meal .lo { display: inline-flex; vertical-align: middle; margin-left: 4px; font-size: 11px; font-weight: 500; color: var(--muted); background: color-mix(in srgb, var(--paper) 60%, transparent); border-radius: 4px; padding: 0 5px; }
.meal .grip { color: var(--muted); opacity: .55; }
.add-meal {
	display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--muted); border-radius: 5px;
	height: 28px; font-weight: 500; font-size: 13px; cursor: pointer; padding: 0 10px 0 6px; white-space: nowrap;
}
.add-meal:hover { background: var(--sunk); color: var(--ink); }

/* Drag and drop */
.is-dragging .add-meal { visibility: hidden; }
.is-dragging .slot-list { display: flex; min-height: 44px; border-radius: 5px; outline: 1.5px dashed var(--line); outline-offset: -1px; }
.is-dragging .slot.is-over .slot-list { outline-color: var(--c); background: color-mix(in srgb, var(--soft) 60%, transparent); }
.sortable-ghost .meal { opacity: .35; box-shadow: none; }
.sortable-fallback .meal, .sortable-drag .meal { box-shadow: var(--e3); transform: scale(1.03); }
.sortable-fallback { opacity: 1 !important; list-style: none; }
.trash-zone {
	position: fixed; left: 50%; transform: translate(-50%, 20px); z-index: 40; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 24px 0 18px; border-radius: 5px;
	background: var(--inverse); color: var(--inverse-ink); box-shadow: var(--e3); font-weight: 500; opacity: 0; pointer-events: none;
	transition: opacity .15s, transform .15s, background .15s;
}
.is-dragging .trash-zone { opacity: 1; transform: translate(-50%, 0); }
.trash-zone.is-over { background: var(--danger); color: var(--paper); transform: translate(-50%, 0) scale(1.06); }
.is-dragging .navbar, .is-dragging .fab { visibility: hidden; }
.drop-outside .day { opacity: .65; }

@media (min-width: 700px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) {
	.week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
	.day { padding: 10px 6px 6px; }
	.day-head { flex-direction: column; gap: 2px; margin-bottom: 6px; }
	.slot { gap: 2px; padding: 2px 0 4px; }
	.slot-head { min-height: 28px; }
	.slot-label { width: 26px; height: 28px; }
	.slot-label .mi { font-size: 18px; }
	.add-meal { padding: 0 6px 0 2px; font-size: 12.5px; }
	.meal { font-size: 13.5px; padding: 7px 4px 7px 8px; }
	.meal .grip { display: none; }
}

/* ---------- Sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(15, 20, 17, .38); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel {
	background: var(--sunk); width: 100%; max-height: 90vh; display: flex; flex-direction: column;
	border-radius: 5px 5px 0 0; box-shadow: var(--e3); padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheet-up .22s cubic-bezier(.2, 0, 0, 1);
}
.sheet-grab { width: 32px; height: 4px; border-radius: 2px; background: var(--outline); opacity: .5; margin: 12px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px max(24px, env(safe-area-inset-left, 0px)); }
.sheet-head h2 { flex: 1; min-width: 0; font-size: 22px; font-weight: 400; }
.sheet-body { overflow-y: auto; padding-block: 8px 24px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) {
	.sheet { align-items: center; padding: 24px; }
	.sheet-panel { max-width: 560px; border-radius: 5px; max-height: 86vh; }
	.sheet-grab { display: none; }
	.sheet-head { padding-top: 16px; }
}
@media (prefers-reduced-motion: reduce) { .sheet-panel { animation: none; } * { transition: none !important; } }

.menu-list { display: flex; flex-direction: column; margin: 0 -12px; }
.menu-item {
	display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 8px 12px; border: 0; border-radius: 5px; background: transparent;
	text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; width: 100%; font-size: 16px;
}
.menu-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.menu-item .mi { color: var(--muted); }
.menu-item small { display: block; color: var(--muted); font-size: 13px; }
.menu-item.danger, .menu-item.danger .mi { color: var(--danger); }
.divider { height: 1px; background: var(--line); margin: 8px 0; border: 0; }
.pick-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pick-list .meal { min-height: 52px; }
.pick-list .meal .tags { display: flex; gap: 4px; flex: none; }
.pick-list .meal .tags .mi { color: var(--muted); font-size: 18px; opacity: .8; }

/* ---------- Snackbar ---------- */
.toast {
	position: fixed; left: 50%; transform: translateX(-50%); z-index: 60; width: max-content; max-width: min(560px, calc(100% - 32px));
	bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px));
	background: var(--inverse); color: var(--inverse-ink); padding: 0 8px 0 16px; min-height: 48px; border-radius: 4px; box-shadow: var(--e3);
	display: flex; gap: 8px; align-items: center; font-size: 14px;
}
.toast > span { padding: 14px 8px 14px 0; }
.toast.is-error { background: var(--danger); color: var(--paper); }
.toast button { border: 0; background: transparent; color: var(--inverse-accent); font-weight: 500; cursor: pointer; padding: 0 8px; height: 36px; border-radius: 5px; }
.toast.is-error button { color: var(--paper); }
@media (min-width: 900px) { .toast { bottom: 24px; left: 24px; transform: none; } }

/* ---------- Shopping ---------- */
.progress { height: 4px; border-radius: 2px; background: var(--high); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
/* Masonry: aisles stack in columns with no gaps under short cards */
.shop-grid { column-gap: 12px; }
.shop-grid > * { break-inside: avoid; margin-bottom: 12px; display: block; }
@media (min-width: 700px) { .shop-grid { columns: 2; } }
@media (min-width: 1100px) { .shop-grid { columns: 3; } }
.tabbar { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.tabbar button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 500; font-size: 14px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabbar button:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.tabbar button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabbar .mi { font-size: 20px; }
.tabbar .num { font-weight: 400; }
.aisle { padding: 8px 8px 8px; }
.aisle h2 { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 500; color: var(--accent); padding: 8px 8px 4px; }
.aisle h2 small { font-size: 12px; color: var(--muted); font-weight: 400; }
.shop-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px; align-items: center; padding: 6px 4px 6px 0; border-radius: 5px; min-height: 56px; }
.shop-item:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.shop-item > input[type="checkbox"] { justify-self: center; }
.shop-item label, .shop-item > span:nth-child(2) { cursor: pointer; min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.shop-item .uses { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; }
.shop-item.is-got label { text-decoration: line-through; color: var(--muted); }
.link-btn { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; border: 0; background: transparent; color: var(--accent); font-weight: 500; font-size: 13px; cursor: pointer; padding: 6px 10px; border-radius: 5px; white-space: nowrap; }
.link-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.link-btn .mi { font-size: 18px; }
.add-extra { display: grid; grid-template-columns: 1fr 1fr auto; grid-template-areas: "name name btn" "qty aisle aisle"; gap: 8px; }
.add-extra #x-name { grid-area: name; }
.add-extra #x-qty { grid-area: qty; }
.add-extra #x-aisle { grid-area: aisle; }
.add-extra button { grid-area: btn; height: 48px; }
@media (min-width: 700px) { .add-extra { grid-template-columns: 2fr 1fr 1.2fr auto; grid-template-areas: "name qty aisle btn"; } }
details.panel > summary { cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 8px; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }

/* ---------- Prep ---------- */
.prep-day { padding: 8px; }
.prep-day h2 { display: flex; gap: 8px; align-items: center; font-size: 15px; font-weight: 500; padding: 8px 8px 4px; }
.prep-day.is-today h2 { color: var(--accent); }
.prep-task { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px; align-items: center; padding: 6px 4px 6px 0; border-radius: 5px; min-height: 56px; }
.prep-task:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.prep-task input { justify-self: center; }
.prep-task label { cursor: pointer; font-size: 15px; }
.prep-task .for { display: block; font-size: 13px; color: var(--muted); }
.prep-task.is-done label { text-decoration: line-through; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 8px; }

/* ---------- Recipes ---------- */
.recipe-list { display: grid; gap: 8px; }
@media (min-width: 700px) { .recipe-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .recipe-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.recipe-row {
	display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--paper); border-radius: 5px;
	text-decoration: none; color: var(--ink); min-width: 0; box-shadow: var(--e1); transition: box-shadow .15s;
}
.recipe-row:hover { box-shadow: var(--e2); }
.recipe-row .avatar-ico { width: 40px; height: 40px; border-radius: 5px; display: grid; place-items: center; background: var(--soft); color: var(--c); flex: none; }
.recipe-row .avatar-ico .mi { font-variation-settings: "FILL" 1, "opsz" 24; }
.recipe-row .r-text { flex: 1; min-width: 0; }
.recipe-row strong { display: block; font-weight: 500; font-size: 16px; }
.recipe-row .r-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; color: var(--muted); font-size: 13px; }
.recipe-row .r-sub .mi { font-size: 16px; vertical-align: -3px; }

.card { background: var(--paper); border-radius: 5px; padding: 20px; min-width: 0; box-shadow: var(--e1); line-height: 1.55; }
.card-head { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.card-head h1 { font-size: 28px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); align-items: center; }
.card .meta .mi { font-size: 18px; vertical-align: -4px; margin-right: 2px; }
.card h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 20px 0 6px; }
.card h3 .mi { font-size: 20px; }
.card ul, .card ol { margin: 0; padding-left: 22px; }
.card li { padding: 5px 0; }
.card ul li::marker { color: var(--outline); }
.card ol li::marker { color: var(--accent); font-weight: 500; }
.card .amt { font-weight: 500; }
.card .leftover { color: var(--muted); font-style: italic; }
.card p { margin: 0; }
.card .tip { background: var(--accent-soft); color: var(--accent-soft-ink); border-radius: 5px; padding: 12px 14px; display: flex; gap: 10px; }
.recipe-layout { display: grid; gap: 16px; }
@media (min-width: 900px) { .recipe-layout { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }

/* Editor */
.editor-rows { display: flex; flex-direction: column; gap: 8px; }
.ed-row { display: grid; gap: 8px; align-items: start; background: var(--sunk); border-radius: 5px; padding: 8px; }
.ed-ing { grid-template-columns: 28px 1fr 40px; }
.ed-ing .ing-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; }
.ed-ing .ing-fields .input:first-child { grid-column: 1 / -1; }
.ed-ing .ing-opts { grid-column: 2 / -1; display: flex; gap: 6px 14px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.ed-row .input { background: var(--paper); border-color: var(--line); }
@media (min-width: 700px) {
	.ed-ing .ing-fields { grid-template-columns: 2fr 1.3fr 1.3fr; }
	.ed-ing .ing-fields .input:first-child { grid-column: auto; }
}
.ed-step, .ed-prep { grid-template-columns: 28px 1fr 40px; }
.ed-prep .prep-fields { display: grid; gap: 8px; grid-template-columns: 1fr; min-width: 0; }
@media (min-width: 700px) { .ed-prep .prep-fields { grid-template-columns: 2fr 1fr; } }
.handle { cursor: grab; color: var(--muted); height: 48px; display: grid; place-items: center; touch-action: none; }
.step-num { font-weight: 500; color: var(--accent); height: 48px; display: grid; place-items: center; }
.savebar {
	position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); z-index: 10;
	background: var(--bg); padding: 12px 0; display: flex; gap: 8px; justify-content: flex-end;
}
@media (min-width: 900px) { .savebar { bottom: 0; } }
.confirm { background: var(--danger-soft); border-radius: 5px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* Items */
.item-row { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.item-row:first-of-type { border-top: 0; }
@media (min-width: 700px) { .item-row { grid-template-columns: 2fr 1.4fr auto auto; align-items: center; } }

/* ---------- Home ---------- */
.home-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } }
.today-meals { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.today-meals li { display: flex; align-items: center; gap: 14px; background: var(--soft); border-radius: 5px; padding: 14px 16px; }
.today-meals li > .mi { color: var(--c); font-variation-settings: "FILL" 1, "opsz" 24; }
.today-meals a { font-weight: 500; color: var(--ink); text-decoration: none; }
.today-meals small { display: block; color: var(--muted); font-size: 12px; }
.section-tile {
	display: flex; gap: 16px; align-items: center; padding: 16px; background: var(--paper); border-radius: 5px; box-shadow: var(--e1);
	text-decoration: none; color: var(--ink);
}
.section-tile .ico { width: 48px; height: 48px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-soft-ink); display: grid; place-items: center; flex: none; }
.stat { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 4px 0; border-top: 1px solid var(--line); }
.stat:first-of-type { border-top: 0; }
.stat a { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.stat a .mi { color: var(--muted); }

/* ---------- Login ---------- */
.auth { max-width: 400px; margin: 6vh auto 0; }
.auth .logo { width: 56px; height: 56px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-soft-ink); display: grid; place-items: center; }
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--danger-soft); color: var(--ink); border-radius: 5px; padding: 12px 14px; font-size: 14px; }
.alert.ok { background: var(--accent-soft); color: var(--accent-soft-ink); }
.alert.warn { background: var(--b-soft); }

/* ---------- On hand ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--paper); border-radius: 5px; padding: 12px; min-width: 0; box-shadow: var(--e1); display: flex; flex-direction: column; gap: 2px; }
.tile .mi { color: var(--accent); }
.tile .big { font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .lbl { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.tile.warn .mi { color: var(--d); }
.meter { height: 4px; border-radius: 2px; background: var(--high); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--sunk); border-radius: 5px; padding: 2px; flex: none; }
.stepper .icon-btn { width: 32px; height: 32px; }
.stepper .q { min-width: 56px; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.oh-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 6px 4px 6px 0; border-radius: 5px; min-height: 56px; }
.oh-row .menu-item { min-height: 44px; padding: 4px 12px; }
.oh-row.is-out .menu-item > span:first-child { color: var(--muted); text-decoration: line-through; }
.flag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 500; border-radius: 5px; padding: 0 6px; margin-left: 4px; }
.flag .mi { font-size: 14px; }
.flag.soon { background: var(--b-soft); color: var(--b); }
.flag.bad { background: var(--danger-soft); color: var(--danger); }
.flag.lt { background: var(--accent-soft); color: var(--accent-soft-ink); }
@media (max-width: 420px) { .tile .big { font-size: 24px; } .tile { padding: 10px; } }
.meal.is-off { background: var(--sunk); color: var(--muted); }
.meal.is-off .mname { text-decoration: line-through; }
.meal .lo .mi { font-size: 13px; margin-right: 2px; vertical-align: -2px; }

/* ---------- Gmail-style flat surfaces ---------- */
.day, .tile, .recipe-row, .section-tile, .card { box-shadow: none; border: 1px solid var(--line); border-radius: 5px; }
.day.is-today { box-shadow: inset 0 0 0 2px var(--accent); border-color: transparent; }
.recipe-row:hover, .section-tile:hover { box-shadow: var(--e1); border-color: transparent; }
.fab { background: var(--compose); color: var(--compose-ink); box-shadow: var(--e2); border-radius: 5px; font-family: var(--head); font-size: 14px; }
.fab:hover { box-shadow: var(--e3); }
.sheet-panel { background: var(--paper); }
.sheet-panel .panel.flat, .sheet-panel .ed-row { background: var(--sunk); }
.btn { font-family: var(--head); }
.aisle h2, .prep-day h2 { font-family: var(--head); }
@media (min-width: 600px) {
	.week { padding-bottom: 0; }
}

/* Tablet / narrow window: the side menu stays as an icon rail; the menu button expands it over the page */
@media (min-width: 600px) and (max-width: 1023px) {
	body { --drawer: 80px; }
	.brand { width: auto; padding-right: 8px; }
	.brand span:not(.mi):not(.logo) { display: none; }
	body:not(.drawer-open) .d-item { padding: 0; width: 56px; margin-left: 12px; justify-content: center; border-radius: 5px; }
	body:not(.drawer-open) .d-item span:not(.mi), body:not(.drawer-open) .d-head, body:not(.drawer-open) .d-sep { display: none; }
	.drawer-open .drawer { position: fixed; top: 64px; left: 0; width: 256px; height: calc(100vh - 64px); background: var(--bg); box-shadow: var(--e3); z-index: 45; border-radius: 0 5px 5px 0; padding-top: 12px; }
	.drawer-open .scrim:not([hidden]) { display: block; top: 64px; }
	.main { padding: 16px; }
}

/* ---------- Month view ---------- */
.week.month { display: block; padding-bottom: 72px; }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--paper); }
.mdow { font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; padding: 8px 0; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .06em; }
.mcell { min-height: 62px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background .15s; }
.mcell:nth-child(7n) { border-right: 0; }
.mcell.is-other { background: var(--bg); }
.mcell.is-other .mnum { color: var(--outline); }
.mcell.is-over { background: var(--accent-soft); }
.mnum { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 50%; font-size: 12px; font-weight: 500; cursor: pointer; align-self: center; flex: none; color: var(--ink); }
.mnum:hover { background: var(--sunk); }
.mcell.is-today .mnum { background: var(--accent); color: var(--accent-ink); }
.mlist { display: none; }
.mdots { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; padding: 0 2px; }
.mdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.is-dragging .mlist { min-height: 0; outline: 0; }
.mgrid .mchip { min-height: 0; padding: 2px 6px; font-size: 12px; border-radius: 5px; font-weight: 500; line-height: 1.4; }
.mgrid .mchip .mname { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 700px) {
	.mcell { min-height: 112px; }
	.mnum { align-self: flex-start; }
	.mlist { display: flex; gap: 2px; }
	.mdots { display: none; }
}

/* Page titles carry their main action right beside them */
.title-row { gap: 12px; flex-wrap: wrap; }
.week, .week.month { padding-bottom: 0; }

.est { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--accent-soft-ink); border-radius: 5px; padding: 10px 12px; font-size: 14px; line-height: 1.4; }
.est .mi { margin-top: 1px; }
.est b { font-weight: 700; }

.mcell.is-past { background: var(--bg); }
.mcell.is-past .mnum { color: var(--outline); }

/* Day header opens that day's prep */
.day-open { width: calc(100% + 8px); border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; padding: 4px; margin: -4px -4px 0; border-radius: 5px; font: inherit; }
.day-open:hover { background: var(--sunk); }
.prep-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--accent-soft-ink); background: var(--accent-soft); border-radius: 5px; padding: 1px 6px 1px 3px; }
.prep-badge.is-empty { background: none; color: var(--outline); padding: 1px 3px; }
.prep-badge .mi { font-size: 16px; }
.mcell .prep-badge { font-size: 11px; padding: 0 4px 0 2px; }
@media (min-width: 1100px) { .day-open .prep-badge { margin-left: 0; } }

/* ---------- Notifications ---------- */
.bell-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.menu-item.notif.is-unread { font-weight: 500; }
.menu-item.notif.is-unread .mi { color: var(--accent); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* ---------- Tasks ---------- */
.task-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px; align-items: center; min-height: 56px; border-radius: 5px; padding-right: 6px; }
.task-row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.task-row > input { justify-self: center; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.task-row .menu-item { min-height: 44px; padding: 4px 8px; }
.task-row .t-title { margin-right: 4px; }
.task-row.is-done .t-title { text-decoration: line-through; color: var(--muted); }
.pchips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 45%; }
.pchip { height: 24px; padding: 0 8px; border-radius: 5px; display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
	@page { margin: 12mm; }
	@page landscape { size: landscape; }
	:root, :root[data-theme="dark"] {
		--bg: #fff; --paper: #fff; --sunk: #fff; --high: #fff; --ink: #000; --muted: #444; --line: #bbb; --outline: #888;
		--accent: #0B57D0; --accent-soft: #fff; --accent-soft-ink: #000;
		--b: #7D5F12; --b-soft: #FBF0D2; --l: #2D6A3A; --l-soft: #E2F1E5; --d: #9A3B31; --d-soft: #FBE7E4; --s: #4652A0; --s-soft: #E7E9F8;
		color-scheme: light;
	}
	* { box-shadow: none !important; transition: none !important; }
	body, body.has-nav { background: #fff; color: #000; padding: 0; font-size: 11pt; }
	.print-only { display: block; }
	.no-print { display: none !important; }
	.print-head { font-size: 9pt; color: #555; margin-bottom: 8px; }
	.topbar, .drawer, .scrim, .navbar, .toast, .sheet, .trash-zone, .backbar, .hint, .chips, .search, .add-extra,
	.btn, .icon-btn, .link-btn, .add-meal, .grip, .fab, form, #have-wrap, .progress, .stepper .icon-btn, .recipe-layout > aside { display: none !important; }
	.shell, .main { display: block; margin: 0; padding: 0; border-radius: 0; min-height: 0; background: #fff; }
	.page-head { margin-bottom: 6px; min-height: 0; }
	.panel, .day, .card, .tile, .recipe-row { border: 1px solid #bbb !important; break-inside: avoid; }
	body.print-landscape { page: landscape; }
	.meal, .tag, .mdots i, .mcell.is-today .mnum, .day.is-today { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

	/* Calendar: landscape, all days side by side */
	.week { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: 4px !important; padding: 0 !important; }
	.week.month { display: block !important; }
	.day { padding: 4px !important; border-radius: 0 !important; }
	.day-head { flex-direction: column; gap: 0; margin: 0 0 2px; }
	.day-head .dnum { width: auto; height: auto; background: none !important; color: #000 !important; font-weight: 700; }
	.prep-badge { display: none !important; }
	.day-head h2 { font-size: 9pt; }
	.slot { padding: 1px 0; gap: 1px; }
	.slot-head { min-height: 0; }
	.slot-label { width: auto; height: auto; place-items: start; }
	.slot-label .mi { font-size: 12px; }
	.slot-list:empty { display: none !important; }
	.meal { font-size: 9.5pt; min-height: 0; padding: 3px 5px; border-radius: 0; }
	.meal small, .meal .lo { font-size: 8pt; }
	.slot-label .mi { font-size: 14px; }
	/* Month: full grid with meal names; rows may continue on the next page */
	.mgrid { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)) !important; overflow: visible; border: 1px solid #999 !important; border-radius: 0; }
	.mdow { padding: 3px 0; font-size: 8pt; border-bottom: 1px solid #999; }
	.mcell { min-height: 82px; padding: 2px; break-inside: avoid; border-color: #bbb; }
	.mcell.is-other, .mcell.is-past { background: #f3f3f3; }
	.mnum { width: auto; height: auto; font-size: 8pt; align-self: flex-start; padding: 0 2px; }
	.mcell.is-today .mnum { background: none !important; color: #000 !important; text-decoration: underline; font-weight: 700; }
	.mlist { display: flex !important; flex-direction: column; gap: 1px; min-height: 0; outline: 0; }
	.mgrid .mchip { font-size: 7pt; padding: 1px 3px; line-height: 1.25; }
	.mgrid .mchip .mname { white-space: normal; overflow: visible; }
	.mdots { display: none !important; }

	/* Shopping list: only what's left to buy, in two columns with boxes to tick */
	.shop-grid { display: block !important; columns: 2; column-gap: 16px; padding: 0 !important; }
	.aisle { break-inside: avoid; margin-bottom: 8px; padding: 6px !important; display: block; }
	.shop-item.is-got { display: none; }
	.shop-item { min-height: 0; padding: 2px 0; grid-template-columns: 22px 1fr; }
	.shop-item > :last-child:not(label) { display: none; }

	/* Recipe card: ingredients in two columns */
	.recipe-layout { display: block; }
	.card { border: 0 !important; padding: 0; }
	.card ul { columns: 2; column-gap: 24px; }
	.card li { padding: 2px 0; break-inside: avoid; }
	.card .tip { background: none; border: 1px solid #bbb; }

	/* Household supplies: mark what's on the shopping list */
	#h-list .shop-item { min-height: 0; padding: 0; }
	#h-list .menu-item { min-height: 0; padding: 2px 8px; }
	#h-list [data-need][aria-pressed="true"] { display: inline-grid !important; width: 24px; height: 24px; background: none !important; }

	/* Tasks */
	.task-row { min-height: 0; padding: 2px 0; }
	.pchip { border-color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

	/* On hand */
	.tiles { grid-template-columns: repeat(3, 1fr); }
	.stepper { background: none; }
	.oh-row { min-height: 0; padding: 2px 0; }
}

[data-readonly] [data-need] { display: none !important; }

/* Roles table */
.perm-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.perm-table th, .perm-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table thead th { font-size: 12px; font-weight: 500; color: var(--muted); }
.perm-table tbody th { text-align: left; font-weight: 400; min-width: 200px; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--accent); }
.perm-table input:disabled { opacity: .55; }
.google-btn { height: 44px; font-size: 15px; }

.d-theme { width: 100%; border: 0; background: transparent; cursor: pointer; font: inherit; text-align: left; }
.home-task input { width: 20px; height: 20px; accent-color: var(--accent); }
.home-task.is-done .t-title { text-decoration: line-through; color: var(--muted); }

/* ---------- Text on solid fills (dark mode uses bright fills with near-black text) ---------- */
.tag { color: var(--c-ink); }
.meal { color: var(--on-soft); }
.meal small, .meal .grip { color: var(--on-soft-muted); }
.meal .lo { color: var(--on-soft-muted); background: rgba(255, 255, 255, .45); }
.meal.is-off { color: var(--muted); }
.meal.is-off .lo { background: transparent; color: var(--muted); }
.today-meals li, .today-meals a { color: var(--on-soft); }
.today-meals li > .mi { color: var(--c-ink); }
.today-meals small { color: var(--on-soft-muted); }
.recipe-row .avatar-ico { color: var(--c-ink); }
.flag.soon { color: var(--b-ink); }
.flag.bad { color: var(--danger-ink); background: var(--danger-soft); }
.alert { color: var(--danger-ink); }
.alert.warn { color: var(--b-ink); }
.confirm { color: var(--danger-ink); }
.btn-danger:hover { color: var(--danger-ink); }
.mdots i { background: var(--c); }

/* Public pages: brand on the left of the top bar */
.pub-brand { flex: 1; display: flex; align-items: center; gap: 10px; padding-left: 10px; font-family: var(--head); font-size: 20px; color: var(--ink); text-decoration: none; min-width: 0; }
.pub-brand .mi { color: var(--accent); }
@media (min-width: 600px) { .pub-brand { padding-left: 4px; } }
/* House switcher at the top of the side menu */
.d-house { height: auto; min-height: 48px; padding-top: 6px; padding-bottom: 6px; margin-bottom: 4px; }
.d-house span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.d-house small { font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---------- Public landing page ---------- */
.lp { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; padding: 16px 0 24px; }
.lp-hero { display: grid; gap: 32px; align-items: center; }
.lp-eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 500; font-size: 14px; margin: 0 0 10px; }
.lp-hero h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.05; letter-spacing: -0.02em; margin-bottom: 16px; }
.lp-lead { font-size: 18px; color: var(--muted); max-width: 52ch; margin: 0 0 24px; }
.lp-cta { gap: 12px; margin-bottom: 12px; }
.lp-big { height: 48px; padding: 0 22px 0 18px; font-size: 16px; }
.lp-preview { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--sunk); border-radius: 5px; padding: 16px; }
.lp-day { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lp-day .meal { cursor: default; font-size: 13px; padding: 7px 8px; }
.lp-day-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.lp-day-head .dnum { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 500; }
.lp-day-2 .dnum { background: var(--high); color: var(--ink); }
.lp-card { grid-column: 1 / -1; background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.lp-card strong { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--accent); }
.lp-check { display: flex; align-items: center; gap: 10px; }
.lp-check::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--outline); border-radius: 3px; flex: none; }
.lp-check.is-done { color: var(--muted); text-decoration: line-through; }
.lp-check.is-done::before { background: var(--accent); border-color: var(--accent); }
.lp-section h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 20px; }
.lp-features { display: grid; gap: 14px; }
.lp-feature { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 18px; }
.lp-feature h3 { font-size: 17px; margin: 12px 0 6px; }
.lp-feature p { margin: 0; color: var(--muted); font-size: 15px; }
.lp-ico { width: 44px; height: 44px; border-radius: 5px; display: grid; place-items: center; background: var(--soft); color: var(--c-ink); flex: none; }
.lp-ico .mi { font-variation-settings: "FILL" 1, "opsz" 24; }
.lp-steplist { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 12px; font-size: 16px; max-width: 70ch; }
.lp-steplist li::marker { color: var(--accent); font-weight: 700; }
.lp-privacy { display: flex; gap: 18px; align-items: flex-start; background: var(--sunk); border-radius: 5px; padding: 22px; }
.lp-privacy h2 { margin-bottom: 6px; font-size: 22px; }
.lp-privacy p { margin: 0; color: var(--muted); max-width: 60ch; }
.lp-final { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 0; }
.lp-final h2 { font-size: clamp(24px, 3vw, 32px); }
.lp-foot { text-align: center; border-top: 1px solid var(--line); padding-top: 16px; }
@media (min-width: 700px) { .lp-features { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) {
	.lp-hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; padding-top: 24px; }
	.lp-features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Pages without the side menu (public pages, choosing a house) */
@media (min-width: 600px) {
	.shell.no-drawer { display: block; }
	.shell.no-drawer .main { margin: 0 16px 16px; }
}

/* Side menu: house switcher pinned to the bottom */
.drawer { display: flex; flex-direction: column; }
.drawer > nav { flex: 1 0 auto; }
.d-house { margin: 12px 0 0; border-top: 1px solid var(--line); border-radius: 0 5px 5px 0; padding-top: 10px; }

/* ---------- Family ---------- */
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.fam-card { display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; }
.fam-card:hover { border-color: var(--accent); }
.fam-card.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fam-top { display: flex; align-items: center; gap: 12px; }
.fam-av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 18px; flex: none; }
.fam-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fam-name strong { font-weight: 500; font-size: 16px; }
.fam-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.fam-nums b { color: var(--ink); font-weight: 500; font-size: 15px; }
.fam-nums .late b, .late { color: var(--danger, #c5221f); }
.fam-cols { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1024px) { .fam-cols:has(.fam-tasks) { grid-template-columns: 1fr 2fr; } }
.fam-feed h2, .fam-tasks h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.fam-day { font-size: 13px; font-weight: 500; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 4px; }
.fam-list { list-style: none; margin: 0; padding: 0; }
.fam-list li { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.fam-list li:first-child { border-top: 0; }
.fam-ico { color: var(--muted); flex: none; padding-top: 1px; }
.fam-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fam-text strong { font-weight: 500; }
.fam-text a { color: inherit; }
.fam-time { flex: none; white-space: nowrap; }
.fam-tasks .stat span:first-child { display: inline-flex; align-items: center; gap: 8px; }
a.chip { text-decoration: none; }
@media print { .fam-grid { grid-template-columns: repeat(3, 1fr); } .chips { display: none; } }

/* ---------- Barcode scan ---------- */
.scan-view { position: relative; background: #000; border-radius: 5px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 50vh; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 12%; right: 12%; top: 32%; bottom: 32%; border: 2px solid rgba(255,255,255,.9); border-radius: 5px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.scan-manual { gap: 8px; flex-wrap: nowrap; }
.scan-manual .input { flex: 1; min-width: 0; }
.scan-head { gap: 12px; align-items: center; flex-wrap: nowrap; }
.scan-img { width: 56px; height: 56px; object-fit: contain; border-radius: 5px; background: #fff; flex: none; }
.scan-full { flex-wrap: wrap; overflow: visible; }
.fam-invite { border-style: dashed; background: transparent; }
.fam-invite .fam-av { background: var(--sunk); color: var(--muted); }
#members h2 { display: flex; align-items: center; gap: 8px; }
.legal h2 { margin: 16px 0 0; } .legal p, .legal li { line-height: 1.6; } .legal ul { padding-left: 20px; margin: 0; } .legal li { margin: 6px 0; }

/* ---------- Product photos ---------- */
.ph-box { display: flex; align-items: center; gap: 12px; }
.ph-img { width: 88px; height: 88px; border-radius: 5px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--muted); }
.ph-img img { width: 100%; height: 100%; object-fit: contain; }
.ph-box.is-busy .ph-img { opacity: .5; }
.ph-btn { cursor: pointer; }
.scan-head { align-items: flex-start; }
.oh-row .menu-item.has-thumb { gap: 12px; }
.oh-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 5px; background: #fff; border: 1px solid var(--line); flex: none; }
@media print { .ph-btn { display: none; } }

/* ---------- Home: who ate today's meals, leftovers ---------- */
.today-meals li:has(> .meal-check) { padding: 0; }
.meal-check { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 12px 16px; border: 0; background: transparent; font: inherit; color: var(--on-soft); text-align: left; cursor: pointer; border-radius: 5px; }
.meal-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.meal-check > .mi { color: var(--c-ink); font-variation-settings: "FILL" 1, "opsz" 24; align-self: flex-start; margin-top: -4px; }
.meal-check .mc-text { flex: 1; min-width: 0; }
.meal-check .mc-name { display: block; font-weight: 500; font-size: 16px; margin: 2px 0; }
.meal-check .mc-side { display: flex; flex-direction: row; flex-wrap: wrap-reverse; align-items: center; justify-content: flex-end; gap: 6px 8px; flex: none; max-width: 55%; }
.today-meals li.is-off { opacity: .7; }
.my-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; border-radius: 5px; padding: 3px 8px; background: rgba(255, 255, 255, .55); color: var(--on-soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-check .mi { font-size: 14px; }
.my-check.is-none { background: transparent; border: 1px dashed currentColor; }
.who-dots { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.who { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 700; flex: none; border: 1px solid rgba(0, 0, 0, .25); }
.who-dots .who, .who-row .who { line-height: 1; }
.who-none { background: transparent; border: 1px dashed currentColor; color: inherit; font-weight: 500; }
.who.who-ate { background: var(--l); color: var(--paper); }
.who.who-other { background: var(--b-soft); color: var(--b-ink); font-style: italic; }
.who.who-skipped { background: var(--danger-soft); color: var(--danger-ink); text-decoration: line-through; }
.who-list { display: flex; flex-direction: column; }
.who-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 4px 0; border-top: 1px solid var(--line); }
.who-row:first-child { border-top: 0; }
.who-row .who { width: 28px; height: 28px; font-size: 13px; }
.who-row small { display: block; color: var(--muted); font-size: 12px; }
.who-btns { display: flex; gap: 2px; }
.who-btns .icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-soft-ink); }
.leftover { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
.leftover:first-child { border-top: 0; }
.leftover a { font-weight: 500; color: var(--ink); text-decoration: none; }
.leftover small { display: block; color: var(--muted); font-size: 12px; }
.reminder-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--line); }
.reminder-row:first-of-type { border-top: 0; }
.reminder-row .input { width: auto; min-width: 120px; }
.reminder-row .switch { min-height: 0; }
/* Narrow: the answer and initials sit on one line under the meal name */
.today-meals { container-type: inline-size; }
@container (max-width: 480px) {
	.meal-check { flex-wrap: wrap; row-gap: 6px; }
	.meal-check .mc-text { flex: 1 1 0; }
	.meal-check .mc-side { order: 3; flex: 1 1 100%; max-width: none; flex-direction: row-reverse; flex-wrap: nowrap; justify-content: flex-end; padding-left: 38px; }
}

/* On hand: "Already on hand" while adding food */
.have-box { background: var(--accent-soft); color: var(--accent-soft-ink); border-radius: 5px; padding: 10px 12px; margin-top: -6px; }
.have-title { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.have-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.have-row:nth-child(2) { border-top: 0; }
.have-name { flex: 1 1 140px; min-width: 0; font-weight: 500; color: var(--ink); }
.have-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.have-ctl { display: flex; align-items: center; gap: 8px; }
.have-row .stepper { background: var(--paper); }
.have-qty { width: 56px; border: 0; background: transparent; font: inherit; font-size: 14px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.have-qty::-webkit-inner-spin-button, .have-qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.have-qty:focus-visible { outline: 2px solid var(--accent); border-radius: 3px; }
.have-unit { font-size: 13px; color: var(--muted); padding-right: 2px; }
.have-row .have-add, .have-row .have-edit { padding-left: 0; padding-right: 0; }
.have-row .have-add { flex-basis: 100%; justify-content: flex-start; }
