/* =====================================================================
   Atlas by Orbitaree — Design System v0.1.0
   Mobile first. Tokens alinhados ao padrão visual Orbitaree.
   ===================================================================== */

:root {
  /* Cores */
  --bg:            #F5F7F6;
  --surface:       #FFFFFF;
  --surface-alt:   #FAFBFA;
  --border:        #E3E8E5;
  --border-forte:  #CBD5D0;

  --verde:         #00995D;
  --verde-escuro:  #007A4A;
  --verde-claro:   #E6F5EF;

  --texto:         #1F2937;
  --texto-suave:   #6B7280;
  --texto-fraco:   #9CA3AF;

  --ok:            #00995D;
  --ok-bg:         #E6F5EF;
  --atencao:       #B45309;
  --atencao-bg:    #FEF3E2;
  --alerta:        #B91C1C;
  --alerta-bg:     #FEE9E9;
  --info:          #1D4ED8;
  --info-bg:       #E8EEFD;

  /* Tipografia */
  --fonte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
           "Helvetica Neue", Arial, sans-serif;
  --fonte-num: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* Espaço e forma */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --sombra:    0 1px 2px rgba(16, 24, 40, .05);
  --sombra-md: 0 4px 12px rgba(16, 24, 40, .07);

  --sidebar-w: 236px;
  --sidebar-min: 68px;
  --bottom-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--texto);
  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--verde-escuro); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .75rem; }

