/* ============================================================
   AUGE OS · as 12 peças de tela
   1 cartão · 2 lista · 3 linha · 4 etiqueta · 5 botão principal
   6 botão discreto · 7 campo · 8 seletor · 9 aviso
   10 gráfico de linha · 11 barra de nível · 12 folha que sobe
   Tela nova se monta só com estas peças.
   ============================================================ */

/* ---------- 1. Cartão ---------- */
.cartao {
  background: var(--superficie);
  border: 1px solid var(--linha);
  border-radius: var(--raio-cartao);
  padding: var(--m-16);
  display: flex; flex-direction: column; gap: var(--m-12);
}
.cartao--forte {                     /* o cartão principal da tela: um só */
  background: var(--forte);
  border-color: var(--forte);
  color: var(--sobre-forte);
  padding: 20px;
}
.cartao--forte .apoio, .cartao--forte .etiqueta { color: var(--sobre-forte-2); }

/* ---------- 2. Lista e 3. Linha ---------- */
.lista {
  background: var(--superficie);
  border: 1px solid var(--linha);
  border-radius: var(--raio-cartao);
  padding: var(--m-4) var(--m-16);
  display: flex; flex-direction: column;
}
.linha {
  min-height: 64px;
  padding: var(--m-8) 0;
  display: flex; align-items: center; justify-content: space-between; gap: var(--m-12);
  text-decoration: none; text-align: left;
  background: transparent; border: 0; border-top: 1px solid var(--superficie-2);
  width: 100%;
}
.linha:first-child { border-top-color: transparent; }
button.linha, a.linha { cursor: pointer; }
.linha__texto { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.linha__rotulo { font-size: 13px; color: var(--tinta-3); }
.linha__valor { font-weight: 700; overflow-wrap: anywhere; }
.linha__fim { flex: 0 0 auto; display: flex; align-items: center; gap: var(--m-8); color: var(--tinta-3); }

/* ---------- 4. Etiqueta ---------- */
.etiqueta {
  font-family: var(--fonte-mono);
  font-size: var(--letra-etiqueta); font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--tinta-3);
}
.estado {                            /* etiqueta de situação: palavra + ponto pequeno, nunca bloco colorido */
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px var(--m-8);
  border: 1px solid currentColor; border-radius: var(--raio-pilula);
  font-family: var(--fonte-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--tinta);
  white-space: nowrap;
}
.estado--cheio { background: var(--tinta); border-color: var(--tinta); color: var(--fundo); }
.estado--atencao::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--destaque);
}

