/* VacinaPet — visual "carteira de vacinação" */
:root {
  --petroleo: #0E5C55;
  --petroleo-escuro: #0A4540;
  --petroleo-claro: #E3F0EE;
  --girassol: #F2B43A;
  --girassol-claro: #FDF1D6;
  --coral: #D64545;
  --coral-claro: #FBE6E4;
  --ambar: #9A6400;
  --fundo: #F2F5F3;
  --superficie: #FFFFFF;
  --texto: #1E2A2F;
  --suave: #5E6B6E;
  --linha: #E1E7E4;
  --linha-forte: #CCD6D2;
  --roxo: #6D3FC0;
  --roxo-claro: #EFE8FB;
  --azul: #1F5FBF;
  --azul-claro: #E4EDFB;
  --raio: 14px;
  --raio-p: 10px;
  --fonte-titulo: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --fonte: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--fonte); color: var(--texto); background: var(--fundo); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--fonte-titulo); font-weight: 700; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .55rem; }
small { color: var(--suave); }
.ic { width: 20px; height: 20px; flex: none; }
.ic.pequeno { width: 16px; height: 16px; }
:focus-visible { outline: 3px solid var(--girassol); outline-offset: 2px; }

/* ------------------------------------------------ Marca */
.marca { display: flex; align-items: center; gap: .6rem; font-family: var(--fonte-titulo); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; }
.marca .ic { width: 30px; height: 30px; padding: 5px; border-radius: 9px; background: var(--girassol); color: var(--petroleo-escuro); }
.marca.clara { color: #fff; }

/* ------------------------------------------------ Login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; }
.login-capa {
  position: relative; overflow: hidden; background: var(--petroleo); color: #E3F0EE;
  padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
}
.login-capa::after { /* pata grande ao fundo */
  content: ""; position: absolute; right: -30px; bottom: 90px; width: 300px; height: 300px; opacity: .08;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23ffffff'%3E%3Cellipse cx='12' cy='15.5' rx='4.6' ry='3.8'/%3E%3Ccircle cx='5.6' cy='10' r='2.1'/%3E%3Ccircle cx='9.2' cy='5.8' r='2.1'/%3E%3Ccircle cx='14.8' cy='5.8' r='2.1'/%3E%3Ccircle cx='18.4' cy='10' r='2.1'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
  transform: rotate(-18deg);
}
.login-frase { font-family: var(--fonte-titulo); font-size: clamp(1.9rem, 3.2vw, 2.8rem); line-height: 1.12; color: #fff; max-width: 13em; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
.login-lista { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; position: relative; z-index: 1; }
.login-lista li { display: flex; gap: .7rem; align-items: center; }
.login-lista li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--girassol); flex: none; }
.login-area { display: grid; place-items: center; padding: 2rem; }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 1rem; }
.login-card .sub { margin: -.5rem 0 .5rem; color: var(--suave); }

