/* Kidney Diet Log — meal guidance (js/views/guidance.js): "What fits now" in Add, the Meal ideas and
   insight cards on Today, period insights on Trends, the guidance sheet (plan the day, a meal that
   fits, treating a low), swap ideas in the entry sheet, Settings → Meal guidance. Colours come from
   the tokens in base.css, so light and dark follow the theme; every number is also in the text. */

/* ---------- shared ---------- */
.guidance-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.guidance-actions .btn { flex: 1 1 auto; min-width: min(100%, max-content); } /* a label longer than the row wraps (large text) */
.guidance-meal-pick { margin-bottom: 10px; }
.guidance-body { display: flex; flex-direction: column; gap: 12px; }
.guidance-body[aria-busy="true"], .g-plan-out[aria-busy="true"], .g-swaps[aria-busy="true"] { opacity: 0.7; }
.g-idle { margin: 0; }
.g-loading { margin: 0; }
.g-room {
  margin: 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2);
  font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere;
}
/* "Using the targets in your profile, saved …" under the room line and in the plan sheet (note 06 R10). */
.g-targets { margin: 0; overflow-wrap: anywhere; }
.g-targets .link-btn { white-space: nowrap; }
.g-group { display: flex; flex-direction: column; gap: 4px; }
.g-group-title { font-size: 0.8rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 4px 0 0; }
.g-notes p { margin: 0; }
.g-learn { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 0 14px; }
.g-tip { background: var(--accent-tint); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 0.9rem; }
.g-tip p { margin: 0; }
.g-offline { margin: 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--caution-tint); color: var(--text); font-size: 0.9rem; }
.g-unavailable { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.g-unavailable p { margin: 0; }

/* ---------- a suggested food ---------- */
.g-foods { display: flex; flex-direction: column; }
.g-foods > li + li { border-top: 1px solid var(--border); }
.g-food { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 0; }
.g-food-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.g-food-main .rating { margin-top: 2px; }
.g-food-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.g-fit { font-size: 0.82rem; color: var(--text-2); }
.g-reason { font-size: 0.85rem; color: var(--text); }
.g-actions { display: flex; align-items: center; gap: 6px; }
.g-act { min-height: var(--tap); padding: 0 12px; }
.g-more { color: var(--text-2); }
.g-more[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.g-menu {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2);
}
.g-menu .hint { margin: 0; flex: 1 1 100%; }
/* More like this / Less often / Not for me: a toggle shows its state with a check mark as well as the colour (note 09 §4.10). */
.g-pref[aria-pressed="true"] { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.g-pref[aria-pressed="true"]::before { content: "✓"; content: "✓" / ""; }
.g-menu[aria-busy="true"] { opacity: 0.7; }
@media (max-width: 560px) {
  .g-food { grid-template-columns: 1fr; }
  .g-actions { padding-left: 34px; flex-wrap: wrap; }
}
.g-meal-chips { padding: 2px 0 4px; }
.g-meal-chips .meal-chip { max-width: 280px; }
/* "Your usual dinner: egg white, bread, ..." is long: two lines of it, not one cut at the edge. */
.g-meal-chips .meal-chip-name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }

/* ---------- insights (Today, Trends) ---------- */
.g-insights { display: flex; flex-direction: column; gap: 8px; }
.g-insight { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--lv-tint); font-size: 0.92rem; }
.g-insight.level-info { --lv-tint: var(--surface-2); }
.g-insight p { margin: 0; }
.g-insight .rating { margin-top: 1px; }
.g-insight-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.g-info-icon .shape { fill: var(--accent); }
.g-info-icon .glyph { fill: var(--surface); }

