@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/fraunces-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Paleta oficial — Manual de Marca Vila do Moinho: espresso #1D1713, terracota #B38D7C,
   blush #D2B5A9, verde #284630, greige #D6CDC0, creme #F5F4EE.
   Verde é a cor dominante (cabeçalho, botões); terracota aparece como destaque pontual
   (foto, estado "feito"). Terracota não tem contraste suficiente para texto pequeno
   (2,7:1) — por isso --accent-text usa uma variante escurecida dela (5,0:1) só para
   "editável"/dicas. --green serve tanto preenchimento quanto texto no modo claro; no
   modo escuro são tokens separados (--green-fill maior contraste para texto branco). */
:root {
  --green: #284630; --green-fill: #284630; --green-2: #1d3423; --green-soft: #dcdfd7;
  --terracotta: #b38d7c; --on-terracotta: #1d1713;
  --cream: #f5f4ee; --paper: #fffcf7; --ink: #1d1713; --muted: #7a6a5c; --line: #e6ddd0;
  --accent-text: #7d6357; --danger: #a8402f; --radius: 14px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif; --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #9bc2a5; --green-fill: #1f3528; --green-2: #b7d7bf; --green-soft: #2d4034;
    --terracotta: #b38d7c; --on-terracotta: #1d1713;
    --cream: #1d1713; --paper: #332720; --ink: #f5f4ee; --muted: #b8ab9d; --line: #4a392e;
    --accent-text: #c49b7f; --danger: #e0806f;
  }
}
/* mesmos valores, forçados por um botão no menu (independe do tema do aparelho) */
:root[data-theme="dark"] {
  --green: #9bc2a5; --green-fill: #1f3528; --green-2: #b7d7bf; --green-soft: #2d4034;
  --terracotta: #b38d7c; --on-terracotta: #1d1713;
  --cream: #1d1713; --paper: #332720; --ink: #f5f4ee; --muted: #b8ab9d; --line: #4a392e;
  --accent-text: #c49b7f; --danger: #e0806f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.4; }
body { padding-bottom: env(safe-area-inset-bottom); }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; font-optical-sizing: auto; margin: 0; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }

