/* Bem-Estar — identidade aplicada com moderação: amarelo limão e roxo elétrico como acentos,
   texto escuro sobre fundo claro para manter leitura e contraste. Funciona a partir de 320 px. */
:root {
  --yellow: #fdf112;
  --yellow-soft: #fffbd1;
  --purple: #a65afc;
  --purple-dark: #6a1fd0;   /* contraste AA com branco */
  --purple-soft: #f3eaff;
  --ink: #161616;
  --ink-2: #4a4a4a;
  --line: #e4e1d6;
  --bg: #fdfcf7;
  --card: #ffffff;
  --ok: #1d6b3a;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4b00;
  --err: #b3261e;
  --radius: 14px;
  --tap: 48px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; font-size: 1rem; min-width: 320px; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: .5rem 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; margin: .5rem 0; }
a { color: var(--purple-dark); }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 1rem;
  background: var(--yellow); border-bottom: 3px solid var(--purple); position: sticky; top: 0; z-index: 5; }
.brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--ink); min-height: var(--tap); }
.brand-logo { border-radius: 8px; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: .01em; }

.page { max-width: 720px; margin: 0 auto; padding: 1rem; }
.page.admin { max-width: 1100px; }
.footer { max-width: 720px; margin: 1.5rem auto 0; padding: 1rem; color: var(--ink-2); font-size: .85rem; border-top: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.card-muted { background: #faf9f3; }
.lead { font-size: 1.05rem; color: var(--ink-2); }
.small { font-size: .875rem; color: var(--ink-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.notice { background: var(--purple-soft); border-radius: 10px; padding: .75rem; font-size: .95rem; }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }
.pending { color: var(--warn-ink); background: var(--warn-bg); padding: 0 .35rem; border-radius: 6px; font-size: .9rem; }
.access-note { font-size: .875rem; color: var(--ink-2); text-align: center; margin-top: 1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: .5rem 1rem;
  border-radius: 12px; border: 2px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--purple-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-danger { background: #fff; color: var(--err); border-color: var(--err); }
.btn-link { background: none; border: none; color: var(--purple-dark); text-decoration: underline; min-height: 40px; padding: .25rem .5rem; }
.btn-block { display: flex; width: 100%; margin: .75rem 0; }
.actions { display: grid; gap: .5rem; }
.back-link { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }

.hero { text-align: center; padding: 1rem 0; }
.hero-logo { width: min(240px, 60vw); height: auto; margin: 0 auto 1rem; border-radius: 24px; }
.steps { padding-left: 1.25rem; }
.steps li { margin: .35rem 0; }

.state { text-align: center; padding: 2rem 0; }
.state-loading .spinner { display: inline-block; width: 32px; height: 32px; border: 4px solid var(--purple-soft); border-top-color: var(--purple-dark); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .state-loading .spinner { animation: none; } }
.terminal { text-align: center; }
.terminal-logo { width: 140px; height: auto; margin: 1rem auto; border-radius: 20px; }

.week-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.tab { display: flex; align-items: center; justify-content: center; text-align: center; min-height: var(--tap); padding: .35rem .5rem;
  border-radius: 12px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; font-size: .95rem; }
.tab.active { background: var(--ink); color: #fff; }
.tab.disabled { border-style: dashed; color: var(--ink-2); font-weight: 500; font-size: .8rem; }
.week-range { text-align: center; font-weight: 600; margin: .75rem 0 .25rem; }

.day-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; margin: .5rem 0 1rem; }
.day-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; padding: .25rem 0;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; color: var(--ink); }
.day-chip .chip-wd { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
.day-chip .chip-d { font-weight: 800; font-size: 1.05rem; }
.day-chip.active { border-color: var(--purple-dark); background: var(--purple-soft); }
.day-chip.muted { opacity: .55; }
.day-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.meals { display: grid; gap: .75rem; }
.meal-card { display: grid; grid-template-columns: 120px 1fr; gap: .75rem; align-items: center; padding: .5rem; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); min-height: var(--tap); }
.meal-card:hover { border-color: var(--purple); }
.meal-body { display: flex; flex-direction: column; gap: .2rem; }
.meal-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--purple-dark); font-weight: 800; }
.meal-name { font-weight: 600; line-height: 1.3; }
@media (min-width: 560px) { .meal-card { grid-template-columns: 180px 1fr; } }

.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #f1efe6; margin: 0; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-full img { object-fit: contain; background: #f6f4ec; }  /* ficha: nunca corta o prato */
.photo-pending { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); }
.photo-pending-text { font-size: .8rem; color: var(--ink-2); text-align: center; padding: .25rem; }
.photo-badge { position: absolute; left: .35rem; bottom: .35rem; background: rgba(0, 0, 0, .78); color: #fff; font-size: .75rem;
  font-weight: 700; padding: .15rem .45rem; border-radius: 6px; }
.photo-card .photo-badge { font-size: .65rem; }

.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; width: fit-content; }
.badge-draft { background: var(--warn-bg); color: var(--warn-ink); }
.badge-today { background: var(--yellow); color: var(--ink); }
.badge-open { background: #e3f4ea; color: var(--ok); }
.badge-active { background: var(--purple-soft); color: var(--purple-dark); }
.badge-expired { background: #fde7e6; color: var(--err); }

.recipe h1 { margin-top: .25rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: 1rem 0; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
.ingredients, .shop-list { list-style: none; padding: 0; margin: 0; }
.ingredients li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.ing-name { font-weight: 600; }
.ing-note { width: 100%; font-size: .85rem; color: var(--ink-2); }
.prep { padding-left: 1.25rem; }
.prep li { margin: .4rem 0; }
.nutrition { border-collapse: collapse; width: 100%; }
.nutrition caption { text-align: left; font-size: .85rem; color: var(--ink-2); }
.nutrition th, .nutrition td { text-align: left; padding: .35rem 0; border-bottom: 1px solid var(--line); }

.shop-cat h2 { border-bottom: 3px solid var(--yellow); padding-bottom: .25rem; }
.shop-list > li { display: grid; grid-template-columns: 28px 1fr; gap: .5rem; align-items: start; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.shop-list input[type="checkbox"] { width: 24px; height: 24px; margin-top: .15rem; accent-color: var(--purple-dark); }
.shop-list label { display: flex; flex-direction: column; gap: .15rem; }
.shop-list details { font-size: .85rem; color: var(--ink-2); }
.shop-list summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.uses { padding-left: 1rem; margin: .25rem 0; }

/* Administração */
.admin-nav { display: flex; gap: .25rem; overflow-x: auto; padding: .5rem 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.admin-nav a { white-space: nowrap; padding: .5rem .75rem; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.admin-nav a.active { background: var(--ink); color: #fff; }
.admin-login { max-width: 420px; margin: 2rem auto; }
.field { display: flex; flex-direction: column; gap: .25rem; margin: .5rem 0; flex: 1 1 180px; }
.field-label { font-weight: 600; font-size: .9rem; }
.field-hint { font-size: .8rem; color: var(--ink-2); }
input, select, textarea { font: inherit; min-height: 44px; padding: .4rem .6rem; border: 1px solid #bdb9ab; border-radius: 10px; background: #fff; max-width: 100%; }
textarea { min-height: 80px; }
input.narrow { width: 90px; }
input.inline { min-height: 36px; width: 140px; }
.form-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row-actions.col { flex-direction: column; align-items: stretch; }
.check { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; }
.check input { min-height: auto; width: 20px; height: 20px; }
.radio-group { border: 1px solid var(--line); border-radius: 10px; margin: .75rem 0; }
.feedback { min-height: 1.25rem; font-size: .9rem; margin: .5rem 0; }
.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--err); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table.compact td { font-size: .8rem; }
.table tr.voided td { color: var(--ink-2); text-decoration: line-through; }
.cycle-table select { max-width: 260px; }
.lot-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.lot-head h2 { margin: 0; }
.lot-qr { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: .75rem 0; }
.qr-preview img { width: 160px; height: 160px; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.lot-card details { border-top: 1px solid var(--line); padding: .5rem 0; }
.lot-card summary { cursor: pointer; font-weight: 700; min-height: 40px; display: flex; align-items: center; }
.admin-photo { max-width: 480px; }
.preview-frame { border: 3px dashed var(--purple); border-radius: var(--radius); overflow: hidden; }
.preview-frame .topbar { position: static; }