/* ------------------------------------------------ Estrutura */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--petroleo) 248px, var(--fundo) 248px); }
.menu {
  background: var(--petroleo); color: #CFE3E0; display: flex; flex-direction: column;
  padding: 1.5rem 0 1.25rem 1rem; position: sticky; top: 0; height: 100vh;
}
.menu .marca { padding: 0 .5rem 2rem; }
.menu nav { display: grid; gap: .2rem; }
.menu nav a {
  position: relative; display: flex; align-items: center; gap: .75rem;
  color: #CFE3E0; text-decoration: none; padding: .7rem 1rem; border-radius: 12px 0 0 12px; font-weight: 500;
  transition: background .15s, color .15s;
}
.menu nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.menu nav a.ativo { background: var(--fundo); color: var(--petroleo-escuro); font-weight: 700; }
.menu nav a.ativo::before { /* aba da carteira */
  content: ""; position: absolute; left: -1rem; top: 9px; bottom: 9px; width: 5px; border-radius: 0 4px 4px 0; background: var(--girassol);
}
.usuario-box { margin-top: auto; margin-right: 1rem; padding: 1rem .5rem 0; border-top: 1px solid rgba(255,255,255,.14); font-size: .9rem; color: #fff; }
.usuario-box small { color: #A9C9C4; }
.usuario-acoes { display: flex; justify-content: space-between; margin-top: .6rem; }
.usuario-acoes .link { color: #F7D58C; display: inline-flex; align-items: center; gap: .3rem; font-weight: 500; }
.conteudo { padding: 2.25rem 2.5rem 3rem; min-width: 0; max-width: 1400px; }

.topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.topo .acoes { display: flex; gap: .5rem; flex-wrap: wrap; }
.sub-titulo { margin: .3rem 0 0; color: var(--suave); }
.sub-titulo::first-letter { text-transform: uppercase; }

/* ------------------------------------------------ Superfícies */
.cartao { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); padding: 1.4rem 1.5rem; margin-bottom: 1.5rem; }
.grade-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.grade-2 .cartao { margin-bottom: 0; }
.grade-2 + .cartao { margin-top: 1.5rem; }

/* Faixa de indicadores: um bloco único com divisórias */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); margin-bottom: 1.5rem; overflow: hidden; }
.kpi { padding: 1.2rem 1.5rem; border-left: 1px solid var(--linha); }
.kpi:first-child { border-left: 0; }
.kpi .rotulo { color: var(--suave); font-size: .88rem; font-weight: 500; }
.kpi .valor { font-family: var(--fonte-titulo); font-size: 2.4rem; font-weight: 700; line-height: 1.1; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.kpi small { display: block; margin-top: .15rem; }
.kpi.alerta { background: linear-gradient(var(--coral), var(--coral)) top / 100% 4px no-repeat; }
.kpi.alerta .valor { color: var(--coral); }
.kpi.atencao { background: linear-gradient(var(--girassol), var(--girassol)) top / 100% 4px no-repeat; }
.kpi.atencao .valor { color: var(--ambar); }

.ponto { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.ponto.vencido { background: var(--coral); box-shadow: 0 0 0 4px var(--coral-claro); }
.ponto.avencer { background: var(--girassol); box-shadow: 0 0 0 4px var(--girassol-claro); }

/* ------------------------------------------------ Formulários */
label { display: grid; gap: .35rem; font-size: .88rem; color: #33413F; font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: 400; padding: .65rem .8rem; border: 1px solid var(--linha-forte); border-radius: var(--raio-p);
  background: #fff; color: var(--texto); width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #AFC0BB; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--petroleo); box-shadow: 0 0 0 3px rgba(14, 92, 85, .16); }
select:disabled { background: var(--fundo); color: var(--suave); }
textarea { min-height: 80px; resize: vertical; }
.form-grade { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.1rem; }
.form-grade .inteira { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--petroleo); }
.form-rodape { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; padding-top: 1.1rem; border-top: 1px solid var(--linha); }
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; align-items: end; }
.msg-erro { color: var(--coral); min-height: 1.2em; margin: 0; font-size: .9rem; font-weight: 500; }
.msg-erro:empty { min-height: 0; }

/* ------------------------------------------------ Botões */
.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--linha-forte); background: #fff; color: var(--texto);
  padding: .62rem 1.1rem; border-radius: var(--raio-p); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--fundo); border-color: #AFC0BB; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primario { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
