:root {
  color-scheme: light;
  --fundo: #f7f5f1;
  --cartao: #ffffff;
  --linha: #e6e1d8;
  --texto: #1a1714;
  --texto-2: #57514a;
  --texto-3: #827a70;
  --marca: #a03c1c;
  --marca-clara: #f8e7df;
  --bom: #2f6b2a;
  --ruim: #b42318;
  --alerta: #8a5a00;
  --alerta-fundo: #fff4d6;
  --grade: #ece8e0;
  --sombra: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  --raio: 14px;
  --nav: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fundo: #141210;
    --cartao: #1d1a17;
    --linha: #302b26;
    --texto: #f1ede6;
    --texto-2: #c7bfb3;
    --texto-3: #918878;
    --marca: #ec8a63;
    --marca-clara: #3a2219;
    --bom: #8fcf7f;
    --ruim: #ff7b6e;
    --alerta: #f3c45a;
    --alerta-fundo: #3a2f12;
    --grade: #2a2622;
    --sombra: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
.carregando { padding: 40vh 0; text-align: center; color: var(--texto-3); }

header.topo {
  position: sticky; top: 0; z-index: 5; background: var(--fundo);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 8px; display: flex; align-items: center; gap: 8px;
}
header.topo h1 { font-size: 20px; margin: 0; flex: 1; }
main { padding: 4px 16px 24px; max-width: 760px; margin: 0 auto; }

.cartao { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); border: 1px solid var(--linha); padding: 14px 16px; margin-bottom: 12px; }
.cartao h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-2); margin: 0 0 10px; font-weight: 600; }
.cartao h2 .dir { float: right; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--texto-3); }
.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rotulo { font-size: 13px; color: var(--texto-2); }
.grande { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.medio { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bom { color: var(--bom); }
.ruim { color: var(--ruim); }
.mudo { color: var(--texto-3); }
.pequeno { font-size: 13px; }

.linha { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--linha); }
.linha:first-of-type { border-top: 0; }
.linha .meio { flex: 1; min-width: 0; }
.linha .titulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linha .sub { font-size: 12.5px; color: var(--texto-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clicavel { cursor: pointer; }
.clicavel:active { opacity: .6; }
.mini { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--grade); }

.barra { height: 10px; background: var(--grade); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.barra > div { height: 100%; border-radius: 99px; background: var(--marca); transition: width .3s; }
.barra.bateu > div { background: var(--bom); }
.meta-linha { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; }

nav.baixo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--cartao); border-top: 1px solid var(--linha);
  display: flex; height: calc(var(--nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
nav.baixo button { flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--texto-3); cursor: pointer; }
nav.baixo button svg { width: 24px; height: 24px; }
nav.baixo button.ativo { color: var(--marca); font-weight: 600; }

.btn { border: 1px solid var(--linha); background: var(--cartao); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.prim { background: var(--marca); border-color: var(--marca); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.prim { color: #1a0d07; } }
.btn.perigo { color: var(--ruim); }
.btn.cheio { width: 100%; padding: 13px; font-size: 16px; }
.btn.alto { flex-direction: column; padding: 14px 8px; font-size: 14px; gap: 4px; }
.btn.alto svg { width: 26px; height: 26px; }
.btn:disabled { opacity: .5; }
.btn.gravando { border-color: var(--ruim); color: var(--ruim); }
.icone-btn { background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--texto-2); display: grid; place-items: center; }
.icone-btn svg { width: 22px; height: 22px; }
.acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.lado { display: flex; gap: 10px; }
.lado > * { flex: 1; min-width: 0; }
button.link { background: none; border: 0; padding: 6px 0; color: var(--marca); font-weight: 550; cursor: pointer; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button { border: 1px solid var(--linha); background: var(--cartao); border-radius: 10px; padding: 8px 12px; cursor: pointer; text-align: left; }
.chips button small { display: block; color: var(--texto-3); font-size: 12px; }
.abas { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; scrollbar-width: none; }
.abas button { flex: none; border: 1px solid var(--linha); background: var(--cartao); border-radius: 99px; padding: 6px 12px; font-size: 13.5px; cursor: pointer; color: var(--texto-2); }
.abas button.ativo { background: var(--marca-clara); border-color: var(--marca); color: var(--texto); font-weight: 600; }
.segmentos { display: flex; background: var(--fundo); border: 1px solid var(--linha); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.segmentos button { flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 9px; cursor: pointer; font-weight: 550; color: var(--texto-2); }
.segmentos button.ativo { background: var(--cartao); color: var(--texto); box-shadow: var(--sombra); }

.campo { display: block; margin-bottom: 12px; }
.campo > span { display: block; font-size: 13px; color: var(--texto-2); margin-bottom: 4px; }
.campo input, .campo select, .campo textarea, textarea.solto {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--linha); background: var(--fundo); font-size: 16px; min-height: 44px;
}
.campo textarea, textarea.solto { min-height: 84px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus, textarea.solto:focus { outline: 2px solid var(--marca); outline-offset: -1px; }

.seletor-dia { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.seletor-dia strong { font-size: 16px; }

.folha-fundo { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.folha {
  background: var(--cartao); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0;
  padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); animation: sobe .18s ease-out;
}
@media (min-width: 700px) { .folha-fundo { align-items: center; } .folha { border-radius: 20px; } }
@keyframes sobe { from { transform: translateY(30px); opacity: .5; } }
.folha .pegador { width: 40px; height: 4px; border-radius: 4px; background: var(--linha); margin: 4px auto 10px; }
.folha h3 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; }
.folha h3 span { flex: 1; }

.erro { background: #fde7e4; color: #8f1d12; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
@media (prefers-color-scheme: dark) { .erro { background: #3d1712; color: #ffb4a9; } }
.aviso { background: var(--alerta-fundo); color: var(--alerta); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.nota { background: var(--marca-clara); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav) + 24px); background: var(--texto); color: var(--fundo); padding: 10px 16px; border-radius: 10px; z-index: 30; font-size: 14px; max-width: 90vw; }
.vazio { text-align: center; color: var(--texto-3); padding: 24px 8px; }

.foto-previa { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; display: block; }
.item-ed { display: grid; grid-template-columns: 1fr 74px 60px 28px; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid var(--linha); }
.item-ed:first-child { border-top: 0; }
.item-ed input { width: 100%; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--linha); background: var(--fundo); font-size: 15px; min-width: 0; }
.item-ed .porcao { grid-column: 1 / -1; margin-top: -2px; }
.item-ed .porcao input { font-size: 13px; color: var(--texto-2); padding: 5px 8px; }
input.ed { width: 100%; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--linha); background: var(--fundo); font-size: 15px; min-width: 0; }
.cab-itens { display: grid; grid-template-columns: 1fr 74px 60px 28px; gap: 6px; font-size: 12px; color: var(--texto-3); }
.totais { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; margin: 10px 0 12px; }
.totais b { font-variant-numeric: tabular-nums; }

.prato h4 { margin: 0 0 4px; font-size: 16px; }
.prato ol { margin: 8px 0 0; padding-left: 20px; }
.prato li { margin: 3px 0; }
.prato + .prato { border-top: 1px solid var(--linha); padding-top: 12px; margin-top: 12px; }
.dia-cardapio + .dia-cardapio { margin-top: 12px; }
.dia-cardapio h4 { margin: 0 0 6px; text-transform: capitalize; }

svg.grafico { width: 100%; height: auto; display: block; }
svg.grafico text { fill: var(--texto-3); font-size: 10px; }
svg.grafico .eixo { stroke: var(--grade); }
svg.grafico .serie { stroke: var(--marca); fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.grafico .ponto { fill: var(--marca); }
svg.grafico .coluna { fill: var(--marca); opacity: .85; }
svg.grafico .coluna.fraca { opacity: .35; }
svg.grafico .meta { stroke: var(--bom); stroke-dasharray: 4 4; stroke-width: 1.5; }

.entrar { max-width: 360px; margin: 18vh auto 0; padding: 0 20px; }
.entrar h1 { font-size: 26px; margin: 0 0 4px; }