/* ---------- 5. Botão principal e 6. Botão discreto ---------- */
.botao {
  min-height: var(--toque);
  padding: 0 var(--m-24);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--m-8);
  border: 0; border-radius: var(--raio-pilula);
  background: var(--destaque); color: var(--sobre-destaque);
  font-weight: 700; text-decoration: none;
  cursor: pointer;
  transition: opacity var(--movimento), transform var(--movimento);
}
.botao:active { transform: scale(0.98); }
.botao[disabled], .botao[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.botao--largo { width: 100%; }
.botao--discreto {
  background: transparent; color: var(--tinta);
  border: 1px solid var(--tinta);
}
.cartao--forte .botao--discreto { color: var(--sobre-forte); border-color: var(--sobre-forte); }
.botao--texto {                      /* variação do discreto para ações de pouca importância */
  min-height: var(--toque); padding: 0 var(--m-8);
  background: transparent; color: var(--tinta); border: 0;
  font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- 7. Campo ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo__rotulo { font-size: var(--letra-apoio); font-weight: 700; }
.campo__entrada {
  min-height: var(--toque);
  padding: 0 var(--m-16);
  background: var(--superficie); color: var(--tinta);
  border: 1px solid var(--borda-campo); border-radius: var(--raio-interno);
  font-size: var(--letra-texto);       /* 16: o iPhone não dá zoom ao focar */
  width: 100%;
}
textarea.campo__entrada { padding: var(--m-12) var(--m-16); min-height: 96px; resize: vertical; }
.campo__entrada::placeholder { color: var(--tinta-3); opacity: 1; }
.campo__ajuda { font-size: 13px; color: var(--tinta-3); }
.campo--erro .campo__entrada { border-color: var(--tinta); border-width: 2px; }
.campo--erro .campo__ajuda { color: var(--tinta); font-weight: 700; }

/* ---------- 8. Seletor ---------- */
.seletor {
  display: flex; gap: var(--m-4);
  padding: var(--m-4);
  background: var(--superficie-2);
  border-radius: var(--raio-pilula);
}
.seletor__opcao {
  flex: 1 1 0; min-width: 0; min-height: var(--toque);
  padding: 0 var(--m-12);
  border: 0; border-radius: var(--raio-pilula);
  background: transparent; color: var(--tinta-2);
  font-size: var(--letra-apoio); font-weight: 600;
  cursor: pointer;
  transition: background var(--movimento), color var(--movimento);
}
.seletor__opcao[aria-checked="true"] { background: var(--forte); color: var(--sobre-forte); font-weight: 700; }

/* ---------- 9. Aviso ---------- */
.aviso {
  padding: var(--m-12) 14px;
  border-radius: var(--raio-interno);
  background: var(--superficie-2);
  display: flex; align-items: flex-start; gap: var(--m-12);
  font-size: var(--letra-apoio);
}
.aviso__icone { flex: 0 0 auto; margin-top: 1px; }
.aviso__texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aviso--atencao { box-shadow: inset 3px 0 0 var(--destaque); }

/* ---------- 10. Gráfico de linha ---------- */
.grafico { width: 100%; height: auto; overflow: visible; color: var(--tinta); }
.grafico__traco { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.grafico__base { stroke: var(--linha); stroke-width: 1; }
.grafico__ponto { fill: var(--superficie); stroke: currentColor; stroke-width: 2.5; }
.grafico__ponto--agora { fill: var(--destaque); stroke: var(--destaque); }
.grafico__rotulo { font-family: var(--fonte-mono); font-size: 10px; fill: var(--tinta-3); }

/* ---------- 11. Barra de nível ---------- */
.nivel { height: var(--m-8); border-radius: var(--m-4); background: var(--superficie-2); overflow: hidden; }
.nivel__valor { height: 100%; width: calc(var(--nivel, 0) * 1%); border-radius: var(--m-4); background: var(--tinta); transition: width var(--movimento); }
.cartao--forte .nivel { background: var(--forte-2); }
.cartao--forte .nivel__valor { background: var(--sobre-forte); }

/* ---------- 12. Folha que sobe ---------- */
.folha {
  width: 100%; max-width: var(--largura-celular); max-height: 88dvh;
  margin: auto auto 0;
  padding: var(--m-8) var(--m-16) calc(var(--m-24) + env(safe-area-inset-bottom));
  border: 0; border-radius: var(--raio-cartao) var(--raio-cartao) 0 0;
  background: var(--superficie); color: var(--tinta);
  overflow-y: auto;
}
.folha::backdrop { background: var(--veu); }
.folha[open] { display: flex; flex-direction: column; gap: var(--m-16); animation: folha-sobe 0.18s ease; }
.folha__pega { width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--linha); }
.folha__topo { display: flex; align-items: center; justify-content: space-between; gap: var(--m-12); }
.folha__topo .botao { min-width: var(--toque); padding: 0; }
@keyframes folha-sobe { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .folha[open] { animation: none; } }
@media (min-width: 900px) {
  .folha { margin: auto; border-radius: var(--raio-cartao); }
}

/* ---------- Os quatro estados de toda tela ---------- */
.estado-tela {
  flex: 1 1 auto; min-height: 50dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--m-12);
  text-align: center; padding: var(--m-24) var(--m-16);
}
.estado-tela__texto { max-width: 320px; color: var(--tinta-3); }
.pulso { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--linha); border-top-color: var(--tinta); animation: gira 0.8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pulso { animation-duration: 2.4s; } }
