/* =========================================================================
   NÚCLEO — folha de estilo única (fundação da interface, Fase 6)

   Sistema de cores/tipografia pensado para o público real do produto:
   famílias cuidando de idosos, muitas vezes com baixa visão, tremor ou
   pouca familiaridade com telas densas (ver 08-acessibilidade-e-inclusao.md).
   Por isso: contraste alto por padrão, alvos de toque grandes, cor nunca
   sozinha como indicador de status, sem depender de fonte externa (evita
   flash de texto sem estilo e falha de rede em conexão doméstica ruim).
   ========================================================================= */

:root {
  /* --- cor: paleta clara (padrão) --- */
  --bg: #F5F4EF;
  --bg-panel: #FFFFFF;
  --bg-raised: #FBFAF7;
  --text: #262421;
  --text-muted: #6B6559;
  --border: #DEDACD;
  --border-strong: #C7C1AF;

  --accent: #1F6F5C;
  --accent-strong: #14503F;
  --accent-soft: #E3EFEA;
  --accent-contrast: #FFFFFF;

  --warn: #8A5A0B;
  --warn-soft: #F6EAD3;
  --danger: #9C3D26;
  --danger-soft: #F5E2DA;
  --success: #2B6E45;
  --success-soft: #E1EFE4;

  --focus-ring: #0B57D0;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-panel: 0 1px 2px rgba(38, 36, 33, 0.06);

  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Noto Serif", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

[data-theme="escuro"] {
  --bg: #141E1B;
  --bg-panel: #1B2724;
  --bg-raised: #20302C;
  --text: #EDEAE2;
  --text-muted: #A7B0AA;
  --border: #33443E;
  --border-strong: #44584F;

  --accent: #5FB89E;
  --accent-strong: #7FCDB4;
  --accent-soft: #1F3A33;
  --accent-contrast: #0E1A17;

  --warn: #D8B15C;
  --warn-soft: #3A311C;
  --danger: #E08669;
  --danger-soft: #3B241D;
  --success: #7FCB98;
  --success-soft: #1E3626;

  --focus-ring: #7FB2FF;
  --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  [data-theme="automatico"] {
    --bg: #141E1B;
    --bg-panel: #1B2724;
    --bg-raised: #20302C;
    --text: #EDEAE2;
    --text-muted: #A7B0AA;
    --border: #33443E;
    --border-strong: #44584F;
    --accent: #5FB89E;
    --accent-strong: #7FCDB4;
    --accent-soft: #1F3A33;
    --accent-contrast: #0E1A17;
    --warn: #D8B15C;
    --warn-soft: #3A311C;
    --danger: #E08669;
    --danger-soft: #3B241D;
    --success: #7FCB98;
    --success-soft: #1E3626;
    --focus-ring: #7FB2FF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
  transition: background-color .15s ease, color .15s ease;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .4em;
  color: var(--text);
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; max-width: 62ch; }

a { color: var(--accent-strong); }
[data-theme="escuro"] a { color: var(--accent); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: .75em 1.2em;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* --- formulários --- */
.campo { margin-bottom: 1.1em; }
.campo label {
  display: block;
  font-weight: 600;
  margin-bottom: .35em;
  font-size: .95rem;
}
.campo .ajuda { font-size: .85rem; color: var(--text-muted); margin-top: .3em; }
.campo .erro-campo { font-size: .85rem; color: var(--danger); margin-top: .3em; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], select {
  width: 100%;
  min-height: 48px;
  padding: .6em .8em;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text);
}
input:invalid.tocado { border-color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 48px;
  padding: .65em 1.4em;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-contrast);
  transition: background-color .12s ease, transform .05s ease;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secundario {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn.secundario:hover { background: var(--bg-raised); }
.btn.perigo { background: var(--danger); }
.btn.perigo:hover { filter: brightness(1.08); }
.btn.bloco { width: 100%; }
.btn.pequeno { min-height: 40px; padding: .4em 1em; font-size: .92rem; }
.btn.icone { min-width: 44px; padding: .5em; }

.link-botao {
  background: none; border: none; padding: 0;
  color: var(--accent-strong); font-weight: 600; cursor: pointer;
  min-height: 44px;
}

/* --- telas de autenticação --- */
.tela-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}
.cartao-auth {
  width: 100%;
  max-width: 420px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 2rem 1.75rem;
}
.marca {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: .01em;
  margin-bottom: .1em;
}
.marca .ponto { color: var(--accent); }
.subtitulo-auth { color: var(--text-muted); margin-bottom: 1.6em; }
.rodape-auth { margin-top: 1.4em; text-align: center; color: var(--text-muted); font-size: .95rem; }

.banner-erro, .banner-info {
  border-radius: var(--radius-sm);
  padding: .8em 1em;
  margin-bottom: 1.1em;
  font-size: .95rem;
  border: 1px solid transparent;
}
.banner-erro { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.banner-info { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }

/* --- app autenticado --- */
.barra-topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}
.barra-topo .marca { font-size: 1.25rem; margin: 0; }
.barra-topo .acoes { display: flex; align-items: center; gap: .4rem; }

.conteudo {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.saudacao { margin-bottom: .1em; }
.saudacao-sub { color: var(--text-muted); margin-bottom: 1.6em; }

.grade-painel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 900px) {
  .grade-painel { grid-template-columns: 1.4fr 1fr; align-items: start; }
}

.secao-titulo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: .7em;
}
.secao-titulo .contagem { color: var(--text-muted); font-size: .95rem; }

.painel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.painel h3 { margin-bottom: .6em; }
.linha-info {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding: .5em 0;
  border-bottom: 1px solid var(--border);
  font-size: .97rem;
}
.linha-info:last-child { border-bottom: none; }
.linha-info .rotulo { color: var(--text-muted); }
.linha-info .valor { font-weight: 600; text-align: right; }

/* --- lista "hoje" --- */
.lista-ocorrencias { list-style: none; margin: 0; padding: 0; }
.item-ocorrencia {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .95rem 0;
  border-bottom: 1px solid var(--border);
}
.item-ocorrencia:last-child { border-bottom: none; }

.barra-status { width: 5px; align-self: stretch; border-radius: 4px; flex-shrink: 0; }
.barra-status.pendente { background: var(--warn); }
.barra-status.em_andamento { background: var(--accent); }
.barra-status.concluida { background: var(--success); }
.barra-status.perdida, .barra-status.cancelada { background: var(--danger); }

.icone-status { width: 26px; height: 26px; flex-shrink: 0; }
.icone-status.pendente { color: var(--warn); }
.icone-status.em_andamento { color: var(--accent); }
.icone-status.concluida { color: var(--success); }
.icone-status.perdida, .icone-status.cancelada { color: var(--danger); }

.detalhe-ocorrencia { flex: 1; min-width: 0; }
.detalhe-ocorrencia .titulo-ativ { font-weight: 600; }
.detalhe-ocorrencia .meta-ativ { color: var(--text-muted); font-size: .9rem; }

.selo {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  font-size: .82rem;
  font-weight: 600;
  padding: .2em .6em;
  border-radius: 999px;
}
.selo.pendente { background: var(--warn-soft); color: var(--warn); }
.selo.em_andamento { background: var(--accent-soft); color: var(--accent-strong); }
.selo.concluida { background: var(--success-soft); color: var(--success); }
.selo.perdida, .selo.cancelada { background: var(--danger-soft); color: var(--danger); }

.estado-vazio {
  color: var(--text-muted);
  padding: 1.2em 0;
}

/* --- toast --- */
#toast-region {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(92vw, 420px);
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: .8em 1.1em;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  font-size: .95rem;
  display: flex;
  align-items: flex-start;
  gap: .6em;
}
.toast.erro { background: var(--danger); color: #fff; }
.toast.sucesso { background: var(--success); color: #fff; }
.toast button { background: none; border: none; color: inherit; width: 22px; height: 22px; flex-shrink: 0; cursor: pointer; }

.centro-carregando {
  display: flex; align-items: center; gap: .6em;
  color: var(--text-muted); padding: 2rem 0;
}
.girando {
  width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--accent);
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.grupo-2fa { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.2em; }

/* --- navegação por abas (Fase 6, extensão) --- */
.barra-abas {
  display: flex;
  gap: .3rem;
  padding: 0 1.25rem;
  overflow-x: auto;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}
.aba {
  display: inline-block;
  padding: .8em .9em;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.aba:hover { color: var(--text); }
.aba-ativa { color: var(--accent-strong); border-bottom-color: var(--accent); }
[data-theme="escuro"] .aba-ativa { color: var(--accent); }

/* --- listas simples (membros, convites, contratos, módulos, faturas) --- */
.lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-simples li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.lista-simples li:last-child { border-bottom: none; }
.titulo-item { font-weight: 600; display: block; }

.conteudo-contrato {
  max-width: 68ch;
  padding: 1em 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1em;
}
.conteudo-contrato h1 { font-size: 1.2rem; }

.cartao-qr {
  display: inline-block;
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin: .8em 0;
  line-height: 0;
}


