/* Phone-first. Tokens from docs/05-ui.md. */
:root {
  --bg: #F1F4EF;
  --surface: #FFFFFF;
  --text: #17231C;
  --text-2: #4A5850;
  --primary: #2E6B45;
  --primary-soft: #E2EEE5;
  --primary-soft-text: #1F4F31;
  --line: #D6DED7;
  --chip: #E1E8E2;
  --chip-text: #2B3830;
  --input-border: #B9C5BC;
  --warn: #F5C451;
  --warn-text: #2E2100;
  --review-bg: #FFF6DC;
  --review-border: #E0B43A;
  --review-text: #5C4300;
  --radius: 14px;
  --nav-height: 64px;
  --heading: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
}

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* One phone-width column, centred on larger screens. */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
}

.app-main {
  padding: max(20px, env(safe-area-inset-top)) 16px calc(var(--nav-height) + 24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.page-title {
  margin: 0;
  font-family: var(--heading);
  font-size: 32px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.muted { color: var(--text-2); font-size: 14px; margin: 0; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.bottom-nav-item.active { color: var(--primary); }

/* Diet badges */
.diet-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.diet-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  font-size: 12px;
  font-weight: 600;
}
.diet-badge.unknown { background: transparent; border: 1px dashed var(--input-border); color: var(--text-2); }

/* Recipe cards */
.recipe-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.recipe-card-image {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  background: var(--primary-soft);
}
.recipe-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.recipe-card-title {
  display: block;
  width: 100%;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}
.recipe-card-meta { font-size: 13px; color: var(--text-2); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--chip-text);
  font-size: 12px;
  font-weight: 600;
}

/* Shopping list */
.group-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3E4B43;
}
.shop-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 0;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.shop-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 2px solid var(--input-border);
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--surface);
}
.shop-row.checked .shop-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.shop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.shop-name { font-size: 16px; font-weight: 500; }
.shop-qty { font-size: 15px; font-weight: 600; white-space: nowrap; }
.shop-row.checked .shop-name, .shop-row.checked .shop-qty { color: var(--text-2); text-decoration: line-through; font-weight: 500; }
.hint-recent {
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--warn);
  color: var(--warn-text);
  font-size: 12px;
  font-weight: 600;
}
.hint-old { font-size: 12px; color: var(--text-2); }

/* Editor */
.line-row {
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.line-row.review { background: var(--review-bg); border-color: var(--review-border); }
.review-text { color: var(--review-text); font-size: 13px; }
.pantry-tag { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.diet-box {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sticky-footer {
  position: sticky;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 8px);
  display: flex;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(23, 35, 28, 0.08);
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--input-border);
  border-radius: var(--radius);
}

/* Plain-HTML buttons (sign-in page renders without MudBlazor interactivity) */
.btn-primary, .btn-outline {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  font: 600 16px 'Instrument Sans', system-ui, sans-serif;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; border: 0; }
.btn-outline { background: var(--surface); color: var(--primary); border: 1px solid var(--primary); }
.btn-block { width: 100%; }

.login { display: flex; flex-direction: column; gap: 16px; padding-top: 15vh; }
.login-error { padding: 12px; border-radius: var(--radius); background: var(--review-bg); color: var(--review-text); margin: 0; }
.dev-login { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; font-size: 13px; color: var(--text-2); }
.dev-login input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 10px; font: inherit; font-size: 16px;
}

/* MudBlazor touch targets */
.mud-button-root { min-height: 44px; }
.mud-chip { min-height: 36px; }

#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: var(--review-bg);
  z-index: 1000;
}
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
