/* MCapp · Madeiras de Cernache
   Estilo alinhado com o site: verdes da floresta, fundo creme, Inter + serifa nos títulos.
   Pensado primeiro para o telemóvel (Android), com ajustes para ecrãs maiores. */

@font-face {
  font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/inter-400.woff") format("woff");
}
@font-face {
  font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("../fonts/inter-500.woff") format("woff");
}
@font-face {
  font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("../fonts/inter-600.woff") format("woff");
}
/* Opcional: se colocar libre-baskerville-400.ttf nesta pasta, os títulos usam-na. */
@font-face {
  font-family: "Libre Baskerville"; font-weight: 400; font-style: normal; font-display: swap;
  src: local("Libre Baskerville"), local("LibreBaskerville-Regular"),
       url("../fonts/libre-baskerville-400.ttf") format("truetype");
}

:root {
  --verde: #243e32;
  --verde-escuro: #1a2e25;
  --salvia: #546c50;
  --cinza: #5d675d;
  --creme: #f5f4ed;
  --claro: #e9ede1;
  --salvia-claro: #dce4d3;
  --linha: #d5d9cc;
  --branco: #ffffff;
  --texto: #1f2f26;

  --ok: #546c50;
  --amarelo: #d9a520;
  --laranja: #d9690f;
  --vermelho: #b3261e;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Libre Baskerville", Baskerville, "Baskerville Old Face", Georgia, "Times New Roman", serif;
  --raio: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--creme);
  color: var(--texto);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--verde); }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #8fb08a; outline-offset: 2px; }