:focus-visible {
  outline: 2px solid var(--verde);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------------------------------------------------------------- Layout */
.layout { min-height: 100vh; }

.topo {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .75rem;
  height: 56px; padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* ------------------------------------------------------------- Marca */
/* Nome do produto em cima, assinatura da marca EMBAIXO — nunca ao lado.
   O bloco de texto é uma coluna; o ponto verde fica alinhado ao topo do
   nome, não ao centro do conjunto. */
.marca {
  display: inline-flex; align-items: flex-start; gap: .5rem;
  color: var(--texto); text-decoration: none;
}
.marca:hover { text-decoration: none; }
.marca__ponto {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--verde); flex: none; margin-top: .42rem;
}
.marca__texto { display: flex; flex-direction: column; line-height: 1.05; }
.marca__nome {
  font-size: 1.12rem; font-weight: 700; letter-spacing: -.015em;
}
.marca__assinatura {
  font-size: .64rem; font-weight: 500; letter-spacing: .09em;
  text-transform: uppercase; color: var(--texto-fraco); margin-top: .18rem;
}
.marca--sidebar { padding: 0 .5rem 1.15rem; }
.marca--topo .marca__nome { font-size: 1rem; }
.marca--auth {
  display: flex; justify-content: center; margin-bottom: 1.35rem;
}
.marca--auth .marca__nome { font-size: 1.5rem; }
.marca--auth .marca__assinatura { font-size: .68rem; }
.marca--auth .marca__ponto { margin-top: .58rem; width: 10px; height: 10px; }

.topo__titulo {
  font-size: .9rem; font-weight: 600; color: var(--texto-suave);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.topo__dir { margin-left: auto; display: flex; align-items: center; gap: .5rem; }


.sidebar { display: none; }

.conteudo {
  padding: 1rem 1rem calc(var(--bottom-h) + 1.5rem);
  max-width: 1180px;
  margin: 0 auto;
}

/* ------------------------------------------------------- Nav inferior */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; height: var(--bottom-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  font-size: .68rem; color: var(--texto-suave); text-decoration: none;
}
.bottomnav a[aria-current="page"] { color: var(--verde); font-weight: 600; }
.bottomnav svg { width: 21px; height: 21px; }

/* -------------------------------------------------------------- Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sombra);
  padding: 1rem;
}
.card + .card { margin-top: .875rem; }
.card__titulo {
  font-size: .78rem; font-weight: 650; text-transform: uppercase;
  letter-spacing: .04em; color: var(--texto-suave); margin-bottom: .5rem;
}

.grid { display: grid; gap: .875rem; grid-template-columns: repeat(2, 1fr); }
.grid--1 { grid-template-columns: 1fr; }
.grid--full { grid-column: 1 / -1; }

.metrica { }
.metrica__rotulo {
  font-size: .74rem; color: var(--texto-suave);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.metrica__valor {
  font-size: 1.6rem; font-weight: 700; line-height: 1.15;
  margin-top: .2rem; font-variant-numeric: tabular-nums;
}
.metrica__valor small { font-size: .85rem; font-weight: 500; color: var(--texto-suave); }
.metrica__nota { font-size: .78rem; color: var(--texto-suave); margin-top: .25rem; }

/* ------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .18rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 650; line-height: 1.4;
  white-space: nowrap;
}
.badge--ok      { background: var(--ok-bg);      color: var(--ok); }
.badge--atencao { background: var(--atencao-bg); color: var(--atencao); }
.badge--alerta  { background: var(--alerta-bg);  color: var(--alerta); }
.badge--info    { background: var(--info-bg);    color: var(--info); }
.badge--neutro  { background: var(--surface-alt); color: var(--texto-suave);
                  border: 1px solid var(--border); }

/* ----------------------------------------------------- Escala visual */
.escala { display: flex; gap: 3px; margin-top: .6rem; }
.escala__seg {
  flex: 1; height: 6px; border-radius: 3px; background: var(--border);
}
.escala__seg--on-ok      { background: var(--ok); }
.escala__seg--on-atencao { background: var(--atencao); }
.escala__seg--on-alerta  { background: var(--alerta); }
.escala__legenda {
  display: flex; justify-content: space-between;
  font-size: .66rem; color: var(--texto-fraco); margin-top: .25rem;
}

/* -------------------------------------------------------- Progresso */
.progresso {
  height: 8px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.progresso__barra { height: 100%; background: var(--verde); border-radius: 999px; }

/* ------------------------------------------------------------ Avisos */
.aviso {
  border-radius: var(--r); padding: .75rem .875rem;
  font-size: .875rem; margin-bottom: .875rem;
  border: 1px solid transparent;
}
.aviso--ok      { background: var(--ok-bg);      color: var(--verde-escuro);
                  border-color: #B9E4D2; }
.aviso--atencao { background: var(--atencao-bg); color: var(--atencao);
                  border-color: #F5DDB8; }
.aviso--alerta  { background: var(--alerta-bg);  color: var(--alerta);
                  border-color: #F3C2C2; }
.aviso--info    { background: var(--info-bg);    color: var(--info);
                  border-color: #C3D3F7; }

.nota-legal {
  font-size: .78rem; color: var(--texto-suave);
  background: var(--surface-alt); border: 1px dashed var(--border-forte);
  border-radius: var(--r); padding: .7rem .8rem; margin-top: 1rem;
}

/* ---------------------------------------------------------- Formularios */
.campo { margin-bottom: .875rem; }
.campo label {
  display: block; font-size: .82rem; font-weight: 600;
  margin-bottom: .3rem; color: var(--texto);
}
.campo .dica { font-size: .74rem; color: var(--texto-suave); margin-top: .25rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=datetime-local],
input[type=search], input[type=tel], input[type=url], input:not([type]),
select, textarea {
  width: 100%; padding: .68rem .75rem;
  font-family: var(--fonte); font-size: 1rem; color: var(--texto);
  background: var(--surface);
  border: 1px solid var(--border-forte); border-radius: var(--r-sm);
  appearance: none;
}
/* O Safari/iOS ignora width e padding em type=search sem isto, e desenha
   um campo arredondado nativo bem menor que os demais. */
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-decoration,
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

input:focus, select:focus, textarea:focus {
  border-color: var(--verde); outline: 2px solid var(--verde-claro); outline-offset: 0;
}
textarea { min-height: 84px; resize: vertical; }

.grupo-campos { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
.grupo-campos--1 { grid-template-columns: 1fr; }

fieldset {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: .875rem; margin: 0 0 1rem;
}
legend {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--texto-suave); padding: 0 .35rem;
}

/* ------------------------------------------------------------ Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 46px; padding: .6rem 1.1rem;
  font-family: var(--fonte); font-size: .95rem; font-weight: 600;
  border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s;
}
.btn:hover { text-decoration: none; }
.btn--primario { background: var(--verde); color: #fff; }
.btn--primario:hover { background: var(--verde-escuro); }
.btn--sec {
  background: var(--surface); color: var(--texto); border-color: var(--border-forte);
}
.btn--sec:hover { background: var(--surface-alt); }
.btn--perigo { background: var(--surface); color: var(--alerta);
               border-color: #F3C2C2; }
.btn--perigo:hover { background: var(--alerta-bg); }
.btn--bloco { width: 100%; }
.btn--pequeno { min-height: 36px; padding: .35rem .7rem; font-size: .82rem; }

.acoes { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

/* ------------------------------------------------------------ Tabelas */
.tabela-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tabela { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.tabela th, table.tabela td {
  padding: .6rem .5rem; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.tabela th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--texto-suave); font-weight: 650;
}
table.tabela td.num { font-variant-numeric: tabular-nums; text-align: right; }
table.tabela tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------- Vazio/lista */
.vazio {
  text-align: center; padding: 2rem 1rem; color: var(--texto-suave);
}
.vazio h3 { color: var(--texto); }

.lista-rec { display: grid; gap: .7rem; }
.rec {
  border: 1px solid var(--border); border-left: 3px solid var(--border-forte);
  border-radius: var(--r-sm); padding: .75rem .875rem; background: var(--surface);
}
.rec--positivo { border-left-color: var(--ok); }
.rec--atencao  { border-left-color: var(--atencao); }
.rec--lembrete { border-left-color: var(--info); }
.rec--dado     { border-left-color: var(--verde); }
.rec--info     { border-left-color: var(--border-forte); }
.rec h4 { font-size: .92rem; margin-bottom: .25rem; }
.rec p  { font-size: .86rem; color: var(--texto-suave); margin: 0; }

/* --------------------------------------------------------- Segmentos */
.segmentos {
  display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .25rem;
  scrollbar-width: none;
}
.segmentos::-webkit-scrollbar { display: none; }
.segmentos a {
  flex: none; padding: .4rem .75rem; font-size: .82rem; font-weight: 600;
  border-radius: 999px; border: 1px solid var(--border-forte);
  background: var(--surface); color: var(--texto-suave); text-decoration: none;
}
.segmentos a[aria-current="true"] {
  background: var(--verde); border-color: var(--verde); color: #fff;
}

/* ---------------------------------------------------------- Gráficos */
.gr-wrap { position: relative; height: 260px; }

/* ------------------------------------------------------- Comparação */
.comp { display: grid; gap: .6rem; }
.comp__linha {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--border);
}
.comp__linha:last-child { border-bottom: none; }
.comp__rot { font-size: .86rem; font-weight: 600; }
.comp__val { font-size: .8rem; color: var(--texto-suave);
             font-variant-numeric: tabular-nums; }
.comp__delta { font-weight: 700; font-variant-numeric: tabular-nums;
               font-size: .95rem; }
.comp__delta--baixa { color: var(--verde); }
.comp__delta--alta  { color: var(--atencao); }
.comp__delta--zero  { color: var(--texto-fraco); }

/* ------------------------------------------------------------- Auth */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
}
.auth-card { width: 100%; max-width: 420px; }

.rodape-app {
  text-align: center; font-size: .74rem; color: var(--texto-fraco);
  padding: 1.25rem 0 .5rem;
}

.item svg, .bottomnav svg, .btn svg {
  width: 20px; height: 20px; flex: none;
}

/* ------------------------------------------------- Escolhas (check-in) */
.escolhas { display: flex; gap: .4rem; flex-wrap: wrap; }
.escolha { flex: 1; min-width: 78px; cursor: pointer; }
.escolha input { position: absolute; opacity: 0; pointer-events: none; }
.escolha span {
  display: block; text-align: center; padding: .55rem .35rem;
  font-size: .78rem; font-weight: 600; line-height: 1.2;
  border: 1px solid var(--border-forte); border-radius: var(--r-sm);
  background: var(--surface); color: var(--texto-suave);
}
.escolha input:checked + span {
  background: var(--verde-claro); border-color: var(--verde);
  color: var(--verde-escuro);
}
.escolha input:focus-visible + span {
  outline: 2px solid var(--verde); outline-offset: 2px;
}

/* --------------------------------------------------------- Conquistas */
.conquistas { display: grid; gap: .7rem; grid-template-columns: 1fr; }
.conq {
  display: flex; gap: .75rem; align-items: flex-start;
  border: 1px solid var(--border); border-radius: var(--r);
  padding: .8rem .9rem; background: var(--surface);
}
.conq--bloqueada { opacity: .5; }
.conq__selo {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  background: var(--verde-claro); color: var(--verde-escuro);
}
.conq--bloqueada .conq__selo {
  background: var(--surface-alt); color: var(--texto-fraco);
  border: 1px dashed var(--border-forte);
}
.conq h4 { font-size: .92rem; margin: 0 0 .15rem; }
.conq p { font-size: .82rem; color: var(--texto-suave); margin: 0; }

/* ----------------------------------------------------------- Alertas */
.alertas { display: grid; gap: .5rem; }
.alerta-item {
  display: flex; gap: .6rem; align-items: center;
  border: 1px solid var(--border); border-left: 3px solid var(--border-forte);
  border-radius: var(--r-sm); padding: .6rem .75rem;
  font-size: .86rem; background: var(--surface);
}
.alerta-item--positivo { border-left-color: var(--ok); }
.alerta-item--lembrete { border-left-color: var(--info); }
.alerta-item a { margin-left: auto; white-space: nowrap; }

/* ---------------------------------------------------- Fotos / galeria */
.galeria {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.galeria__item { margin: 0; }
.galeria__item img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface-alt); display: block;
}
.galeria__item figcaption {
  display: flex; align-items: center; justify-content: space-between;
  gap: .4rem; font-size: .74rem; margin-top: .35rem; line-height: 1.25;
}

.comparar { display: grid; gap: .7rem; grid-template-columns: 1fr 1fr; }
.comparar__lado { margin: 0; }
.comparar__lado img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--border); display: block;
}
.comparar__vazio {
  aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 1rem; font-size: .8rem; color: var(--texto-fraco);
  border: 1px dashed var(--border-forte); border-radius: var(--r-sm);
  background: var(--surface-alt);
}
.comparar__lado figcaption {
  font-size: .8rem; font-weight: 600; margin-top: .4rem; text-align: center;
}
.comparar__dados {
  display: block; font-weight: 400; font-size: .74rem; color: var(--texto-suave);
}

/* ------------------------------------------------ Alimentação / macros */
.macro-barra { display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--border); }
.macro-barra span { display: block; height: 100%; }
.macro-prot { background: #2563EB; }
.macro-carb { background: #00995D; }
.macro-gord { background: #D97706; }
.macro-legenda { display: flex; gap: .9rem; flex-wrap: wrap; margin-top: .5rem;
  font-size: .76rem; color: var(--texto-suave); }
.macro-legenda i { width: 9px; height: 9px; border-radius: 2px;
  display: inline-block; margin-right: .3rem; }

.refeicao { border: 1px solid var(--border); border-radius: var(--r);
  padding: .8rem .9rem; background: var(--surface); }
.refeicao + .refeicao { margin-top: .7rem; }
.refeicao__topo { display: flex; align-items: baseline; gap: .5rem;
  margin-bottom: .5rem; }
.refeicao__nome { font-weight: 650; font-size: .95rem; }
.refeicao__kcal { margin-left: auto; font-size: .82rem; color: var(--texto-suave);
  font-variant-numeric: tabular-nums; }
.item-alimento { display: flex; gap: .5rem; align-items: center;
  padding: .4rem 0; border-top: 1px solid var(--border); font-size: .86rem; }
.item-alimento__qtd { color: var(--texto-suave); font-size: .8rem; }
.item-alimento__kcal { margin-left: auto; font-variant-numeric: tabular-nums;
  color: var(--texto-suave); font-size: .8rem; }

.busca-item { padding: .6rem 0; border-top: 1px solid var(--border); }
.busca-item:first-of-type { border-top: none; }
.busca-item__nome { font-size: .9rem; font-weight: 600; }
.busca-item__macro { display: block; font-size: .76rem; font-weight: 400;
  color: var(--texto-suave); margin-top: .15rem; }
.busca-item__acao { display: flex; gap: .35rem; flex-wrap: wrap;
  margin-top: .45rem; align-items: center; }
.busca-item__acao input, .busca-item__acao select {
  padding: .35rem .5rem; font-size: .82rem; width: auto; min-height: 36px; }

/* --------------------------------------------------- Folha de menu (mobile) */
.bottomnav__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font-size: .68rem; font-family: var(--fonte);
  color: var(--texto-suave); background: none; border: none; cursor: pointer;
  padding: 0; text-decoration: none;
}
.bottomnav__btn:hover { text-decoration: none; }
.bottomnav__btn[aria-expanded="true"] { color: var(--verde); font-weight: 600; }
.bottomnav__btn svg { width: 21px; height: 21px; }

body.sem-rolagem { overflow: hidden; }

/* Fechada por padrão. Abre por :target (sem JavaScript) ou pela classe
   .folha--aberta (com JavaScript). As duas rotas levam ao mesmo estado. */
.folha {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: flex-end;
}
.folha:target,
.folha--aberta { display: flex; }
.folha__fundo { position: absolute; inset: 0; display: block;
  background: rgba(16,24,40,.45); }
.folha__painel {
  position: relative; width: 100%; max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: .9rem 1rem calc(1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 28px rgba(16,24,40,.18);
}
.folha__topo {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding-bottom: .6rem; margin-bottom: .3rem;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--surface);
}
.folha__titulo { font-weight: 700; font-size: 1rem; }
.folha__grupo {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texto-fraco); font-weight: 700; padding: .85rem .15rem .4rem;
}
.folha__itens { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.folha__item {
  display: flex; align-items: center; gap: .55rem;
  padding: .7rem .7rem; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: .88rem; color: var(--texto); text-decoration: none;
  min-height: 46px;
}
.folha__item:hover { background: var(--surface-alt); text-decoration: none; }
.folha__item[aria-current="page"] {
  background: var(--verde-claro); border-color: var(--verde);
  color: var(--verde-escuro); font-weight: 650;
}
.folha__item svg { width: 18px; height: 18px; flex: none; }
.folha__item--futuro { opacity: .5; }
.folha__item--futuro .badge { margin-left: auto; font-size: .6rem; }

/* ------------------------------------------------ Guias de medição */
.protocolo {
  margin: 0; padding-left: 1.1rem; font-size: .86rem;
  color: var(--texto-suave); display: grid; gap: .3rem;
}
.guia { margin-top: .4rem; }
.guia > summary {
  cursor: pointer; font-size: .76rem; font-weight: 600;
  color: var(--verde-escuro); list-style: none; display: inline-flex;
  align-items: center; gap: .3rem; padding: .2rem 0;
}
.guia > summary::-webkit-details-marker { display: none; }
.guia > summary::before { content: "?"; display: inline-flex;
  align-items: center; justify-content: center; width: 15px; height: 15px;
  border-radius: 50%; background: var(--verde-claro); font-size: .68rem;
  font-weight: 700; }
.guia[open] > summary::before { content: "×"; }
.guia__corpo {
  display: flex; gap: .75rem; align-items: flex-start; margin-top: .45rem;
  padding: .65rem .7rem; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface-alt);
}
.guia-svg { width: 74px; height: 124px; flex: none; }
.guia-corpo { stroke: var(--border-forte); }
.guia-marca { stroke: var(--verde); }
.guia__texto { font-size: .78rem; color: var(--texto-suave); margin: 0;
  line-height: 1.45; }

/* ------------------------------------------------ Busca de alimentos */
.busca { display: flex; gap: .5rem; align-items: flex-start; }
.busca__campo { flex: 1; margin: 0; position: relative; }
.busca__botao { margin-top: 1.42rem; flex: none; }

.sugestoes {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  margin-top: .25rem; max-height: 310px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-forte);
  border-radius: var(--r-sm); box-shadow: var(--sombra-md);
}
.sugestao {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: .55rem .7rem; border: none; border-bottom: 1px solid var(--border);
  background: none; font-family: var(--fonte); color: var(--texto);
}
.sugestao:last-child { border-bottom: none; }
.sugestao:hover, .sugestao--ativa { background: var(--verde-claro); }
.sugestao__nome { display: block; font-size: .9rem; font-weight: 600; }
.sugestao__nome mark {
  background: #FFF1B8; color: inherit; padding: 0 1px; border-radius: 2px;
}
.sugestao__macro {
  display: block; font-size: .76rem; color: var(--texto-suave); margin-top: .1rem;
}
.sugestao__vazio {
  margin: 0; padding: .7rem; font-size: .84rem; color: var(--texto-suave);
}

.add-alimento {
  margin-top: .8rem; padding: .75rem .8rem; border: 1px solid var(--verde);
  border-radius: var(--r-sm); background: var(--verde-claro);
}
.add-alimento__nome { font-weight: 650; font-size: .92rem; }
.add-alimento__macro {
  display: block; font-weight: 400; font-size: .76rem;
  color: var(--texto-suave); margin-top: .1rem;
}
.add-alimento__linha {
  display: flex; gap: .4rem; flex-wrap: wrap; align-items: center;
  margin-top: .6rem;
}
.add-alimento__linha input, .add-alimento__linha select {
  width: auto; min-height: 42px; font-size: .86rem; background: var(--surface);
}
.add-alimento__qtd { width: 68px; }
.add-alimento__linha select { flex: 1; min-width: 128px; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ==================================================== Tablet / Desktop */
@media (min-width: 560px) {
  .folha__itens { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grupo-campos { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 1.75rem; }
}

@media (min-width: 1024px) {
  .bottomnav { display: none; }
  .topo { display: none; }

  .layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0;
    height: 100vh; background: var(--surface);
    border-right: 1px solid var(--border);
    padding: .85rem .6rem .7rem;
    /* Rola se realmente precisar (tela muito baixa), mas sem desenhar a
       barra: com espaçamento compacto os 15 itens cabem em qualquer
       notebook comum, então a barra só aparecia como sujeira visual. */
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; }

  .sidebar__cabecalho {
    display: flex; align-items: flex-start; gap: .4rem;
    padding-bottom: .7rem; margin-bottom: .2rem;
    border-bottom: 1px solid var(--border);
  }
  .sidebar__toggle {
    margin-left: auto; flex: none; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--surface); color: var(--texto-suave); cursor: pointer;
    padding: 0; transition: transform .15s, background .15s;
  }
  .sidebar__toggle:hover { background: var(--surface-alt); color: var(--texto); }
  .sidebar__toggle svg { width: 16px; height: 16px; }
  .sidebar__grupo {
    font-size: .64rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--texto-fraco); font-weight: 700;
    padding: .6rem .55rem .25rem; white-space: nowrap; overflow: hidden;
  }
  /* Seletor por classe, não por elemento: os itens "em breve" são <span>,
     não <a>. Com .sidebar a.item o <span> ficava sem display:flex e sem
     limite de tamanho no <svg>, que então esticava até a largura da coluna. */
  .sidebar .item {
    display: flex; align-items: center; gap: .6rem;
    padding: .42rem .55rem; border-radius: var(--r-sm);
    font-size: .87rem; color: var(--texto-suave); text-decoration: none;
    line-height: 1.25; white-space: nowrap;
  }
  .sidebar .item__rotulo { overflow: hidden; text-overflow: ellipsis; }
  .sidebar a.item:hover { background: var(--surface-alt); color: var(--texto); }
  .sidebar a.item[aria-current="page"] {
    background: var(--verde-claro); color: var(--verde-escuro); font-weight: 650;
  }
  .sidebar .item--futuro { opacity: .5; cursor: default; }
  .sidebar .item--futuro .badge { margin-left: auto; font-size: .62rem; }

  /* ---------------------------- Barra lateral recolhida (só ícones) */
  .layout--retraida { grid-template-columns: var(--sidebar-min) 1fr; }
  .layout--retraida .sidebar { padding: .85rem .5rem .7rem; align-items: center; }
  .layout--retraida .sidebar__cabecalho { flex-direction: column; gap: .5rem; }
  .layout--retraida .marca__texto { display: none; }
  .layout--retraida .marca--sidebar { justify-content: center; }
  .layout--retraida .marca__ponto { margin-top: 0; width: 12px; height: 12px; }
  .layout--retraida .sidebar__toggle { margin-left: 0; }
  .layout--retraida .sidebar__toggle svg { transform: rotate(180deg); }
  .layout--retraida .item__rotulo,
  .layout--retraida .item .badge { display: none; }
  .layout--retraida .sidebar .item {
    justify-content: center; padding: .5rem 0; width: 40px;
    margin: 0 auto;
  }
  .layout--retraida .sidebar__grupo {
    padding: .5rem 0 .2rem; text-align: center; font-size: 0;
  }
  /* Um traço no lugar do rótulo do grupo, para não perder a separação. */
  .layout--retraida .sidebar__grupo::after {
    content: ""; display: block; width: 18px; height: 1px;
    background: var(--border); margin: .25rem auto 0;
  }

  .conteudo { padding: 1.75rem 2rem 3rem; }
  .conquistas { grid-template-columns: 1fr 1fr; }
  .folha { display: none !important; }
  .galeria { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; }
  .gr-wrap { height: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* =========================================================== Impressão */
@media print {
  .sidebar, .bottomnav, .topo, .acoes, .btn, .segmentos, .folha, .guia,
  .rodape-app, .nao-imprimir { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .layout { display: block; }
  .conteudo { padding: 0; max-width: none; }
  .card {
    border: 1px solid #ccc; box-shadow: none; break-inside: avoid;
    page-break-inside: avoid; margin-bottom: .6rem;
  }
  .grid { grid-template-columns: repeat(4, 1fr) !important; }
  a { color: #000; text-decoration: none; }
  .imprimir-cabecalho { display: block !important; }
}
.imprimir-cabecalho { display: none; }
