/* Tokens da marca Thiago Alves — valores em docs/DESIGN-TOKENS.md. Toda cor de marca sai daqui. */
:root {
  --brand: #2563EB;        /* acento: botões, preço, destaques */
  --brand-2: #10233F;      /* navy: títulos, topo, rodapé */
  --on-brand: #FFFFFF;     /* texto sobre o acento */
  --bg: #F8FAFC;           /* branco suave */
  --mist: #EAF1FA;         /* azul névoa */
  --surface: #FFFFFF;
  --text: #10233F;
  --muted: #475569;
  --line: #DCE3EC;
  --ok: #15803D;
  --warn: #B45309;
  --danger: #B91C1C;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 35, 63, .06), 0 4px 16px rgba(16, 35, 63, .06);
  --font-title: "Manrope", Arial, sans-serif;
  --font-body: "Inter", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.55 var(--font-body); }
h1, h2, h3 { font-family: var(--font-title); color: var(--brand-2); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.erro { color: var(--danger); min-height: 1.2em; margin: .5rem 0 0; font-size: .92rem; }
.dica { color: var(--muted); font-size: .88rem; text-align: center; }
[hidden] { display: none !important; }

/* botões */
.btn { font: 600 .95rem var(--font-body); border-radius: 10px; padding: .65rem 1.1rem; border: 1px solid transparent; cursor: pointer; }
.btn-primario { background: var(--brand); color: var(--on-brand); }
.btn-primario:hover { filter: brightness(.94); }
.btn-primario:disabled { opacity: .55; cursor: not-allowed; }
.btn-secundario { background: var(--surface); color: var(--brand-2); border-color: var(--line); }
.btn-secundario:hover { border-color: var(--brand); color: var(--brand); }
.btn-link { background: none; color: var(--muted); padding: .4rem .6rem; }
.btn-link:hover { color: var(--brand); }
.btn-perigo { background: none; color: var(--danger); padding: .4rem .6rem; }
.btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(180deg, var(--mist), var(--bg)); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 2rem; }
.login-card .logo { height: 44px; margin-bottom: 1.25rem; }
.login-card form { display: grid; gap: .9rem; margin-top: 1rem; }
.link-centro { justify-self: center; font-size: .9rem; }
.sucesso { color: var(--ok); min-height: 1.2em; margin: 0; font-size: .92rem; }
.forca { margin: -.4rem 0 0; font-size: .85rem; color: var(--muted); }
.forca.curta, .forca.fraca { color: var(--danger); }
.forca.media { color: var(--warn); }
.forca.forte { color: var(--ok); }

/* formulários */
label { display: grid; gap: .3rem; font-weight: 500; font-size: .92rem; color: var(--brand-2); }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: 1rem var(--font-body); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; width: 100%; }
textarea { min-height: 90px; resize: vertical; }

