:root {
  --bg: #f7f5ef;
  --surface: #ffffff;
  --text: #1d2a22;
  --muted: #5a6b60;
  --brand: #2f6b4f;
  --brand-text: #ffffff;
  --ok: #2f6b4f;
  --error: #a33a2b;
  --radius: 16px;
  --tap: 56px; /* minimum tap target: big enough one-handed at the high chair */
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131815;
    --surface: #1d2420;
    --text: #e8eee9;
    --muted: #a5b3aa;
    --brand: #6fbf93;
    --brand-text: #0e1a13;
    --ok: #6fbf93;
    --error: #f08a7a;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.bar {
  padding: 16px;
}

.bar h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--brand);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px 16px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.status {
  margin: 0;
  font-weight: 600;
}

.status[data-state="ok"] {
  color: var(--ok);
}

.status[data-state="error"] {
  color: var(--error);
}

.status[data-state="pending"] {
  color: var(--muted);
}

.tap {
  min-height: var(--tap);
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-text);
  font: inherit;
  font-weight: 600;
  touch-action: manipulation;
  cursor: pointer;
}

.tap:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

.tap.secondary {
  background: transparent;
  color: var(--brand);
  border: 2px solid var(--brand);
}

.tap:disabled {
  opacity: 0.6;
  cursor: progress;
}

[hidden] {
  display: none !important;
}