/* ---------- the guidance sheet: plan, meal, low ---------- */
/* Plan view: "Plan a day…", "Plan several days…" and "Copy day…"; on a phone they wrap instead of overflowing. */
.plan-actions { flex-wrap: wrap; justify-content: flex-end; }
.g-plan-meals { margin-top: 2px; }
.g-plan-options { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; }
.g-plan-out { display: flex; flex-direction: column; gap: 12px; }
.g-plan-out > .hint { margin: 0; }
.g-plan-meal { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.g-plan-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.g-plan-title { font-size: 1rem; }
.g-source { font-size: 0.8rem; color: var(--text-2); font-weight: 600; overflow-wrap: anywhere; }
.g-portions { margin: 0; }
.g-portions .rating { width: 18px; height: 18px; }
.g-totals { margin: 0; font-size: 0.85rem; color: var(--text-2); }
.g-why { list-style: disc; padding-left: 20px; margin: 0; font-size: 0.88rem; }
.g-why li + li { margin-top: 2px; }
.g-after { display: flex; flex-direction: column; gap: 8px; }
.g-after-list { display: flex; flex-direction: column; gap: 4px; }
.g-after-row { display: grid; grid-template-columns: minmax(96px, 1fr) auto auto; gap: 8px; align-items: center; font-size: 0.88rem; }
.g-after-label { font-weight: 600; }
@media (max-width: 420px) {
  .g-after-row { grid-template-columns: 1fr auto; }
  .g-after-row .tabular { grid-column: 1 / -1; grid-row: 2; color: var(--text-2); }
}

/* "Plan several days" (js/views/plandays.js, note 23): the range, one folding box a day, the range's shopping list. */
.g-days-range { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 8px 12px; }
.g-days-range .field { margin: 0; }
.g-days-range input[type="number"] { max-width: 8rem; }
.g-days-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.g-days-clear { margin: 0; }
.g-days-day { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; }
.g-days-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.g-days-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: var(--tap); cursor: pointer; }
.g-days-date { font-weight: 700; }
.g-days-repeat { margin: 0; }
.g-days-shop { display: flex; flex-direction: column; gap: 8px; }
.g-days-shop-list { margin: 0; }
.g-days-added { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border-left: 4px solid var(--accent); background: var(--accent-tint); border-radius: var(--radius-sm); padding: 10px 12px; }
.g-days-added p { margin: 0; flex: 1 1 14rem; }
/* Plan several days, the owner's answers (note 23 §12): the past-meal note, the question about it, the repeat choices and marks. */
.g-days-past { margin: 0; }
.g-days-ask:empty { display: none; }
.g-days-repeat-meals { margin-bottom: 4px; }
.g-days-ok-items { margin: 0; }
.g-days-settings { display: flex; flex-direction: column; gap: 6px; }
.g-days-ok-items li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--tap); }
.g-meal-repeat-ok { min-height: var(--tap); }
.g-meal-repeat-ok[aria-pressed="true"] { color: var(--accent); font-weight: 700; }
.g-meal-repeat-ok[aria-pressed="true"]::before { content: "✓ "; content: "✓ " / ""; }

/* "Treating a low": information, never a warning (its colours are not the caution or over palette). */
.g-low { display: flex; flex-direction: column; gap: 12px; }
.g-lowcard { border-left: 4px solid var(--accent); background: var(--accent-tint); border-radius: var(--radius-sm); padding: 10px 12px; }
.g-lowcard h3 { font-size: 1rem; margin: 0 0 6px; }
.g-lowcard-lines { list-style: disc; padding-left: 20px; margin: 0; font-size: 0.92rem; }
.g-lowcard-lines li + li { margin-top: 4px; }
.g-low-btn { border-color: var(--accent); }
.badge.low { color: var(--text); background: var(--accent-tint); text-transform: none; letter-spacing: 0; font-size: 0.72rem; }