/* topo e abas */
.topo { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .9rem 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topo-marca { display: flex; align-items: center; gap: .9rem; }
.topo-marca .logo { height: 34px; }
.produto { font: 700 .95rem var(--font-title); color: var(--brand-2); padding-left: .9rem; border-left: 1px solid var(--line); }
.topo-acoes { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.topo-acoes select { width: auto; max-width: 260px; }
.abas { display: flex; gap: .25rem; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.abas button { font: 600 .92rem var(--font-body); color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: .85rem .9rem; cursor: pointer; white-space: nowrap; }
.abas button.ativa { color: var(--brand); border-bottom-color: var(--brand); }
.abas .aba-link { font: 600 .92rem var(--font-body); color: var(--muted); text-decoration: none; padding: .85rem .9rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.abas .aba-link:hover { color: var(--brand); }

.conteudo { max-width: 1100px; margin: 0 auto; padding: 24px; min-height: 60vh; }
.cabecalho-secao { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.cabecalho-secao p { margin: 0; }

/* cards */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; display: grid; gap: .6rem; align-content: start; }
.card p { margin: 0; }
.card-rodape { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.agente .num { font: 800 .8rem var(--font-title); color: var(--brand); letter-spacing: .08em; }
.agente.bloqueado { background: var(--mist); }
.cota { font-size: .85rem; color: var(--muted); }

.selo { display: inline-block; font: 600 .75rem var(--font-body); border-radius: 999px; padding: .15rem .6rem; background: var(--mist); color: var(--brand-2); }
.selo.alta { background: #FDE8E8; color: var(--danger); }
.selo.media { background: #FEF3C7; color: var(--warn); }
.selo.baixa { background: #E0F2E9; color: var(--ok); }
.selo.feito { background: #E0F2E9; color: var(--ok); }
.selo.adicional { background: var(--brand); color: var(--on-brand); }

/* diagnóstico */
.diag-topo { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.nota { font: 800 2rem var(--font-title); color: var(--brand); line-height: 1; }
.nota small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.resumo { white-space: pre-line; }
.pontos { list-style: none; padding: 0; margin: .25rem 0 0; display: grid; gap: .45rem; }
.pontos li { display: grid; grid-template-columns: 1.4rem 1fr; gap: .4rem; font-size: .94rem; }
.pontos .forte::before { content: "✓"; color: var(--ok); font-weight: 700; }
.pontos .melhorar::before { content: "!"; color: var(--warn); font-weight: 800; text-align: center; }
.pontos b { color: var(--brand-2); }
.anotacao { background: var(--mist); border-radius: 8px; padding: .6rem .8rem; font-size: .92rem; white-space: pre-line; }

/* plano de ação */
.lista { display: grid; gap: .6rem; }
.item-acao { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.item-acao.feito h3 { text-decoration: line-through; color: var(--muted); }
.item-acao .meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .35rem; }
.item-acao p { margin: .2rem 0 0; color: var(--muted); font-size: .94rem; }
.item-acao .controles { display: flex; gap: .3rem; align-items: center; }
.item-acao select { width: auto; padding: .35rem .5rem; font-size: .88rem; }
.progresso { height: 8px; background: var(--mist); border-radius: 999px; overflow: hidden; margin: .4rem 0 1rem; }
.progresso span { display: block; height: 100%; background: var(--brand); }

/* textos */
.texto-conteudo { white-space: pre-line; background: var(--mist); border-radius: 8px; padding: .75rem .9rem; }

/* vazio, carregando, aviso */
.vazio { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.vazio h2 { margin-bottom: .4rem; }
.carregando { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); }
.carregando::before { content: ""; width: 1rem; height: 1rem; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.aviso { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--brand-2); color: var(--on-brand); padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100% - 32px); z-index: 20; }

/* modal */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(16, 35, 63, .45); }
#modal-form { padding: 1.5rem; display: grid; gap: .9rem; max-height: 85vh; overflow-y: auto; }
#modal-campos { display: grid; gap: .8rem; }
.modal-botoes { display: flex; justify-content: flex-end; gap: .5rem; }

.rodape { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.25rem 24px; background: var(--brand-2); color: var(--on-brand); font-size: .85rem; }
.rodape { align-items: center; }
.rodape .muted { color: color-mix(in srgb, var(--on-brand) 70%, transparent); }
.logo-rodape { height: 30px; }

@media (max-width: 640px) {
  .topo, .abas, .conteudo, .rodape { padding-left: 16px; padding-right: 16px; }
  .produto { display: none; }
  .item-acao { grid-template-columns: 1fr; }
}

/* aviso de privacidade (HIPAA) no formulário do consultório */
.privacidade { background: var(--mist); border-radius: 8px; padding: .7rem .9rem; margin: 0 0 .9rem; font-size: .9rem; color: var(--brand-2); }
label small.curta, label small.fraca { color: var(--danger); }
label small.media { color: var(--warn); }
label small.forte { color: var(--ok); }
