:root {
	--paper: #f3eee4;
	--paper-2: #e7dfd0;
	--card: #fffdf8;
	--ink: #1f1a14;
	--muted: #6a6156;
	--line: #e2d7c6;
	--herb: #2d6a4f;
	--herb-2: #40916c;
	--herb-soft: #d8eee3;
	--clay: #c05621;
	--danger: #9b2c2c;
	--shadow: 0 10px 28px rgba(48, 32, 16, 0.08);
	--radius: 18px;
	--tab-h: 68px;
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-t: env(safe-area-inset-top, 0px);
	font-family: Nunito, system-ui, sans-serif;
	color: var(--ink);
	background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
	background:
		radial-gradient(1200px 500px at 10% -10%, #f8e7cf 0%, transparent 50%),
		var(--paper);
	padding-top: calc(76px + var(--safe-t));
	padding-bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
}

button, input, select, textarea {
	font: inherit;
	color: inherit;
}

h1, h2, h3 { font-family: Fraunces, Georgia, serif; margin: 0; font-weight: 650; }

.top {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: calc(10px + var(--safe-t)) 16px 10px;
	background: color-mix(in srgb, var(--paper) 86%, white);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark {
	width: 38px;
	height: 38px;
	border-radius: 12px;
	display: grid;
	place-items: center;
	background: var(--herb);
	color: #fff;
	font-family: Fraunces, serif;
	font-weight: 650;
}
.brand__kicker {
	margin: 0;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 700;
}
.brand h1 { font-size: 20px; line-height: 1.15; }

.icon-btn {
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 14px;
	background: var(--herb);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	display: grid;
	place-items: center;
	cursor: pointer;
}
.icon-btn--ghost {
	background: transparent;
	color: var(--ink);
	font-size: 28px;
}
.icon-btn--small {
	width: 34px;
	height: 34px;
	font-size: 20px;
	background: var(--herb-soft);
	color: var(--herb);
}

.app { padding: 12px 16px 8px; max-width: 720px; margin: 0 auto; }

.week {
	display: grid;
	grid-template-columns: 36px 1fr 36px;
	gap: 8px;
	align-items: center;
	margin-bottom: 14px;
}
.week__days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}
.day {
	border: 0;
	background: transparent;
	padding: 8px 0 7px;
	border-radius: 14px;
	cursor: pointer;
}
.day__name { display: block; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.day__num { display: block; font-size: 16px; font-weight: 800; margin-top: 2px; }
.day.is-today { background: var(--herb-soft); }
.day.is-active { background: var(--herb); color: #fff; }
.day.is-active .day__name { color: rgba(255,255,255,0.8); }
.day.has-meals .day__num::after {
	content: "";
	display: block;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--clay);
	margin: 4px auto 0;
}
.day.is-active.has-meals .day__num::after { background: #fff; }

.date-label {
	margin: 0 0 12px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
}

.slot {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 12px;
	margin-bottom: 10px;
	box-shadow: var(--shadow);
}
.slot__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}
.slot__title { font-size: 15px; }
.slot__empty { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.meal {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	border-top: 1px dashed var(--line);
}
.meal:first-of-type { border-top: 0; }
.meal__info { flex: 1; min-width: 0; }
.meal__name { font-weight: 800; }
.meal__meta { font-size: 12px; color: var(--muted); font-weight: 700; }
.meal__actions { display: flex; gap: 6px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px;
	box-shadow: var(--shadow);
	text-align: left;
	width: 100%;
	cursor: pointer;
}
.card h3 { font-size: 18px; margin-bottom: 4px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
	background: var(--paper-2);
	border-radius: 999px;
	padding: 4px 8px;
	font-size: 12px;
	font-weight: 700;
}
.group-title {
	margin: 16px 0 8px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}

.search {
	width: 100%;
	border: 1px solid var(--line);
	background: var(--card);
	border-radius: 14px;
	padding: 12px 14px;
	margin-bottom: 12px;
}

.period {
	display: flex;
	gap: 8px;
	overflow: auto;
	padding-bottom: 4px;
	margin-bottom: 12px;
}
.period button, .btn {
	border: 0;
	background: var(--paper-2);
	border-radius: 999px;
	padding: 9px 14px;
	font-weight: 800;
	cursor: pointer;
	white-space: nowrap;
}
.period button.is-active, .btn--primary {
	background: var(--herb);
	color: #fff;
}
.btn--danger { background: #f8d7d0; color: var(--danger); }
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-height: 44px; }

.shop-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 12px;
}
.shop-item input { width: 20px; height: 20px; margin-top: 2px; }
.shop-item.is-done { opacity: 0.5; }
.shop-item.is-done .shop-item__name { text-decoration: line-through; }
.shop-item__name { font-weight: 800; }
.shop-item__qty { color: var(--herb); font-weight: 800; }
.shop-item__src { font-size: 12px; color: var(--muted); }

.tabs {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 20;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	background: #fffdf8;
	border-top: 1px solid var(--line);
	padding: 6px 6px calc(6px + var(--safe-b));
}
.tabs__item {
	border: 0;
	background: transparent;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	font-size: 11px;
	font-weight: 800;
	color: var(--muted);
	padding: 6px 0;
	cursor: pointer;
}
.tabs__item svg { width: 22px; height: 22px; }
.tabs__item.is-active { color: var(--herb); }

.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(31, 26, 20, 0.4); }
.sheet__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 92vh;
	overflow: auto;
	background: var(--card);
	border-radius: 24px 24px 0 0;
	padding: 8px 16px calc(20px + var(--safe-b));
}
.sheet__handle {
	width: 42px;
	height: 4px;
	border-radius: 99px;
	background: var(--line);
	margin: 6px auto 8px;
}
.sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 800; }
.field input, .field select, .field textarea {
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 11px 12px;
	background: #fff;
	min-height: 44px;
}
.item-row {
	display: grid;
	grid-template-columns: 1fr 72px 78px 34px;
	gap: 6px;
	margin-bottom: 8px;
	align-items: center;
}

.empty {
	text-align: center;
	padding: 28px 12px;
	color: var(--muted);
}
.empty h2 { margin-bottom: 6px; }

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
	transform: translateX(-50%);
	background: var(--ink);
	color: #fff;
	padding: 10px 14px;
	border-radius: 12px;
	z-index: 50;
	font-weight: 700;
	max-width: calc(100% - 32px);
}

.stepper {
	display: flex;
	align-items: center;
	gap: 8px;
}
.stepper input {
	width: 64px;
	text-align: center;
}

@media (min-width: 760px) {
	.app { padding-top: 18px; }
	.list { display: grid; grid-template-columns: 1fr 1fr; }
}
