/* ===== Gestão de Associação ===== */
:root {
    /* Cores da marca (alteráveis em Configurações) */
    --cor1: #1c4e80;   /* azul: barra lateral, títulos */
    --cor2: #3a8d3f;   /* verde: botões, ligações, destaques */
    --cor1-escura: color-mix(in srgb, var(--cor1) 78%, black);
    --verde: var(--cor2);
    --verde-escuro: color-mix(in srgb, var(--cor2) 78%, black);
    --verde-claro: color-mix(in srgb, var(--cor2) 12%, white);
    --fundo: #f4f6f5;
    --texto: #1d2624;
    --cinza: #6b7774;
    --linha: #dde3e1;
    --branco: #fff;
    --vermelho: #b4372f;
    --amarelo: #b7811a;
    --azul: #2a5d8f;
    --raio: 10px;
    --sombra: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
    background: linear-gradient(to right, var(--cor1-escura) 240px, var(--fundo) 240px);
    color: var(--texto);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}
a { color: var(--verde); }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .6rem; }
.muted { color: var(--cinza); }
.small { font-size: .85rem; }
.inline { display: inline; }
.direita { text-align: right; }
.nowrap { white-space: nowrap; }

/* ----- Barra lateral ----- */
.sidebar {
    width: 240px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--cor1) 0%, var(--cor1-escura) 100%); color: #e3ecf5;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.marca { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.marca-logo {
    width: 36px; height: 36px; border-radius: 9px; background: #fff; color: var(--cor1);
    display: grid; place-items: center; font-weight: 800; text-transform: uppercase;
}
.marca-logo-img { max-width: 100%; max-height: 64px; background: #fff; border-radius: 8px; padding: 4px; }
.marca.com-logo { flex-direction: column; align-items: flex-start; gap: .4rem; }
.logo-doc { max-height: 70px; max-width: 220px; display: block; margin: 0 auto .5rem; }
.logo-login { max-height: 80px; max-width: 220px; display: block; margin: 0 auto 1rem; }
.marca-nome { font-weight: 700; color: #fff; font-size: 1.05rem; }
.sidebar nav { padding: .6rem .5rem; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px;
    color: #d9e7e0; text-decoration: none; font-size: .95rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.ativo { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--cor2); }
.nav-contador { margin-left: auto; background: var(--cor2); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: .05rem .5rem; }
.caixa-inscricao { width: min(760px, 94vw); margin: 2rem auto; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.nav-sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: 1rem .7rem .3rem; }
.sidebar-user { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user small { opacity: .7; margin-bottom: .3rem; }
.sidebar-user a { color: #fff; }

/* ----- Área principal ----- */
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topo {
    display: flex; align-items: center; gap: .8rem; padding: .9rem 1.6rem;
    background: var(--branco); border-bottom: 1px solid var(--linha);
}
.topo h1 { margin: 0; font-size: 1.3rem; color: var(--cor1); }
.menu-btn { display: none; font-size: 1.4rem; background: none; border: 0; cursor: pointer; }
.conteudo { padding: 1.5rem 1.6rem; flex: 1; max-width: 1300px; width: 100%; }
.rodape { padding: 1rem 1.6rem; color: var(--cinza); font-size: .8rem; }

/* ----- Cartões ----- */
.card { background: var(--branco); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.card-cab { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.card-cab h2 { margin: 0; }
.grelha { display: grid; gap: 1.2rem; }
.grelha-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grelha-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kpi { background: var(--branco); border: 1px solid var(--linha); border-top: 3px solid var(--cor1); border-radius: var(--raio); padding: 1rem 1.1rem; box-shadow: var(--sombra); }
.kpi .rot { font-size: .82rem; color: var(--cinza); }
.kpi .num { font-size: 1.6rem; font-weight: 700; margin-top: .15rem; }
.kpi .sub { font-size: .8rem; color: var(--cinza); }
.pos { color: var(--verde); }
.neg { color: var(--vermelho); }

/* ----- Botões ----- */
.btn {
    display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--linha); background: var(--branco);
    color: var(--texto); padding: .5rem .9rem; border-radius: 8px; font: inherit; font-size: .92rem;
    cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { border-color: #b9c4c0; }
.btn-primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn-primario:hover { background: var(--verde-escuro); }
.btn-perigo { color: var(--vermelho); border-color: #ecc9c6; }
.btn-perigo:hover { background: #fbeceb; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }
.acoes { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ----- Tabelas ----- */
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .55rem .6rem; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--cinza); font-weight: 600; background: #fafbfb; }
tbody tr:hover { background: #fafcfb; }
td.num, th.num { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 700; background: #fafbfb; }

/* ----- Badges ----- */
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-verde { background: #dff0e6; color: #1e6b41; }
.badge-amarelo { background: #fbf0d6; color: #8a5f0c; }
.badge-vermelho { background: #f9e0de; color: #9b2b24; }
.badge-azul { background: #e0ebf6; color: #234f7b; }
.badge-cinza { background: #eceeed; color: #57615e; }

/* ----- Formulários ----- */
.form-grelha { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1rem; }
.campo { display: flex; flex-direction: column; gap: .25rem; }
.campo.largo { grid-column: 1 / -1; }
label { font-size: .85rem; font-weight: 600; color: #3b4744; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=tel], input[type=file], select, textarea {
    width: 100%; padding: .5rem .6rem; border: 1px solid #cfd8d5; border-radius: 7px; font: inherit; background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
textarea.ata { min-height: 380px; font-family: Georgia, serif; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--cor2) 45%, white); border-color: var(--verde); }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 500; }
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filtros .campo { min-width: 140px; }
.form-acoes { margin-top: 1.1rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.obrig::after { content: " *"; color: var(--vermelho); }

/* ----- Alertas ----- */
.alerta { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alerta-ok { background: #e6f4ec; border-color: #bfe0cc; color: #1e5b39; }
.alerta-erro { background: #fbeceb; border-color: #efc8c5; color: #8d2620; }
.alerta-info { background: #e8f0f8; border-color: #c7d8ea; color: #234f7b; }

/* ----- Ficha / detalhes ----- */
.ficha { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem 1.2rem; }
.ficha div small { display: block; color: var(--cinza); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-simples li { padding: .55rem 0; border-bottom: 1px solid var(--linha); display: flex; justify-content: space-between; gap: 1rem; }
.lista-simples li:last-child { border-bottom: 0; }
.presencas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .3rem 1rem; max-height: 380px; overflow-y: auto; padding: .5rem; border: 1px solid var(--linha); border-radius: 8px; }
.texto-ata { white-space: pre-wrap; font-family: Georgia, serif; line-height: 1.7; }
.qr { display: inline-block; padding: 8px; background: #fff; border: 1px solid var(--linha); border-radius: 8px; }
.vazio { text-align: center; color: var(--cinza); padding: 1.5rem; }
.barra { height: 8px; background: #e6ebe9; border-radius: 99px; overflow: hidden; }
.barra span { display: block; height: 100%; background: var(--verde); }

/* ----- Página de login / pública ----- */
.pagina-simples { align-items: center; justify-content: center; background: linear-gradient(135deg, var(--cor1), var(--cor2)); }
.caixa-login { background: #fff; padding: 2rem; border-radius: 14px; width: min(400px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.caixa-login h1 { margin: 0 0 .3rem; font-size: 1.35rem; }
.caixa-login .campo { margin-bottom: .9rem; }

/* ----- Documentos para imprimir ----- */
.documento { background: #fff; max-width: 800px; margin: 0 auto; padding: 2.5rem 3rem; border: 1px solid var(--linha); font-family: Georgia, serif; line-height: 1.7; }
.documento h1 { text-align: center; font-size: 1.3rem; letter-spacing: .05em; }
.documento .cab-doc { text-align: center; border-bottom: 2px solid var(--texto); padding-bottom: .8rem; margin-bottom: 1.5rem; }
.documento .cab-doc strong { font-size: 1.15rem; }
.assinatura { margin-top: 3rem; text-align: center; }
.assinatura .linha-ass { border-top: 1px solid #000; width: 260px; margin: 2.5rem auto .3rem; }

/* ----- Responsivo ----- */
@media (max-width: 900px) {
    body { background: var(--fundo); }
    .grelha-2, .grelha-3 { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -260px; z-index: 30; transition: left .2s; }
    body.menu-aberto .sidebar { left: 0; }
    body.menu-aberto .fundo-menu { display: block; }
    .fundo-menu { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
    .menu-btn { display: block; }
    .conteudo { padding: 1rem; }
    .documento { padding: 1.5rem; }
}

/* ----- Impressão ----- */
@media print {
    .sidebar, .topo, .rodape, .nao-imprimir, .btn, .filtros, form { display: none !important; }
    body { background: #fff; display: block; }
    .conteudo { padding: 0; max-width: none; }
    .card, .documento { box-shadow: none; border: 0; padding: 0; }
    a { color: inherit; text-decoration: none; }
}