/* ---------- entry sheet ---------- */
.entry-hypo { flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; } /* a flex item of the scrolling sheet body: never squeezed */
.entry-hypo .check { margin: 0; min-height: var(--tap); align-items: center; font-size: 0.95rem; font-weight: 600; }
.entry-hypo .check input { margin: 0; }
.entry-hypo .hint { margin: 0 0 0 28px; }
/* Ticked, the note in the warnings block above says the same (browsers without :has keep the hint). */
.entry-hypo:has(#entry-hypo:checked) .hint { display: none; }
/* A low treatment is never warned against: the food's rating pill and warning flag chips are not shown. */
#sheet-entry[data-hypo="true"] #sheet-entry-food .pill, #sheet-entry[data-hypo="true"] #sheet-entry-flags .flag-chip.warn { display: none; }
.guidance-sheet .sheet-body > * { flex-shrink: 0; }
.entry-guidance:empty { display: none; }
.g-disclosure { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; }
.g-disclosure > summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: var(--tap); display: flex; align-items: center; }
.g-disclosure[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.g-disclosure[open] { padding-bottom: 10px; }
.g-swaps { display: flex; flex-direction: column; gap: 10px; }
.g-portion { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.g-portion p { margin: 0; flex: 1 1 220px; font-size: 0.9rem; }
.g-hypo-note { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--accent-tint); font-size: 0.9rem; }
.g-hypo-note p { margin: 0; }
.g-hypo-note p + p { margin-top: 4px; }

/* ---------- optional AI on top of the rules ---------- */
.g-ai-bar { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.g-ai-bar .hint { margin: 0; }
.g-ai-toggle[aria-pressed="true"] { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }
.g-ai-badge {
  display: inline-flex; align-items: center; font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text); margin-left: 6px; vertical-align: middle; white-space: nowrap;
}
.g-ai-why .g-ai-badge, .row-title > .g-ai-badge:first-child { margin-left: 0; }
.g-ai-why { font-size: 0.85rem; color: var(--text-2); }
.g-ai-swap { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.g-ai-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.g-ai-plan-note { margin: 0 0 8px; }
.g-ai-msg:empty, .g-ai-setting:empty { display: none; }

/* ---------- Settings → Meal guidance → Your food preferences ---------- */
.g-prefs { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.g-prefs > .settings-subtitle { margin: 0; padding: 0; border: 0; scroll-margin-top: 72px; }
.g-prefs-intro, .g-taste-note { margin: 0; }
.g-taste-note { background: var(--accent-tint); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 0.9rem; }
.g-pref-foods, .g-learned { display: flex; flex-direction: column; gap: 14px; }
.g-pref-group { display: flex; flex-direction: column; gap: 4px; }
.g-pref-head { font-size: 0.95rem; margin: 0; }
.g-learned > .g-pref-head { margin-top: 2px; }
.g-pref-kind { font-size: 0.8rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 4px 0 0; }
.g-prefs > .settings-subtitle:focus, .g-pref-head:focus, .g-pref-kind:focus, .g-pref-row:focus { outline: none; }
.g-prefs > .settings-subtitle:focus-visible, .g-pref-head:focus-visible, .g-pref-kind:focus-visible, .g-pref-row:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px;
}
.g-pref-list { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; }
.g-pref-list > li + li { border-top: 1px solid var(--border); }
.g-pref-list .empty-state, .g-pref-count { padding: 10px 2px; margin: 0; }
@media (max-width: 560px) { .g-pref-row .g-actions { padding-left: 0; } } /* no rating icon to line up with */
.g-kept { font-weight: 600; color: var(--text); }
.g-pref-group > .hint { margin: 0; }
.g-hidden-meals { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.g-hidden-meals p { margin: 0; flex: 1 1 220px; }
.g-prefs .status-msg:empty, .g-prefs .form-error:empty { display: none; }
.g-ai-pref:empty { display: none; }
.g-ai-pref .status-msg { margin: 4px 0 0; }
/* Kinds of food: a row per kind with None / Like / Less often / Never suggest (radios drawn as the meal picker's segments). */
.g-kinds > .hint { margin: 0 0 8px; }
.g-kind-list { display: grid; grid-template-columns: 1fr; gap: 10px 20px; }
.g-kind { border: 0; padding: 0; margin: 0; min-width: 0; }
.g-kind-name { padding: 0; margin-bottom: 4px; font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.g-kind-seg { position: relative; }
@media (min-width: 900px) { .g-kind-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* The "⋯" menu inside a plan item (the sheet's compact list): the menu takes a line of its own. */
.g-portions li { flex-wrap: wrap; }
.g-portions li .g-menu { flex: 1 1 100%; }