.form,
.screen-part {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form h2 {
  margin: 0;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.form input {
  min-height: var(--tap);
  padding: 0 14px;
  border: 2px solid var(--muted);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.form input:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 1px;
}

.error {
  margin: 0;
  color: var(--error);
  font-weight: 600;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.status:empty {
  display: none;
}

/* Setup */

.step {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
}

.card p.notice,
.notice {
  margin: 0;
  padding: 12px 14px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
}

.groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.group h3 {
  margin: 0 0 4px;
  font-size: 1.125rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.group h3 small {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
}

.group .hint {
  margin: 0 0 8px;
  font-size: 0.875rem;
}

.foods {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.food {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.food-toggle {
  min-height: var(--tap);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  touch-action: manipulation;
  cursor: pointer;
}

.food-toggle:focus-visible,
.food select:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.food-toggle .badge {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid var(--muted);
  color: var(--muted);
}

.food-toggle[data-status="eats"] {
  border-color: var(--brand);
}

.food-toggle[data-status="eats"] .badge {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-text);
}

.food-toggle[data-status="tried"] .badge {
  border-color: var(--brand);
  color: var(--brand);
}

.food label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.food select {
  flex: 1;
  min-height: var(--tap);
  padding: 0 12px;
  border: 2px solid var(--muted);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.choice {
  display: flex;
  gap: 12px;
}

.tap-option {
  flex: 1;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 2px solid var(--muted);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

.form label.tap-option {
  flex-direction: row;
}

.tap-option:has(input:checked) {
  border-color: var(--brand);
  color: var(--brand);
}

.form .tap-option input {
  flex: none;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  margin: 0;
  accent-color: var(--brand);
}

.tap-option.check {
  padding: 12px 16px;
  font-weight: 400;
}

.risk-yes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Today's plan */

.today-title {
  margin: 0;
  font-size: 1.5rem;
}

.plan {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slot {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slot h3,
.coverage h3,
.earlier {
  margin: 0;
  font-size: 1.125rem;
}

.slot.next {
  border: 3px solid var(--brand);
}

.slot.next h3 {
  color: var(--brand);
  font-size: 1.375rem;
}

.earlier {
  color: var(--muted);
}

.item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg);
}

.item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-name {
  font-size: 1.25rem;
}

.badge.stretch {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.card .stage,
.card .reason,
.card .label {
  margin: 0;
  font-size: 0.9375rem;
}

.card .label {
  margin-top: 8px;
  font-weight: 600;
  color: var(--text);
}

.plan details > summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  touch-action: manipulation;
}

.guidance,
.gaps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9375rem;
}

.sources a {
  display: inline-block;
  padding: 2px 0;
  color: var(--brand);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
}

.chip.covered {
  border-color: var(--brand);
  color: var(--brand);
}

.coverage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gaps {
  color: var(--muted);
}

.note-card > summary {
  padding: 0;
}

.turning-one {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.turning-one h3 {
  margin: 0;
  color: var(--brand);
}

.card .notice.pediatrician {
  margin-top: 8px;
  font-weight: 600;
}

.card .follows {
  margin-top: 6px;
  font-size: 0.9375rem;
  color: var(--text);
}

.note {
  padding: 16px;
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
}

/* Logging (ticket 06): one tap per outcome, every target at least --tap high. */

.log-panel,
.logged,
.unplanned {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.stage-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
}

.stage-select,
.food-select,
.slot-select {
  flex: 1;
  min-height: var(--tap);
  padding: 0 12px;
  border: 2px solid var(--muted);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.outcomes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tap.outcome {
  padding: 8px;
}

.tap.outcome.concern {
  grid-column: 1 / -1;
  background: transparent;
  color: var(--error);
  border: 2px solid var(--error);
}

.tap.outcome[aria-pressed="true"] {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.tap.small {
  font-size: 0.9375rem;
}

.log-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.note-editor .log-actions {
  grid-template-columns: 1fr 1fr;
}

.logged-line {
  margin: 0;
  font-size: 1.125rem;
  color: var(--ok);
}

.logged.refused .logged-line,
.logged.concern .logged-line {
  color: var(--text);
}

.card .logged-by,
.card .log-note {
  font-size: 0.9375rem;
}

.log-note {
  white-space: pre-wrap;
  color: var(--text);
}

.note-input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 2px solid var(--muted);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.concern-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 2px solid var(--error);
  border-radius: 12px;
  background: var(--surface);
}

.concern-panel h4 {
  margin: 0;
  color: var(--error);
}

.sync {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.sync:empty {
  display: none;
}

.sync[data-state="error"] {
  color: var(--error);
}

.history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-list,
.history-logs {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-food {
  width: 100%;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.history-food strong {
  flex: 1;
}

.history-group > summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.badge.status,
.badge.concern {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid var(--muted);
  color: var(--muted);
}

.badge.status.accepted {
  border-color: var(--ok);
  color: var(--ok);
}

.badge.concern {
  border-color: var(--error);
  color: var(--error);
}

.history-log {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg);
}

.history-log p {
  margin: 2px 0 0;
}


/* Family dish ideas: the swipe deck (src/web/swipe.ts) ------------------------ */

.dish-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.dish-tab {
  min-height: var(--tap);
  padding: 4px;
  border: 2px solid var(--brand);
  border-radius: 12px;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  touch-action: manipulation;
  cursor: pointer;
}

.dish-tab[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-text);
}

.dish-tab:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.deck-stack {
  position: relative;
  display: grid;
}

.deck-stack > .dish-card {
  grid-area: 1 / 1;
}

.dish-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
  transition: transform 220ms ease-out;
}

.dish-card.behind {
  transform: translateY(10px) scale(0.96);
  opacity: 0.6;
  pointer-events: none;
}

.dish-card.dragging {
  transition: none;
}

.dish-card.flung {
  opacity: 0;
  transition: transform 220ms ease-in, opacity 220ms ease-in;
}

.dish-face {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* The face is the drag handle; the body below scrolls as usual. */
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.dish-card.dragging .dish-face {
  cursor: grabbing;
}

.dish-name {
  margin: 0;
  font-size: 1.375rem;
}

.dish-row .dish-name {
  font-size: 1.125rem;
}

.dish-description {
  margin: 0;
}

.badge.cuisine {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  border: 2px solid var(--muted);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.chip.new-allergen {
  border-color: var(--error);
  color: var(--error);
}

.dish-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dish-body details > summary,
.dish-row details > summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  touch-action: manipulation;
}

.stamp {
  position: absolute;
  top: 16px;
  padding: 4px 12px;
  border: 3px solid currentColor;
  border-radius: 10px;
  font-weight: 800;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  background: var(--surface);
  z-index: 1;
}

.stamp-right {
  left: 16px;
  color: var(--ok);
  transform: rotate(-10deg);
}

.stamp-left {
  right: 16px;
  color: var(--error);
  transform: rotate(10deg);
}

.stamp-up {
  left: 50%;
  translate: -50% 0;
  color: var(--brand);
}

.dish-card[data-hint="right"] .stamp-right,
.dish-card[data-hint="left"] .stamp-left,
.dish-card[data-hint="up"] .stamp-up {
  opacity: 1;
}

.swipe-actions {
  position: sticky;
  bottom: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  z-index: 2;
}

.swipe-actions .tap {
  min-height: calc(var(--tap) * 1.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  font-size: 0.875rem;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
}

.swipe-actions .arrow {
  font-size: 1.75rem;
  line-height: 1;
}

.swipe-left {
  background: var(--error);
}

.keys {
  font-size: 0.875rem;
  text-align: center;
}

.dish-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dish-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dish-row .badge.stretch {
  align-self: flex-start;
}

.match-banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 2px solid var(--brand);
}

.match-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 50%);
  z-index: 10;
}

.match-card {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.match-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  .dish-card,
  .dish-card.flung {
    transition: none;
  }
}
