/* Condomínio ERP — design system.
   Paleta índigo/ardósia: separa visualmente dos irmãos (VendeMais verde, PHARMA360 azul-claro)
   e mantém contraste alto em tabela densa, que é onde o síndico passa o dia. */
:root {
  --primaria: #1e3a8a;
  --primaria-escura: #172554;
  --primaria-clara: #eef2ff;
  --acento: #0891b2;
  --fundo: #f5f7fa;
  --superficie: #ffffff;
  --texto: #0f172a;
  --texto-suave: #64748b;
  --borda: #e2e8f0;
  --borda-forte: #cbd5e1;
  --perigo: #dc2626;
  --sucesso: #16a34a;
  --aviso: #d97706;
  --info: #2563eb;
  --roxo: #7c3aed;
  --sombra: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --sombra-alta: 0 10px 30px rgba(15, 23, 42, .16);
  --raio: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, sans-serif;
  background: var(--fundo); color: var(--texto); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primaria); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 21px; font-weight: 700; letter-spacing: -.2px; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 13.5px; font-weight: 600; }
svg { flex-shrink: 0; }

/* ============================== layout ============================== */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 238px; background: #0f172a; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.sidebar .logo {
  padding: 16px; font-size: 16px; font-weight: 750; color: #fff; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 9px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar .logo .marca { color: #7dd3fc; font-weight: 500; }
.sidebar nav { flex: 1; padding: 6px 0 20px; }
.sidebar .grupo {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.1px; color: #64748b;
  padding: 14px 16px 5px; font-weight: 700;
}
.sidebar a.item {
  display: flex; align-items: center; gap: 10px; padding: 7.5px 16px; color: #cbd5e1; font-size: 13px;
  border-left: 3px solid transparent; text-decoration: none;
}
.sidebar a.item:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar a.item.ativo { background: rgba(125,211,252,.1); color: #7dd3fc; border-left-color: #7dd3fc; font-weight: 600; }
.sidebar .icone { width: 17px; height: 17px; opacity: .85; }
.sidebar .rodape {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px; color: #64748b; line-height: 1.55;
}

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topo {
  background: var(--superficie); border-bottom: 1px solid var(--borda); padding: 9px 20px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40;
}
.topo .titulo { font-weight: 700; font-size: 15px; white-space: nowrap; }
.conteudo { padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }

.busca-global { flex: 1; max-width: 420px; position: relative; }
.busca-global input {
  width: 100%; border: 1px solid var(--borda); border-radius: 8px; padding: 7px 10px 7px 32px;
  font-size: 13px; background: #f8fafc;
}
.busca-global input:focus { outline: none; border-color: var(--primaria); background: #fff; }
.busca-global .lupa { position: absolute; left: 9px; top: 8px; color: var(--texto-suave); }
.busca-resultados {
  position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid var(--borda);
  border-radius: 10px; box-shadow: var(--sombra-alta); max-height: 60vh; overflow-y: auto; z-index: 60;
}
.busca-resultados a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--borda); color: var(--texto); }
.busca-resultados a:hover { background: var(--primaria-clara); text-decoration: none; }
.busca-resultados .tipo { font-size: 10.5px; text-transform: uppercase; color: var(--texto-suave); letter-spacing: .6px; }

.seletor-cond select, .topo select {
  border: 1px solid var(--borda); border-radius: 8px; padding: 6.5px 10px; background: #fff;
  font-size: 13px; color: var(--texto); max-width: 220px;
}
.usuario-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--texto-suave); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primaria); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11.5px; flex-shrink: 0;
}
#btn-menu { display: none; background: none; border: none; cursor: pointer; color: var(--texto); padding: 4px; }

.sino { position: relative; background: none; border: none; cursor: pointer; color: var(--texto-suave); padding: 5px; }
.sino:hover { color: var(--primaria); }
.sino .contador {
  position: absolute; top: 0; right: 0; background: var(--perigo); color: #fff; font-size: 9.5px;
  min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-weight: 700; padding: 0 4px;
}
.painel-notificacoes {
  position: absolute; top: 46px; right: 16px; width: 380px; max-height: 72vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra-alta); z-index: 70;
}
.painel-notificacoes .cabecalho { padding: 11px 14px; border-bottom: 1px solid var(--borda); display: flex; justify-content: space-between; align-items: center; }
.notificacao { padding: 10px 14px; border-bottom: 1px solid var(--borda); display: flex; gap: 10px; }
.notificacao:hover { background: #f8fafc; }
.notificacao .ponto { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--info); }
.notificacao.critico .ponto { background: var(--perigo); }
.notificacao.alerta .ponto { background: var(--aviso); }
.notificacao .t { font-weight: 600; font-size: 13px; }
.notificacao .m { color: var(--texto-suave); font-size: 12px; margin-top: 2px; }
.notificacao .q { color: var(--texto-suave); font-size: 11px; margin-top: 3px; }