/* Barra superior */
.top { position: sticky; top: 0; z-index: 10; background: var(--green-fill); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 12px; }
.top-row { display: flex; align-items: center; gap: 10px; }
.logo { height: 34px; }
.top h1 { font-size: 19px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { background: rgba(255,255,255,.14); border: 0; color: #fff; width: 42px; height: 42px; border-radius: 12px; font-size: 20px; display: grid; place-items: center; flex: none; }
.iconbtn:active { background: rgba(255,255,255,.28); }
.search { margin-top: 10px; display: flex; background: var(--paper); border-radius: 12px; align-items: center; padding: 0 12px; }
.search input { flex: 1; border: 0; background: none; padding: 12px 6px; font: inherit; color: var(--ink); min-width: 0; outline: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 8px 14px; font-size: 15px; white-space: nowrap; }
.chip.on { background: var(--green-fill); border-color: var(--green-fill); color: #fff; }
.chip small { opacity: .65; margin-left: 4px; }

/* Lista */
.wrap { padding: 12px 16px 90px; max-width: 760px; margin: 0 auto; }
.count { color: var(--muted); font-size: 14px; margin: 6px 2px 10px; }
.grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
.card { display: flex; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: left; width: 100%; text-decoration: none; color: inherit; }
.card:active { background: var(--green-soft); }
.thumb { width: 64px; height: 64px; border-radius: 12px; background: var(--green-soft) center/cover no-repeat; flex: none; display: grid; place-items: center; font-family: var(--serif); font-size: 26px; color: var(--green); }
.card .t { flex: 1; min-width: 0; }
.card .t b { display: block; font-family: var(--serif); font-size: 18px; line-height: 1.2; }
.card .t span { color: var(--muted); font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* Receita */
.photo { position: relative; background: var(--green-soft); }
.photo .main { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.photo .ph { aspect-ratio: 16/8; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 10px; }
.strip { display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; background: var(--cream); }
.strip img { height: 56px; width: 56px; object-fit: cover; border-radius: 10px; border: 2px solid transparent; flex: none; }
.strip img.on { border-color: var(--green); }
.addphoto { position: absolute; right: 12px; bottom: 12px; background: var(--terracotta); color: var(--on-terracotta); border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.delphoto { position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.55); color: #fff; border: 0; border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.tag { background: var(--green-soft); color: var(--green); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; }
.tabs { display: flex; position: sticky; top: calc(62px + env(safe-area-inset-top)); z-index: 9; background: var(--cream); border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 14px 6px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--green); border-bottom-color: var(--green); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tile small { color: var(--muted); display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile b { font-family: var(--serif); font-size: 21px; }
.scale { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
.scale label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stepper { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--cream); font-size: 24px; }
.stepper input, .field { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--cream); color: var(--ink); border-radius: 12px; padding: 11px 12px; font: inherit; font-size: 20px; text-align: center; }
.field { text-align: left; font-size: 17px; width: 100%; }
textarea.field { min-height: 220px; line-height: 1.5; resize: vertical; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.presets button { flex: 1; min-width: 56px; padding: 10px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); font-weight: 600; }
.presets button.on { background: var(--green-fill); color: #fff; border-color: var(--green-fill); }
.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.row:last-child { border-bottom: 0; }
.row .box { width: 26px; height: 26px; border: 2px solid var(--line); border-radius: 8px; flex: none; display: grid; place-items: center; color: transparent; font-size: 16px; }
.row.done .box { background: var(--terracotta); border-color: var(--terracotta); color: var(--on-terracotta); }
.row.done .nm { text-decoration: line-through; color: var(--muted); }
.row .nm { flex: 1; min-width: 0; }
.row .nm b { font-weight: 600; display: block; }
.row .nm small { color: var(--muted); font-size: 13px; }
.row .q { font-family: var(--serif); font-size: 20px; font-weight: 700; white-space: nowrap; text-align: right; }
.row .q small { display: block; font-family: var(--sans); font-weight: 400; font-size: 12px; color: var(--muted); }
.row.dim { opacity: .5; }
.base { background: var(--green-fill); color: #fff; }
.base .nm small, .base .q small { color: rgba(255,255,255,.75); }
h2.sec { font-size: 18px; margin: 18px 2px 8px; }
.steps .row { align-items: flex-start; }
.steps .n { width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 700; display: grid; place-items: center; flex: none; font-size: 15px; margin-top: 1px; }
.steps .row.done .n { background: var(--terracotta); color: var(--on-terracotta); }
.steps .txt { flex: 1; font-size: 18px; line-height: 1.5; }
.input-inline { width: 104px; border: 1px solid var(--line); background: var(--cream); color: var(--ink); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 17px; text-align: right; }
.btn { border: 0; background: var(--green-fill); color: #fff; border-radius: 12px; padding: 13px 18px; font-weight: 600; }
.btn.ghost { background: var(--green-soft); color: var(--green); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--line); }
.btnrow { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.btnrow .btn { flex: 1; min-width: 140px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 2px; }
.note { background: var(--green-soft); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 10px 0; color: var(--green); }

/* Modal / folha */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
.sheet h3 { font-size: 20px; margin-bottom: 12px; }
.sheet label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.menu button { display: flex; width: 100%; gap: 12px; align-items: center; border: 0; background: none; padding: 14px 6px; font-size: 17px; text-align: left; border-bottom: 1px solid var(--line); }
.menu button:last-child { border-bottom: 0; }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--green-fill); color: #fff; padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; font-size: 15px; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
@media print { .top, .tabs, .addphoto, .delphoto, .btnrow, .scale { display: none !important; } body { background: #fff; } }
a { color: var(--green); font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { text-align: center; font-size: 19px; }
.lb { position: fixed; inset: 0; background: #000; z-index: 80; }
.lbs { position: absolute; inset: 0; overflow: auto; display: flex; align-items: center; justify-content: center; }
.lbs img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb.z .lbs { display: block; }
.lb.z .lbs img { max-width: none; max-height: none; width: 250%; }
.lbx { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2; background: rgba(255,255,255,.2); }
.lbn { position: absolute; top: 50%; z-index: 2; width: 44px; height: 64px; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 30px; border-radius: 12px; transform: translateY(-50%); }
.lbn.l { left: 8px; } .lbn.r { right: 8px; }
.photo .main { cursor: zoom-in; }
.note.warn { background: color-mix(in srgb, var(--danger) 14%, var(--paper)); color: var(--danger); }
.note.tip { background: color-mix(in srgb, var(--terracotta) 20%, var(--paper)); color: var(--accent-text); }
.accent-text, .row .nm small.accent-text { color: var(--accent-text); }
.ing-name { text-transform: uppercase; }