/* ---------- Topo ---------- */
.topo { background: var(--verde); color: #fff; position: sticky; top: 0; z-index: 20; }
.topo-conteudo {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.marca {
  display: flex; align-items: center; gap: 12px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; letter-spacing: .01em;
}
.marca-icone { width: 22px; height: 28px; fill: none; stroke: #fff; stroke-width: 1.6; flex: none; }

.nav-topo { display: none; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav-topo a {
  color: rgba(255,255,255,.85); text-decoration: none; font-weight: 500; font-size: .95rem;
  padding: 8px 14px; border-radius: 999px;
}
.nav-topo a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-topo a.ativo { background: rgba(255,255,255,.16); color: #fff; }
.nav-topo form { margin: 0; }
.nav-topo button {
  background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; font: inherit; font-size: .95rem;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; margin-left: 6px;
}

/* ---------- Navegação em baixo (telemóvel) ---------- */
.nav-baixo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--branco); border-top: 1px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-baixo a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 8px 4px; color: var(--cinza); text-decoration: none;
  font-size: .75rem; font-weight: 600; letter-spacing: .02em;
}
.nav-baixo svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-baixo svg .cheio { fill: currentColor; stroke: none; }
.nav-baixo a.ativo { color: var(--verde); box-shadow: inset 0 3px 0 var(--verde); background: var(--creme); }

/* ---------- Conteúdo ---------- */
.conteudo { max-width: 760px; margin: 0 auto; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }

.eyebrow {
  margin: 0 0 4px; text-transform: uppercase; letter-spacing: .1em;
  font-size: .75rem; font-weight: 600; color: var(--salvia);
}
h1, h2 { font-family: var(--sans); font-weight: 600; color: var(--verde); margin: 0; line-height: 1.25; }
h1 { font-size: 1.85rem; margin-bottom: 16px; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 18px 0 4px; color: var(--texto); }
p { margin: 0 0 12px; }
small, .pequeno { font-size: .875rem; color: var(--cinza); }
.muted { color: var(--cinza); }
.voltar { display: inline-block; margin: 0 0 12px; padding: 8px 0; font-weight: 500; text-decoration: none; }

/* ---------- Cartões ---------- */
.cartao {
  background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 18px; margin: 0 0 16px;
}
.cartao > h2 a { text-decoration: none; }
.cartao-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.cartao-info { color: var(--cinza); font-size: .95rem; margin: 2px 0 12px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 26px; border-radius: 999px; border: 1.5px solid var(--verde);
  font: inherit; font-weight: 600; font-size: 1.05rem; text-decoration: none; cursor: pointer;
  background: var(--verde); color: #fff;
}
.btn:hover { background: var(--verde-escuro); }
.btn-secundario { background: transparent; color: var(--verde); }
.btn-secundario:hover { background: var(--claro); }
.btn-perigo { background: var(--vermelho); border-color: var(--vermelho); }
.btn-perigo:hover { background: #8f1d17; }
.btn-bloco { display: flex; width: 100%; }
.btn-peq { min-height: 44px; padding: 0 18px; font-size: .95rem; }
.acoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Selos e avisos ---------- */
.selo {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600;
}
.selo-aberto { background: var(--salvia-claro); color: var(--verde); }
.selo-fechado { background: #e4e4df; color: #4a4a45; }
.selo-atencao { background: #fbefc7; color: #6b4a00; }
.selo-cheio { background: #fde0c8; color: #7a3300; }
.selo-excedido { background: #f8d4d1; color: #7a1410; }
.selo-atencao::before { content: "\25CF"; }   /* círculo */
.selo-cheio::before { content: "\25C6"; }     /* losango */
.selo-excedido::before { content: "\25B2"; } /* triângulo */

.aviso { padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-size: .95rem; line-height: 1.4; border-left: 5px solid transparent; }
.aviso.verde { background: #e1ebd8; border-color: var(--ok); }
.aviso.amarelo { background: #fbefc7; border-color: var(--amarelo); }
.aviso.laranja { background: #fde0c8; border-color: var(--laranja); }
.aviso.vermelho { background: #f8d4d1; border-color: var(--vermelho); }

/* ---------- Linhas do MCA e barras ---------- */
.linha { padding: 16px 0; border-top: 1px solid var(--linha); }
.linha:first-of-type { border-top: 0; padding-top: 4px; }
.linha-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.linha-nome { font-weight: 600; font-size: 1.05rem; }
.linha-especie { display: block; color: var(--cinza); font-size: .9rem; }

.barra { height: 14px; background: var(--claro); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.barra-cheio { height: 100%; background: var(--ok); border-radius: 999px; }
.linha.atencao .barra-cheio { background: var(--amarelo); }
.linha.cheio .barra-cheio { background: var(--laranja); }
.linha.excedido .barra-cheio { background: var(--vermelho); }

.numeros { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-variant-numeric: tabular-nums; }
.numeros-total { font-size: 1rem; }
.numeros-total strong { font-weight: 600; font-size: 1.15rem; }
.pct { font-size: 1.5rem; font-weight: 600; color: var(--verde); }
.linha.atencao .pct { color: #8a5f00; }
.linha.cheio .pct { color: #a24a00; }
.linha.excedido .pct { color: var(--vermelho); }
.restam { margin: 2px 0 12px; color: var(--cinza); font-size: .92rem; font-variant-numeric: tabular-nums; }

/* ---------- Cargas ---------- */
.cargas-titulo { margin: 20px 0 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--salvia); font-weight: 600; }
.carga { border-top: 1px solid var(--linha); padding: 12px 0; }
.carga-principal { font-weight: 600; font-variant-numeric: tabular-nums; }
.carga-meta { color: var(--cinza); font-size: .85rem; margin: 2px 0 8px; }
.inativo { opacity: .6; }

/* ---------- Formulários ---------- */
form p { margin: 0 0 18px; }
form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .95rem; }
select, input[type=text], input[type=number], input[type=password], input[type=date], input[type=email] {
  display: block; width: 100%; min-height: 52px; padding: 12px 14px;
  font: inherit; font-size: 1.1rem; color: var(--texto);
  background: var(--branco); border: 1.5px solid var(--linha); border-radius: 12px;
}
select { appearance: auto; }
input:focus, select:focus { border-color: var(--salvia); }
#id_quantidade { font-size: 1.75rem; font-weight: 600; min-height: 64px; font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--verde); vertical-align: middle; margin-left: 8px; }
form p:has(input[type=checkbox]) { display: flex; align-items: center; gap: 4px; }
form p:has(input[type=checkbox]) label { margin: 0; }
.errorlist { list-style: none; margin: 0 0 8px; padding: 0; color: var(--vermelho); font-size: .9rem; font-weight: 500; }

details.filtros { background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); margin-bottom: 16px; }
details.filtros summary { cursor: pointer; padding: 16px 18px; font-weight: 600; min-height: 52px; }
details.filtros form { padding: 0 18px 18px; }

/* ---------- Listas de ligações ("Mais") ---------- */
.lista-links { padding: 4px 18px; }
.item-lista {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 60px; padding: 14px 0; border-top: 1px solid var(--linha);
  color: var(--texto); text-decoration: none; font-weight: 500;
}
.item-lista:first-child { border-top: 0; }
.item-lista::after { content: "\203A"; font-size: 1.6rem; color: var(--salvia); line-height: 1; }

/* ---------- Paginação ---------- */
.paginacao { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }

/* ---------- Início de sessão ---------- */
.login { max-width: 420px; margin: 24px auto 0; }
.login .marca-grande { display: flex; justify-content: center; margin-bottom: 12px; }
.login .marca-grande svg { width: 40px; height: 51px; fill: none; stroke: var(--verde); stroke-width: 1.4; }
.login h1 { text-align: center; }

/* ---------- Ecrãs maiores ---------- */
@media (min-width: 768px) {
  .nav-baixo { display: none; }
  .nav-topo { display: flex; }
  .conteudo { padding: 32px 24px 56px; }
  h1 { font-size: 2.2rem; }
  .cartao { padding: 22px 24px; }
  .btn-bloco.so-movel { display: none; }
}

.titulo-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.titulo-linha h1 { margin: 0; }
.titulo-linha .btn { margin-left: auto; }