.btn.primario:hover { background: var(--petroleo-escuro); border-color: var(--petroleo-escuro); }
.btn.perigo { color: var(--coral); border-color: #F2C4C0; background: #fff; }
.btn.perigo:hover { background: var(--coral-claro); }
.btn.pequeno { padding: .32rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.largo { width: 100%; padding: .85rem; font-size: 1rem; }
.link { background: none; border: none; padding: 0; font: inherit; cursor: pointer; color: var(--petroleo); text-decoration: none; }
a.link:hover { text-decoration: underline; }
.link.forte { font-weight: 700; color: var(--texto); }

/* ------------------------------------------------ Tabelas */
.tabela-wrap { overflow-x: auto; margin: 0 -.5rem; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .75rem .5rem; border-bottom: 1px solid var(--linha); vertical-align: middle; }
th { font-size: .82rem; color: var(--suave); font-weight: 600; border-bottom-color: var(--linha-forte); white-space: nowrap; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #F7FAF8; }
tbody tr:last-child td { border-bottom: 0; }
td.acoes { white-space: nowrap; text-align: right; }
td.acoes .btn { margin-left: .2rem; }
td.num, th.num { text-align: right; }
td small { display: block; }
.vazio { text-align: center; color: var(--suave); padding: 2.5rem 1rem !important; }

/* Avatar do animal (inicial, cor por espécie) */
.pessoa { display: flex; align-items: center; gap: .7rem; }
.pessoa > div { min-width: 0; }
.pessoa small { white-space: nowrap; }
.avatar {
  width: 34px; height: 34px; border-radius: 11px; display: inline-grid; place-items: center; flex: none;
  font-family: var(--fonte-titulo); font-weight: 700; font-size: .95rem;
}
.avatar.cao { background: var(--petroleo-claro); color: var(--petroleo); }
.avatar.gato { background: var(--girassol-claro); color: var(--ambar); }
.chip-animal { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem .2rem .2rem; border-radius: 999px; background: var(--fundo); color: var(--texto); text-decoration: none; font-weight: 500; font-size: .88rem; margin: .1rem .2rem .1rem 0; }
.chip-animal .avatar { width: 24px; height: 24px; border-radius: 50%; font-size: .75rem; }
.chip-animal:hover { background: var(--petroleo-claro); }

/* Etiquetas */
.tag { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tag.vencido, .tag.avencer, .tag.emdia, .tag.renovado, .tag.semvenc { padding-left: .55rem; }
.tag.vencido::before, .tag.avencer::before, .tag.emdia::before, .tag.renovado::before, .tag.semvenc::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag.vencido { background: var(--coral-claro); color: #B13232; }
.tag.avencer { background: var(--girassol-claro); color: var(--ambar); }
.tag.emdia { background: var(--petroleo-claro); color: var(--petroleo); }
.tag.renovado, .tag.semvenc { background: #EEF1F0; color: var(--suave); }
.tag.vacina { background: var(--azul-claro); color: var(--azul); }
.tag.remedio { background: var(--roxo-claro); color: var(--roxo); }

/* ------------------------------------------------ Modal */
.modal { position: fixed; inset: 0; background: rgba(16, 36, 34, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1rem; z-index: 50; }
.modal-caixa { background: #fff; border-radius: 20px; width: 100%; max-width: 740px; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(10, 40, 37, .28); animation: abrir .18s ease-out; }
@keyframes abrir { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-caixa header { display: flex; justify-content: space-between; align-items: center; padding: 1.3rem 1.6rem .4rem; position: sticky; top: 0; background: #fff; z-index: 2; }
#modal-corpo { padding: 1rem 1.6rem 1.5rem; }
.fechar { border: none; background: var(--fundo); width: 36px; height: 36px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; color: var(--suave); line-height: 1; }
.fechar:hover { background: var(--linha); color: var(--texto); }

.ficha { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem 1.25rem; margin-bottom: 1.5rem; padding: 1.1rem 1.2rem; background: var(--fundo); border-radius: var(--raio); }
.ficha div small { display: block; font-size: .8rem; margin-bottom: .1rem; }
#modal-corpo .topo { margin: 0 0 .5rem; align-items: center; }

/* ------------------------------------------------ Diversos */
.aviso { position: fixed; bottom: 1.5rem; right: 1.5rem; background: var(--petroleo-escuro); color: #fff; padding: .85rem 1.2rem; border-radius: 12px; z-index: 100; box-shadow: 0 12px 30px rgba(10,40,37,.3); max-width: 380px; font-weight: 500; animation: abrir .18s ease-out; }
.aviso.erro { background: var(--coral); }
.resumo-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .2rem 2rem; }
.resumo-lista div { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--linha); padding: .5rem 0; }
.resumo-lista strong { font-family: var(--fonte-titulo); font-size: 1.1rem; }
.cabecalho-impressao { display: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------ Celular / tablet */
@media (max-width: 1440px) {
  .grade-2 { grid-template-columns: minmax(0, 1fr); }
  .grade-2 .cartao + .cartao { margin-top: 0; }
}

@media (max-width: 900px) {
  .app { background: var(--fundo); }
  .login { grid-template-columns: 1fr; }
  .login-capa { padding: 1.75rem 1.5rem; gap: 1.2rem; }
  .login-lista { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu { position: sticky; top: 0; z-index: 20; height: auto; padding: .8rem 1rem; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .5rem; }
  .menu .marca { padding: 0; font-size: 1.1rem; }
  .menu nav { order: 3; width: 100%; display: flex; overflow-x: auto; gap: .3rem; scrollbar-width: none; }
  .menu nav a { border-radius: 999px; padding: .45rem .9rem; white-space: nowrap; }
  .menu nav a.ativo::before { display: none; }
  .usuario-box { margin: 0 0 0 auto; padding: 0; border: 0; }
  #usuario-nome { display: none; }
  .usuario-acoes { margin: 0; gap: 1rem; }
  .conteudo { padding: 1.25rem 1rem 2rem; }
  h1 { font-size: 1.55rem; }
  .grade-2, .form-grade, .ficha { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 1rem; }
  .kpi .valor { font-size: 2rem; }
  .topo .acoes, .topo .acoes .btn { width: 100%; }
  .kpi { border-left: 0; border-top: 1px solid var(--linha); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--linha); }
  .modal { padding: 0; align-items: end; }
  .modal-caixa { border-radius: 20px 20px 0 0; max-height: 94vh; }
}

/* ------------------------------------------------ Impressão */
@media print {
  body { background: #fff; font-size: 10.5pt; }
  .menu, .topo, .nao-imprimir, .aviso { display: none !important; }
  .app { display: block; }
  .conteudo { padding: 0; max-width: none; }
  .cartao, .kpis { border: 1px solid #ccc; break-inside: avoid; }
  .cabecalho-impressao { display: block; margin-bottom: 1rem; }
  .tag, .avatar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