/* ============================== componentes ============================== */
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px; }
.card + .card, .grade + .card, .card + .grade, .grade + .grade { margin-top: 14px; }
.card .cabecalho-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cabecalho-pagina { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cabecalho-pagina .sub { color: var(--texto-suave); font-size: 12.5px; margin-top: 3px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.grade { display: grid; gap: 13px; }
.grade.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grade.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grade.c23 { grid-template-columns: 2fr 1fr; }

.indicador { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 14px 15px; box-shadow: var(--sombra); }
.indicador .rotulo { font-size: 11.5px; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.indicador .valor { font-size: 22px; font-weight: 700; margin-top: 5px; letter-spacing: -.5px; }
.indicador .nota { font-size: 11.5px; color: var(--texto-suave); margin-top: 3px; }
.indicador.verde .valor { color: var(--sucesso); }
.indicador.vermelho .valor { color: var(--perigo); }
.indicador.azul .valor { color: var(--primaria); }
.indicador.laranja .valor { color: var(--aviso); }
.indicador.clicavel { cursor: pointer; }
.indicador.clicavel:hover { border-color: var(--primaria); }

button, .botao {
  border: 1px solid var(--borda-forte); background: #fff; color: var(--texto); border-radius: 8px;
  padding: 7px 13px; font-size: 13px; cursor: pointer; font-family: inherit; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
button:hover, .botao:hover { background: #f1f5f9; text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.btn-primario:hover { background: var(--primaria-escura); border-color: var(--primaria-escura); }
.btn-perigo { background: var(--perigo); border-color: var(--perigo); color: #fff; }
.btn-perigo:hover { background: #b91c1c; }
.btn-sucesso { background: var(--sucesso); border-color: var(--sucesso); color: #fff; }
.btn-sucesso:hover { background: #15803d; }
.btn-mini { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-texto { border: none; background: none; color: var(--primaria); padding: 4px 6px; }
.btn-texto:hover { background: var(--primaria-clara); }

input, select, textarea {
  border: 1px solid var(--borda-forte); border-radius: 8px; padding: 7px 10px; font-size: 13px;
  font-family: inherit; color: var(--texto); background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaria); box-shadow: 0 0 0 3px rgba(30,58,138,.09); }
input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--texto-suave); margin-bottom: 4px; }
.campo { margin-bottom: 12px; }
.campo .ajuda { font-size: 11.5px; color: var(--texto-suave); margin-top: 3px; }
.linha-campos { display: grid; gap: 12px; }
.linha-campos.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.linha-campos.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.linha-campos.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.filtros { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 13px; }
.filtros .campo { margin-bottom: 0; min-width: 140px; }
.filtros input, .filtros select { min-width: 130px; }

/* ================================ tabela ================================ */
.tabela-scroll { overflow-x: auto; border-radius: 8px; border: 1px solid var(--borda); }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.tabela th {
  text-align: left; padding: 9px 11px; background: #f8fafc; border-bottom: 1px solid var(--borda);
  font-weight: 650; color: var(--texto-suave); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  white-space: nowrap; position: sticky; top: 0;
}
.tabela td { padding: 8.5px 11px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tabela tbody tr:last-child td { border-bottom: none; }
.tabela tbody tr:hover { background: #f8fafc; }
.tabela tr.clicavel { cursor: pointer; }
.tabela .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela .destaque { font-weight: 650; }
.tabela tfoot td { background: #f8fafc; font-weight: 700; border-top: 2px solid var(--borda); }

.selo {
  display: inline-block; padding: 2.5px 8px; border-radius: 20px; font-size: 11px; font-weight: 650;
  white-space: nowrap; line-height: 1.5;
}
.selo.verde { background: #dcfce7; color: #15803d; }
.selo.vermelho { background: #fee2e2; color: #b91c1c; }
.selo.amarelo { background: #fef3c7; color: #b45309; }
.selo.azul { background: #dbeafe; color: #1d4ed8; }
.selo.cinza { background: #f1f5f9; color: #475569; }
.selo.roxo { background: #ede9fe; color: #6d28d9; }
.selo.ciano { background: #cffafe; color: #0e7490; }

.vazio { text-align: center; padding: 44px 20px; color: var(--texto-suave); }
.vazio h3 { font-size: 15px; margin-bottom: 5px; color: var(--texto); }
.vazio p { font-size: 13px; }
.vazio .icone-grande { margin-bottom: 12px; color: var(--borda-forte); display: flex; justify-content: center; }

.paginacao { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 12.5px; color: var(--texto-suave); }

/* ================================ modal ================================ */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 20px; overflow-y: auto;
}
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; box-shadow: var(--sombra-alta); max-height: 92vh; display: flex; flex-direction: column; }
.modal.larga { max-width: 860px; }
.modal.cheia { max-width: 1200px; }
.modal-cabecalho { padding: 15px 18px; border-bottom: 1px solid var(--borda); display: flex; align-items: center; justify-content: space-between; }
.modal-corpo { padding: 18px; overflow-y: auto; flex: 1; }
.modal-rodape { padding: 13px 18px; border-top: 1px solid var(--borda); display: flex; justify-content: flex-end; gap: 8px; background: #f8fafc; border-radius: 0 0 12px 12px; }
.fechar-x { border: none; background: none; font-size: 21px; line-height: 1; cursor: pointer; color: var(--texto-suave); padding: 0 4px; }

#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 11px 15px; border-radius: 9px; font-size: 13px;
  box-shadow: var(--sombra-alta); max-width: 380px; animation: entra .18s ease;
}
.toast.erro { background: var(--perigo); }
.toast.sucesso { background: var(--sucesso); }
.toast.aviso { background: var(--aviso); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

/* ================================ abas ================================ */
.abas { display: flex; gap: 2px; border-bottom: 1px solid var(--borda); margin-bottom: 16px; overflow-x: auto; }
.abas button {
  border: none; background: none; padding: 9px 14px; font-size: 13px; color: var(--texto-suave);
  border-bottom: 2px solid transparent; border-radius: 0; font-weight: 550; white-space: nowrap;
}
.abas button:hover { background: #f1f5f9; color: var(--texto); }
.abas button.ativa { color: var(--primaria); border-bottom-color: var(--primaria); font-weight: 650; }

/* ================================ gráficos ================================ */
.grafico-barras { display: flex; align-items: flex-end; gap: 5px; height: 170px; padding-top: 10px; }
.grafico-barras .coluna { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; height: 100%; min-width: 0; }
.grafico-barras .par { display: flex; gap: 2px; align-items: flex-end; width: 100%; height: 100%; justify-content: center; }
/* span ignora width/height sem display:block — sem isto a barra não aparece */
.grafico-barras .barra { display: block; width: 46%; border-radius: 3px 3px 0 0; min-height: 2px; background: var(--primaria); }
.grafico-barras .barra.saida { background: #f87171; }
.grafico-barras .rotulo { font-size: 10px; color: var(--texto-suave); white-space: nowrap; }
.legenda { display: flex; gap: 14px; font-size: 12px; color: var(--texto-suave); margin-top: 10px; flex-wrap: wrap; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.barra-progresso { background: #f1f5f9; border-radius: 4px; height: 7px; overflow: hidden; }
.barra-progresso > span { display: block; height: 100%; background: var(--primaria); border-radius: 4px; }
.barra-progresso > span.perigo { background: var(--perigo); }
.barra-progresso > span.aviso { background: var(--aviso); }
.barra-progresso > span.sucesso { background: var(--sucesso); }

.lista-linha { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.lista-linha:last-child { border-bottom: none; }
.lista-linha .esq { min-width: 0; }
.lista-linha .nome { font-weight: 550; font-size: 13px; }
.lista-linha .desc { font-size: 11.5px; color: var(--texto-suave); }

.aviso-caixa { border-left: 3px solid var(--aviso); background: #fffbeb; padding: 10px 13px; border-radius: 0 8px 8px 0; font-size: 13px; margin-bottom: 13px; }
.aviso-caixa.erro { border-color: var(--perigo); background: #fef2f2; }
.aviso-caixa.info { border-color: var(--info); background: #eff6ff; }
.aviso-caixa.sucesso { border-color: var(--sucesso); background: #f0fdf4; }

.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }
.num-tab { font-variant-numeric: tabular-nums; }
.texto-suave { color: var(--texto-suave); }
.texto-perigo { color: var(--perigo); }
.texto-sucesso { color: var(--sucesso); }
.texto-aviso { color: var(--aviso); }
.pequeno { font-size: 12px; }
.direita { text-align: right; }
.centro { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.nowrap { white-space: nowrap; }

/* ================================ login ================================ */
.tela-login {
  min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); padding: 20px;
}
.caixa-login { background: #fff; border-radius: 16px; padding: 34px; width: 100%; max-width: 400px; box-shadow: 0 24px 60px rgba(0,0,0,.32); }
.caixa-login .marca { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 750; margin-bottom: 4px; }
.caixa-login .sub { color: var(--texto-suave); font-size: 13px; margin-bottom: 22px; }
.caixa-login button { width: 100%; justify-content: center; padding: 10px; font-size: 14px; margin-top: 6px; }
.caixa-login .demo { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--borda); font-size: 12px; color: var(--texto-suave); line-height: 1.7; }

/* ================================ responsivo ================================ */
@media (max-width: 1100px) {
  .grade.c5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grade.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade.c23 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.aberta { transform: translateX(0); box-shadow: var(--sombra-alta); }
  #btn-menu { display: block; }
  .conteudo { padding: 14px; }
  .grade.c2, .grade.c3, .grade.c4, .grade.c5 { grid-template-columns: 1fr; }
  .linha-campos.c2, .linha-campos.c3, .linha-campos.c4 { grid-template-columns: 1fr; }
  .busca-global { display: none; }
  .usuario-chip div:not(.avatar) { display: none; }
  .painel-notificacoes { right: 8px; left: 8px; width: auto; }
  .topo { padding: 8px 12px; gap: 8px; }
  .topo .titulo { font-size: 14px; }
}
@media print {
  .sidebar, .topo, .acoes, .filtros, .paginacao { display: none !important; }
  .conteudo { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; }
}
