/* Aspecto aprovado nos desenhos da fase 1 (Claude Design, «Ecrãs da fase 1»). Sem estilos em linha: a política de
   segurança do servidor proíbe-os. */

:root {
  --acento: #24557f;
  --acento-escuro: #163a58;
  --acento-claro: #e8eef4;
  --texto: #1b1f24;
  --texto-2: #4a5560;
  --texto-3: #3b4550;
  --linha: #e1e5ea;
  --linha-2: #eef0f2;
  --campo: #c9d0d7;
  --fundo: #f3f5f7;
  --branco: #ffffff;
  --verde: #1e5c34;      --verde-fundo: #e3f1e7;
  --laranja: #8a3412;    --laranja-fundo: #fdebdc;   --laranja-forte: #c2410c;
  --vermelho: #8f1d1d;   --vermelho-fundo: #fbe4e4;
  --cinza: #3b4550;      --cinza-fundo: #eef0f2;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fundo); color: var(--texto); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.45; }
a { color: var(--acento); }
a:hover { color: var(--acento-escuro); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 26px; }
h2 { font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
.a-carregar { padding: 40px; color: var(--texto-2); }

/* ---------- Estrutura: menu ao lado no computador, barra em baixo no telemóvel ---------- */
.app { min-height: 100vh; display: flex; }
.menu { flex: 0 0 236px; background: var(--branco); border-right: 1px solid var(--linha); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; }
.menu-marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 600; }
.menu-marca-logo { width: 32px; height: 32px; border: 1.5px dashed #9aa4ae; border-radius: 6px; flex: none; }
.menu a { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; color: var(--texto); text-decoration: none; }
.menu a.activo { background: var(--acento-claro); color: var(--acento); font-weight: 600; }
.menu-rodape { margin-top: auto; font-size: 13px; color: var(--texto-2); padding: 12px 8px 0; }
.principal { flex: 1; min-width: 0; padding: 26px 32px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1180px; }
.barra { display: none; }

@media (max-width: 760px) {
  .menu { display: none; }
  .principal { padding: 16px 16px 96px; gap: 16px; }
  h1 { font-size: 22px; }
  .barra { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; background: var(--branco); border-top: 1px solid var(--linha); padding: 6px 4px 14px; z-index: 5; }
  .barra a { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--texto-2); text-decoration: none; }
  .barra a.activo { color: var(--acento); font-weight: 600; }
  .barra svg { width: 22px; height: 22px; }
}

/* ---------- Cabeçalhos ---------- */
.cabecalho { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.cabecalho-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cabecalho-accoes { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.antetitulo { font-size: 13px; color: var(--texto-2); }
.subtitulo { font-size: 13px; color: var(--texto-2); }

/* ---------- Cartões e listas ---------- */
.cartao { background: var(--branco); border: 1px solid var(--linha); border-radius: 10px; }
.cartao-titulo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--linha); }
.cartao-titulo .botao { margin-left: auto; }
.cartao-corpo { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.lista { display: flex; flex-direction: column; }
.linha { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--linha-2); color: var(--texto); text-decoration: none; min-height: 52px; }
.linha:last-child { border-bottom: 0; }
a.linha:hover { background: #f7f9fa; color: var(--texto); }
.linha-texto { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.linha-titulo { font-weight: 600; }
.linha-detalhe { font-size: 13px; color: var(--texto-2); }
.lei { font-family: var(--mono); font-size: 11.5px; color: var(--texto-2); }
.vazio { padding: 18px; color: var(--texto-2); font-size: 14px; }
.grelha { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.grelha-cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.cartao-ligacao { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--texto); }
.cartao-ligacao:hover { border-color: var(--acento); color: var(--texto); }

/* ---------- Contadores e etiquetas ---------- */
.contadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.contador { border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; background: var(--branco); border: 1px solid var(--linha); }
.contador-numero { font-size: 24px; font-weight: 600; }
.contador-texto { font-size: 12.5px; }
.contador.vermelho { background: var(--vermelho-fundo); color: var(--vermelho); border-color: transparent; }
.contador.laranja { background: var(--laranja-fundo); color: var(--laranja); border-color: transparent; }
.contador.cinza { background: var(--cinza-fundo); color: var(--cinza); border-color: transparent; }
.contador.verde { background: var(--verde-fundo); color: var(--verde); border-color: transparent; }
.etiqueta { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.etiqueta.ok { color: var(--verde); background: var(--verde-fundo); }
.etiqueta.falta, .etiqueta.a-caducar { color: var(--laranja); background: var(--laranja-fundo); }
.etiqueta.caducado { color: var(--vermelho); background: var(--vermelho-fundo); }
.etiqueta.confirmar, .etiqueta.conservacao, .etiqueta.neutra { color: var(--cinza); background: var(--cinza-fundo); }
.ponto { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: flex-start; margin-top: 6px; }
.ponto.caducado { background: var(--vermelho); }
.ponto.a-caducar { background: var(--laranja-forte); }
.ponto.conservacao { background: #5b6570; }

/* ---------- Botões ---------- */
.botao { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--campo); background: var(--branco); font-weight: 600; font-size: 14.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--texto); }
.botao:hover { border-color: var(--acento); color: var(--texto); }
.botao.primario { background: var(--acento); border-color: var(--acento); color: #ffffff; }
.botao.primario:hover { background: var(--acento-escuro); }
.botao.grande { min-height: 56px; font-size: 17px; border-radius: 10px; width: 100%; }
.botao.discreto { border-color: transparent; background: transparent; color: var(--acento); padding: 0 8px; }
.botao:disabled { opacity: 0.6; cursor: default; }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.filtro { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--campo); background: var(--branco); font-size: 13.5px; cursor: pointer; }
.filtro.activo { border: 2px solid var(--acento); color: var(--acento); font-weight: 600; }
.separadores { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--linha); }
.separador { min-height: 46px; padding: 0 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; font-size: 14.5px; color: var(--texto-2); cursor: pointer; }
.separador.activo { border-bottom-color: var(--acento); color: var(--acento); font-weight: 600; }

/* ---------- Formulários ---------- */
.formulario { display: flex; flex-direction: column; gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label, .campo .rotulo { font-size: 13.5px; font-weight: 600; }
.campo input:not([type=checkbox]), .campo select, .campo textarea { min-height: 46px; border-radius: 8px; border: 1px solid var(--campo); padding: 8px 12px; background: var(--branco); font-size: 15px; width: 100%; }
.campo textarea { min-height: 88px; resize: vertical; }
.campo-caixa { flex-direction: row; align-items: center; gap: 10px; }
.campo-caixa input { width: 22px; height: 22px; }
.ajuda { font-size: 12.5px; color: var(--texto-2); }
.formulario details { border-top: 1px solid var(--linha-2); padding-top: 10px; }
.formulario summary { cursor: pointer; color: var(--acento); font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.formulario details[open] summary { margin-bottom: 12px; }
.formulario-accoes { display: flex; flex-wrap: wrap; gap: 8px; }
.erro { color: var(--vermelho); background: var(--vermelho-fundo); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0; }
.nota { font-size: 13px; color: var(--texto-3); margin: 0; }

/* ---------- Verificação à entrada ---------- */
.verificacao { display: flex; flex-direction: column; gap: 10px; }
.verif-item { background: var(--branco); border: 1px solid var(--campo); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.verif-item.com-falta { border: 2px solid var(--laranja-forte); }
.verif-cabeca { display: flex; align-items: center; gap: 8px; }
.verif-nome { font-weight: 600; flex: 1; }
.verif-falta { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--linha-2); padding-top: 8px; }

/* ---------- Entrada (instalar, ligar, PIN) ---------- */
.entrada { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.entrada .cartao { width: 100%; max-width: 420px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.codigo-grande { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: 0.08em; text-align: center; padding: 12px; background: var(--fundo); border-radius: 8px; }

/* ---------- Avisos que aparecem e desaparecem ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 10; width: min(440px, calc(100% - 32px)); }
.toast { background: var(--texto); color: #ffffff; border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; font-size: 14.5px; }
.toast button { margin-left: auto; background: transparent; border: 1px solid rgba(255, 255, 255, 0.5); color: #ffffff; border-radius: 8px; min-height: 36px; padding: 0 12px; font-weight: 600; cursor: pointer; }
.toast.erro-toast { background: var(--vermelho); }
@media (max-width: 760px) { .toasts { bottom: 92px; } }

/* ---------- Impressão (verificação à entrada em papel ou PDF) ---------- */
@media print {
  body { background: #ffffff; }
  .menu, .barra, .nao-imprimir, .toasts, .botao { display: none !important; }
  .principal { padding: 0; max-width: none; }
  .verif-item { break-inside: avoid; }
}
