/* ===== Admin Panel — Igreja Cristã Internacional do Evangelho ===== */
:root {
    --cor-primaria:   #2c3e7a;
    --cor-secundaria: #e8a020;
    --sidebar-bg:     #111d4a;
    --sidebar-hover:  rgba(255,255,255,.07);
    --sidebar-active: rgba(232,160,32,.18);
    --topbar-h:       64px;
    --sidebar-w:      260px;
    --cor-fundo:      #f0f2f8;
    --cor-card:       #fff;
    --cor-texto:      #1e2a50;
    --cor-sub:        #64748b;
    --raio:           10px;
    --sombra:         0 2px 12px rgba(44,62,122,.10);
    --transicao:      .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--cor-fundo);
    color: var(--cor-texto);
    line-height: 1.5;
    min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
    transition: transform var(--transicao);
}

.sidebar-logo {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo img {
    width: 38px; height: 38px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255,255,255,.06);
    padding: 3px;
    flex-shrink: 0;
}

.sidebar-logo .nome-igreja {
    font-size: .82rem;
    font-weight: 700;
    color: rgba(255,255,255,.92);
    line-height: 1.25;
    font-family: Georgia, serif;
}

/* User info */
.sidebar-user {
    padding: 1.1rem 1.5rem;
    background: rgba(255,255,255,.04);
    border-bottom: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    gap: .85rem;
}

.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--cor-secundaria);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.user-info .user-name {
    font-size: .88rem;
    font-weight: 600;
    color: rgba(255,255,255,.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.user-info .user-role {
    font-size: .75rem;
    color: var(--cor-secundaria);
    opacity: .9;
    white-space: nowrap;
}

.user-info .user-unit {
    font-size: .72rem;
    color: rgba(255,255,255,.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* Nav */
.sidebar-nav { padding: .75rem 0; flex: 1; }

.nav-section {
    padding: .5rem 1.2rem .25rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.28);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.5rem;
    color: rgba(255,255,255,.65);
    font-size: .88rem;
    transition: background var(--transicao), color var(--transicao);
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,.95);
}

.nav-item.ativo {
    background: var(--sidebar-active);
    color: var(--cor-secundaria);
    font-weight: 600;
}

.nav-item.ativo::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--cor-secundaria);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    opacity: .8;
}

.nav-item.ativo .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.07);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .55rem .75rem;
    border-radius: var(--raio);
    background: rgba(239,68,68,.1);
    color: rgba(255,120,120,.85);
    font-size: .87rem;
    border: 1px solid rgba(239,68,68,.2);
    cursor: pointer;
    transition: var(--transicao);
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(239,68,68,.2);
    color: #f87171;
}

/* ===== Main layout ===== */
.painel-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--cor-card);
    box-shadow: var(--sombra);
    height: var(--topbar-h);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }

.menu-toggle-painel {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--cor-texto);
    padding: .25rem;
}

.topbar-titulo {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cor-texto);
}

.breadcrumb {
    font-size: .82rem;
    color: var(--cor-sub);
    display: flex;
    align-items: center;
    gap: .4rem;
}

.breadcrumb a { color: var(--cor-primaria); }
.breadcrumb a:hover { text-decoration: underline; }

.topbar-right { display: flex; align-items: center; gap: .75rem; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .87rem;
    color: var(--cor-sub);
}

/* Content */
.content-area {
    flex: 1;
    padding: 2rem;
    width: 100%;
}

/* ===== Cards ===== */
.card {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #eef0f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--cor-texto);
}

.card-body { padding: 1.5rem; }

/* ===== Stats grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--cor-card);
    border-radius: var(--raio);
    padding: 1.4rem 1.5rem;
    box-shadow: var(--sombra);
    display: flex;
    align-items: flex-start;
    gap: 1.1rem;
    transition: box-shadow var(--transicao), transform var(--transicao);
    border-left: 4px solid transparent;
}

.stat-card:hover {
    box-shadow: 0 6px 20px rgba(44,62,122,.13);
    transform: translateY(-2px);
}

a.stat-card-link, div.stat-card-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
}
a.stat-card-link:hover { color: inherit; }

.stat-card.azul { border-left-color: var(--cor-primaria); }
.stat-card.ouro  { border-left-color: var(--cor-secundaria); }
.stat-card.verde { border-left-color: #22c55e; }
.stat-card.roxo  { border-left-color: #8b5cf6; }

.stat-icone {
    width: 46px; height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-card.azul .stat-icone  { background: rgba(44,62,122,.08); }
.stat-card.ouro .stat-icone  { background: rgba(232,160,32,.1); }
.stat-card.verde .stat-icone { background: rgba(34,197,94,.1); }
.stat-card.roxo .stat-icone  { background: rgba(139,92,246,.1); }

.stat-info { flex: 1; min-width: 0; }

.stat-valor {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--cor-texto);
    line-height: 1;
    margin-bottom: .2rem;
}

.stat-label {
    font-size: .8rem;
    color: var(--cor-sub);
    font-weight: 500;
}

.stat-escopo {
    font-size: .72rem;
    color: rgba(100,116,139,.6);
    margin-top: .15rem;
}

/* ===== Welcome banner ===== */
.boas-vindas {
    background: linear-gradient(135deg, var(--cor-primaria) 0%, #1a2560 100%);
    border-radius: var(--raio);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.boas-vindas::after {
    content: '✝';
    position: absolute;
    right: 1.5rem; bottom: -1rem;
    font-size: 5rem;
    opacity: .05;
    font-family: serif;
    line-height: 1;
}

.boas-vindas h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.boas-vindas p { font-size: .88rem; opacity: .75; }

.boas-vindas-badge {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50px;
    padding: .4rem 1rem;
    font-size: .82rem;
    color: rgba(255,255,255,.9);
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

/* ===== Grid de conteúdo ===== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== Ações rápidas ===== */
.acoes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.acao-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    padding: 1.25rem 1rem;
    background: var(--cor-card);
    border: 1.5px solid #eef0f8;
    border-radius: var(--raio);
    color: var(--cor-texto);
    cursor: pointer;
    transition: var(--transicao);
    box-shadow: var(--sombra);
    font-family: inherit;
    font-size: .85rem;
    font-weight: 500;
    text-align: center;
}

.acao-btn:hover {
    border-color: var(--cor-primaria);
    color: var(--cor-primaria);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(44,62,122,.14);
}

.acao-icon { font-size: 1.6rem; }

/* ===== Placeholder lista ===== */
.lista-placeholder {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.placeholder-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem;
    border-radius: 8px;
    background: var(--cor-fundo);
}

.placeholder-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #dde2f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: var(--cor-sub);
    flex-shrink: 0;
    font-weight: 700;
}

.placeholder-nome { font-size: .88rem; font-weight: 500; }
.placeholder-detalhe { font-size: .78rem; color: var(--cor-sub); }

.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
}

.badge-pastor    { background: rgba(44,62,122,.1);  color: var(--cor-primaria); }
.badge-obreiro   { background: rgba(34,197,94,.1);  color: #166534; }
.badge-membro    { background: rgba(139,92,246,.1); color: #5b21b6; }

.ver-tudo-link {
    display: block;
    text-align: center;
    padding: .65rem;
    font-size: .82rem;
    color: var(--cor-primaria);
    border-top: 1px solid #eef0f8;
    margin-top: .5rem;
    transition: var(--transicao);
}

.ver-tudo-link:hover { background: var(--cor-fundo); }

/* ===== Notificações ===== */
.nav-badge {
    margin-left: auto;
    background: var(--cor-secundaria);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: .15rem .45rem;
    border-radius: 50px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

.topbar-notif {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--cor-fundo);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--cor-sub);
    transition: var(--transicao);
    flex-shrink: 0;
}

.topbar-notif:hover {
    background: #dde2f0;
    color: var(--cor-primaria);
}

.notif-badge {
    position: absolute;
    top: -2px; right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #fff;
    line-height: 1;
}

/* ===== Login page ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #0e1540 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2.25rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo img {
    width: 70px; height: 70px;
    object-fit: contain;
    margin: 0 auto .75rem;
}

.login-logo h1 {
    font-family: Georgia, serif;
    font-size: 1rem;
    color: var(--cor-primaria);
    line-height: 1.3;
    font-weight: 700;
}

.login-logo p {
    font-size: .8rem;
    color: var(--cor-sub);
    margin-top: .2rem;
}

.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--cor-texto);
    margin-bottom: .4rem;
}

.form-group input {
    width: 100%;
    padding: .75rem 1rem;
    border: 1.5px solid #dde2f0;
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    color: var(--cor-texto);
    outline: none;
    transition: border-color var(--transicao);
    background: #fff;
}

.form-group input:focus { border-color: var(--cor-primaria); }

.btn-entrar {
    width: 100%;
    padding: .85rem;
    background: var(--cor-primaria);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transicao);
    margin-top: .5rem;
}

.btn-entrar:hover { background: #22306b; transform: translateY(-1px); }
.btn-entrar:active { transform: none; }

.login-erro {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 8px;
    padding: .7rem 1rem;
    font-size: .85rem;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .78rem;
    color: #94a3b8;
}

/* ===== Alertas / Flash ===== */
.alerta {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .85rem 1.1rem;
    border-radius: 8px;
    font-size: .88rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.alerta-sucesso {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.alerta-erro {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.alerta-aviso {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.alerta-info {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

/* ===== Página header (CRUD) ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header-left { display: flex; align-items: center; gap: 1rem; }

.btn-voltar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .9rem;
    border-radius: 8px;
    background: var(--cor-card);
    border: 1.5px solid #dde2f0;
    color: var(--cor-sub);
    font-size: .85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transicao);
    white-space: nowrap;
}

.btn-voltar:hover {
    border-color: var(--cor-primaria);
    color: var(--cor-primaria);
}

.btn-acao {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .6rem 1.1rem;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transicao);
    border: 1.5px solid transparent;
    white-space: nowrap;
}

.btn-acao.primario {
    background: var(--cor-primaria);
    color: #fff;
    border-color: var(--cor-primaria);
}

.btn-acao.primario:hover { background: #22306b; }

.btn-acao.secundario {
    background: var(--cor-card);
    color: var(--cor-texto);
    border-color: #dde2f0;
}

.btn-acao.secundario:hover {
    border-color: var(--cor-primaria);
    color: var(--cor-primaria);
}

.btn-acao.perigo {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.btn-acao.perigo:hover { background: #fee2e2; }

.btn-acao.pequeno {
    padding: .35rem .7rem;
    font-size: .8rem;
    border-radius: 6px;
}

/* ===== Formulário CRUD ===== */
.form-secao {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.form-secao-titulo {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eef0f8;
    font-size: .8rem;
    font-weight: 700;
    color: var(--cor-primaria);
    text-transform: uppercase;
    letter-spacing: .07em;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.form-secao-corpo {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
}

.form-secao-corpo .span-2 { grid-column: 1 / -1; }

.campo {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.campo label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--cor-texto);
}

.campo label .obrigatorio {
    color: #ef4444;
    margin-left: 2px;
}

.campo input,
.campo select,
.campo textarea {
    padding: .65rem .9rem;
    border: 1.5px solid #dde2f0;
    border-radius: 8px;
    font-size: .93rem;
    font-family: inherit;
    color: var(--cor-texto);
    background: #fff;
    outline: none;
    transition: border-color var(--transicao), box-shadow var(--transicao);
    width: 100%;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(44,62,122,.08);
}

.campo input.invalido,
.campo select.invalido,
.campo textarea.invalido {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,.08);
}

.campo textarea { resize: vertical; min-height: 80px; }

.campo .hint {
    font-size: .76rem;
    color: var(--cor-sub);
}

.campo .erro-campo {
    font-size: .78rem;
    color: #b91c1c;
}

.campo-aux {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.campo-aux input { flex: 1; }

.idade-display {
    font-size: .88rem;
    color: var(--cor-sub);
    white-space: nowrap;
    padding: .65rem .75rem;
    background: var(--cor-fundo);
    border-radius: 8px;
    border: 1.5px solid #dde2f0;
    min-width: 80px;
    text-align: center;
}

.genero-grupo {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .5rem 0 .2rem;
}

.genero-opcao {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    cursor: pointer;
}

.genero-opcao input[type="radio"] {
    width: 16px; height: 16px;
    accent-color: var(--cor-primaria);
    flex-shrink: 0;
}

.form-acoes {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    margin-bottom: 1.5rem;
}

/* ===== Tabela CRUD ===== */
.filtros-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filtros-bar .campo-busca {
    flex: 1;
    min-width: 220px;
    max-width: 380px;
    position: relative;
}

.filtros-bar .campo-busca input {
    width: 100%;
    padding: .6rem .9rem .6rem 2.2rem;
    border: 1.5px solid #dde2f0;
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    background: var(--cor-card);
    outline: none;
    transition: border-color var(--transicao);
    color: var(--cor-texto);
}

.filtros-bar .campo-busca input:focus { border-color: var(--cor-primaria); }

.filtros-bar .campo-busca .icone-busca {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cor-sub);
    font-size: .9rem;
    pointer-events: none;
}

.tabela-wrap {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    overflow: hidden;
}

.tabela-crud {
    width: 100%;
    border-collapse: collapse;
}

.tabela-crud th,
.tabela-crud td {
    padding: .8rem 1.1rem;
    text-align: left;
    vertical-align: middle;
}

.tabela-crud thead th {
    background: #f8f9ff;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--cor-sub);
    font-weight: 700;
    border-bottom: 1px solid #eef0f8;
    white-space: nowrap;
}

.tabela-crud tbody tr { border-bottom: 1px solid #eef0f8; }
.tabela-crud tbody tr:last-child { border-bottom: none; }

.tabela-crud tbody tr:hover td { background: #f8f9ff; }

.tabela-cell-pessoa {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.tabela-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--cor-primaria);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.tabela-avatar.fem   { background: #db2777; }
.tabela-avatar.outro { background: #7c3aed; }

.tabela-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.tabela-nome   { font-size: .88rem; font-weight: 600; }
.tabela-detalhe{ font-size: .76rem; color: var(--cor-sub); }

.tabela-acoes {
    display: flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
}

.tabela-vazio {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--cor-sub);
    font-size: .9rem;
}

.tabela-vazio .vazio-icone {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    opacity: .4;
}

/* Paginação */
.paginacao {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-top: 1px solid #eef0f8;
    flex-wrap: wrap;
}

.paginacao-info {
    font-size: .8rem;
    color: var(--cor-sub);
}

.paginacao-btns {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.paginacao-btn {
    width: 32px; height: 32px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .83rem;
    font-weight: 500;
    transition: var(--transicao);
    background: var(--cor-card);
    color: var(--cor-texto);
    border: 1.5px solid #dde2f0;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}

.paginacao-btn:hover {
    background: var(--cor-primaria);
    color: #fff;
    border-color: var(--cor-primaria);
}

.paginacao-btn.atual {
    background: var(--cor-primaria);
    color: #fff;
    border-color: var(--cor-primaria);
}

.paginacao-btn:disabled,
.paginacao-btn.desabilitado {
    opacity: .4;
    cursor: default;
    pointer-events: none;
}

/* Badge de tipo */
.badge-funcao {
    background: rgba(44,62,122,.08);
    color: var(--cor-primaria);
    padding: .2rem .6rem;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Cores por cargo — badges (obreiros, dashboard) */
.bc-adm  { background: #ede9fe; color: #5b21b6; }
.bc-pp   { background: #dbeafe; color: #1e3a8a; }
.bc-pr   { background: #e0f2fe; color: #0c4a6e; }
.bc-pl   { background: #cffafe; color: #164e63; }
.bc-cp   { background: #ccfbf1; color: #134e4a; }
.bc-sg   { background: #d1fae5; color: #064e3b; }
.bc-fg   { background: #dcfce7; color: #14532d; }
.bc-sl   { background: #fef9c3; color: #713f12; }
.bc-fl   { background: #fef3c7; color: #78350f; }
.bc-ldg  { background: #ffedd5; color: #7c2d12; }
.bc-ldl  { background: #fee2e2; color: #7f1d1d; }
.bc-og   { background: #f3f4f6; color: #374151; }

/* Bordas dos cards de obreiros por cargo (precisa de .card-obreiro para superar especificidade) */
.membro-card.card-obreiro.bc-adm  { border-color: #7c3aed; }
.membro-card.card-obreiro.bc-pp   { border-color: #1e40af; }
.membro-card.card-obreiro.bc-pr   { border-color: #0369a1; }
.membro-card.card-obreiro.bc-pl   { border-color: #0e7490; }
.membro-card.card-obreiro.bc-cp   { border-color: #0f766e; }
.membro-card.card-obreiro.bc-sg   { border-color: #047857; }
.membro-card.card-obreiro.bc-fg   { border-color: #15803d; }
.membro-card.card-obreiro.bc-sl   { border-color: #a16207; }
.membro-card.card-obreiro.bc-fl   { border-color: #b45309; }
.membro-card.card-obreiro.bc-ldg  { border-color: #c2410c; }
.membro-card.card-obreiro.bc-ldl  { border-color: #b91c1c; }
.membro-card.card-obreiro.bc-og   { border-color: #6b7280; }

/* Filtros de cargo (membros) */
.filtro-tipo-btn {
    padding: .3rem .75rem;
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 600;
    border: 1.5px solid var(--cor-borda);
    background: var(--cor-card);
    color: var(--cor-sub);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transicao);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.filtro-tipo-btn:hover,
.filtro-tipo-btn.ativo {
    background: var(--cor-primaria);
    color: #fff;
    border-color: var(--cor-primaria);
}

.badge-ativo   { background: rgba(34,197,94,.1);  color: #166534; }
.badge-inativo { background: rgba(239,68,68,.1);  color: #b91c1c; }

/* Avatar no dashboard com foto */
.placeholder-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

/* ===== Modal de confirmação ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.aberto { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 14px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,.25);
    text-align: center;
}

.modal-icone { font-size: 2.5rem; margin-bottom: .75rem; }
.modal-titulo { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; }
.modal-texto  { font-size: .88rem; color: var(--cor-sub); margin-bottom: 1.5rem; }

.modal-acoes {
    display: flex;
    gap: .75rem;
    justify-content: center;
}

/* ===== Overlay mobile ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 190;
}
.sidebar-overlay.ativo { display: block; }

/* ===== Responsivo ===== */
/* ===== Cards de membros ===== */
.membros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
}

.membro-card {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    padding: 1.4rem 1.1rem 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: box-shadow var(--transicao), transform var(--transicao);
}

.membro-card:hover {
    box-shadow: 0 6px 22px rgba(44,62,122,.15);
    transform: translateY(-2px);
}

.membro-card-avatar {
    width: 58px; height: 58px;
    border-radius: 50%;
    background: var(--cor-primaria);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
    flex-shrink: 0;
    overflow: hidden;
}

.membro-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.membro-card-avatar.fem   { background: #db2777; }
.membro-card-avatar.outro { background: #7c3aed; }

.membro-card.card-obreiro {
    border: 1.5px solid var(--cor-secundaria);
}

.membro-card-tipo-badge {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--cor-secundaria);
    margin-bottom: .3rem;
}

.membro-card-nome {
    font-size: .9rem;
    font-weight: 700;
    color: var(--cor-texto);
    margin-bottom: .2rem;
    word-break: break-word;
}

.membro-card-detalhe {
    font-size: .76rem;
    color: var(--cor-sub);
    line-height: 1.6;
    margin-bottom: .85rem;
    flex: 1;
}

.membro-card-acoes {
    display: flex;
    gap: .45rem;
    width: 100%;
    justify-content: center;
}

/* ===== Financeiro ===== */
.fin-resumo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fin-resumo-card {
    background: var(--cor-card);
    border-radius: var(--raio);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--sombra);
    border-left: 4px solid transparent;
}

.fin-resumo-card.entrada { border-left-color: #22c55e; }
.fin-resumo-card.saida   { border-left-color: #ef4444; }
.fin-resumo-card.saldo.positivo { border-left-color: var(--cor-primaria); }
.fin-resumo-card.saldo.negativo { border-left-color: #ef4444; }

.fin-resumo-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--cor-sub);
    font-weight: 700;
    margin-bottom: .3rem;
}

.fin-resumo-valor {
    font-size: 1.4rem;
    font-weight: 800;
}

.fin-resumo-card.entrada .fin-resumo-valor { color: #16a34a; }
.fin-resumo-card.saida   .fin-resumo-valor { color: #dc2626; }

.mov-tipo-entrada { color: #16a34a; font-weight: 700; }
.mov-tipo-saida   { color: #dc2626; font-weight: 700; }

.badge-errata {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
    padding: .15rem .5rem;
    border-radius: 4px;
    font-size: .7rem;
    font-weight: 700;
}

/* Linha da errata (substituto) — aparência normal, só com badge */
.linha-errata td { }

/* Linha original anulada por uma errata — riscada e desbotada */
.linha-anulada td { opacity: .45; }
.linha-anulada .tabela-nome    { text-decoration: line-through; color: var(--cor-sub); }
.linha-anulada .mov-tipo-entrada,
.linha-anulada .mov-tipo-saida { text-decoration: line-through; }
.linha-anulada .fin-valor      { text-decoration: line-through; }

/* ===== Calendário de eventos (admin) ===== */
/* Layout calendário + painel lateral (form/legenda) */
.eventos-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.cal-nav-titulo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cor-texto);
    text-transform: capitalize;
}

.cal-legenda {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .75rem;
}

.cal-legenda-item {
    display: flex;
    align-items: center;
    gap: .3rem;
    color: var(--cor-sub);
}

.cal-legenda-cor {
    width: 10px; height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.calendario-wrap {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.calendario-cabecalho {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9ff;
    border-bottom: 1px solid #eef0f8;
}

.cal-header-dia {
    text-align: center;
    padding: .6rem .25rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--cor-sub);
}

.cal-header-dia.fim-semana { color: #ef4444; }

.calendario-grade {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-dia {
    min-height: 88px;
    border-right: 1px solid #eef0f8;
    border-bottom: 1px solid #eef0f8;
    padding: .3rem .25rem;
    position: relative;
    vertical-align: top;
    cursor: default;
}

.cal-dia:nth-child(7n) { border-right: none; }

.cal-dia.outro-mes { background: #fafbff; }
.cal-dia.hoje      { background: #eff6ff; }

.cal-dia-num {
    font-size: .78rem;
    font-weight: 600;
    color: var(--cor-sub);
    margin-bottom: .2rem;
    width: 22px; height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-dia.hoje .cal-dia-num {
    background: var(--cor-primaria);
    color: #fff;
    font-weight: 700;
}

.cal-dia.outro-mes .cal-dia-num { opacity: .4; }

.cal-add-btn {
    display: none;
    position: absolute;
    top: .3rem; right: .25rem;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--cor-primaria);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    line-height: 1;
    transition: opacity var(--transicao);
    font-family: inherit;
}

.cal-dia:hover .cal-add-btn { display: flex; }

.cal-evento-chip {
    display: block;
    font-size: .68rem;
    padding: .12rem .35rem;
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
    color: #fff;
    line-height: 1.5;
}

.cal-evento-chip:hover { opacity: .8; }

.cal-evento-chip.tipo-culto       { background: var(--cor-primaria); }
.cal-evento-chip.tipo-reuniao     { background: #7c3aed; }
.cal-evento-chip.tipo-evento      { background: #d97706; }
.cal-evento-chip.tipo-treinamento { background: #0891b2; }
.cal-evento-chip.tipo-outro       { background: #64748b; }
.cal-evento-chip.recorrente       { opacity: .82; }

/* Painel lateral de evento (form) */
.evento-form-painel {
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    padding: 1.5rem;
}

/* ===== Responsivo ===== */
@media (max-width: 900px) {
    .form-secao-corpo { grid-template-columns: 1fr; }
    .form-secao-corpo .span-2 { grid-column: 1; }
    .fin-resumo { grid-template-columns: 1fr; }
    .membros-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.aberta {
        transform: translateX(0);
    }

    .painel-main { margin-left: 0; }

    .menu-toggle-painel { display: block; }

    .content-grid { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Calendário ocupa a largura toda; painel lateral desce para baixo */
    .eventos-layout { grid-template-columns: 1fr; }

    .topbar { padding: 0 1rem; }

    .content-area { padding: 1.25rem 1rem; }

    /* Tabelas largas rolam horizontalmente no mobile em vez de serem cortadas */
    .tabela-wrap { overflow-x: auto; }
}

@media (max-width: 480px) {
    /* Cards em coluna única — evita que rótulos como "Obreiros & Pastores" quebrem em 3 linhas */
    .stats-grid { grid-template-columns: 1fr; }
    .boas-vindas { padding: 1.25rem; }
    .login-card { padding: 2rem 1.5rem 1.5rem; }
}

/* ===== Tooltip aniversariantes ===== */
.stat-card { position: relative; }

.aniv-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff6ec;
    color: #3d2a10;
    border-radius: 10px;
    padding: .65rem .85rem;
    min-width: 210px;
    max-width: 300px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 28px rgba(180,100,20,.18), 0 1px 4px rgba(180,100,20,.10);
    border: 1px solid rgba(232,160,32,.30);
    z-index: 300;
    font-size: .8rem;
    line-height: 1.4;
    pointer-events: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(232,160,32,.35) transparent;
}

.aniv-tooltip::-webkit-scrollbar { width: 4px; }
.aniv-tooltip::-webkit-scrollbar-track { background: transparent; }
.aniv-tooltip::-webkit-scrollbar-thumb {
    background: rgba(232,160,32,.35);
    border-radius: 4px;
}

.aniv-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fff6ec;
}

.stat-card:hover .aniv-tooltip { display: block; }

.aniv-tooltip-titulo {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--cor-secundaria);
    margin-bottom: .5rem;
}

.aniv-tooltip-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .22rem 0;
    border-bottom: 1px solid rgba(232,160,32,.15);
}

.aniv-tooltip-row:last-child { border-bottom: none; }

.aniv-dia {
    background: var(--cor-secundaria);
    color: #fff;
    min-width: 26px;
    height: 20px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: .74rem;
    padding: 0 4px;
}

/* ===== Tooltip variante verde (unidades) ===== */
.aniv-tooltip-verde {
    background: #f0fdf4;
    color: #14532d;
    border-color: rgba(34,197,94,.28);
    box-shadow: 0 8px 28px rgba(20,120,60,.13), 0 1px 4px rgba(20,120,60,.08);
    scrollbar-color: rgba(34,197,94,.35) transparent;
}

.aniv-tooltip-verde::-webkit-scrollbar-thumb { background: rgba(34,197,94,.35); }

.aniv-tooltip-verde::after { border-top-color: #f0fdf4; }

.aniv-tooltip-verde .aniv-tooltip-titulo { color: #16a34a; }

.aniv-tooltip-verde .aniv-tooltip-row { border-bottom-color: rgba(34,197,94,.15); }

.aniv-dia-verde {
    background: #22c55e;
    font-size: .62rem;
    letter-spacing: -.01em;
    min-width: 30px;
    padding: 0 5px;
}

/* Tag verde da cidade (modal de Unidades) */
.tag-cidade {
    background: #22c55e;
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== Foto 3x4 no formulário ===== */
.foto-preview-wrap {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.foto-preview-img {
    width: 75px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #dde2f0;
    display: block;
    flex-shrink: 0;
}

.foto-preview-placeholder {
    width: 75px;
    height: 100px;
    border-radius: 6px;
    border: 2px dashed #dde2f0;
    background: var(--cor-fundo);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #c5cae0;
    flex-shrink: 0;
}

input[type="file"].campo-file {
    padding: .5rem .75rem;
    border: 1.5px solid #dde2f0;
    border-radius: 8px;
    font-size: .88rem;
    font-family: inherit;
    color: var(--cor-texto);
    background: #fff;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

/* ===== Mensagens ===== */
.msg-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    background: var(--cor-card);
    border-radius: var(--raio);
    box-shadow: var(--sombra);
    overflow: hidden;
    height: calc(100vh - 9rem);
    min-height: 480px;
}

.msg-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e8f0;
    min-height: 0;
}

.msg-tabs-wrap {
    display: flex;
    border-bottom: 1px solid #e5e8f0;
    background: #f8f9fc;
    flex-shrink: 0;
}

.msg-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .7rem .25rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--cor-sub);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color var(--transicao), border-color var(--transicao);
    white-space: nowrap;
}

.msg-tab.ativo {
    color: var(--cor-primaria);
    border-bottom-color: var(--cor-primaria);
    background: var(--cor-card);
}

.msg-tab:hover:not(.ativo) { color: var(--cor-texto); }

.msg-badge {
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.msg-novo-wrap {
    padding: .75rem;
    border-bottom: 1px solid #e5e8f0;
    flex-shrink: 0;
}

.msg-lista {
    flex: 1;
    overflow-y: auto;
}

.msg-lista-vazia {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--cor-sub);
    font-size: .88rem;
}

.msg-item {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid #f0f2f8;
    text-decoration: none;
    color: inherit;
    transition: background var(--transicao);
    position: relative;
    cursor: pointer;
}

.msg-item:hover { background: #f8f9fc; }
.msg-item.ativo { background: #eff3ff; }

.msg-item.nao-lida .msg-item-nome    { font-weight: 700; color: var(--cor-texto); }
.msg-item.nao-lida .msg-item-assunto { font-weight: 600; color: var(--cor-texto); }

.msg-av {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cor-primaria);
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-item-body { flex: 1; min-width: 0; }

.msg-item-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .25rem;
    margin-bottom: .2rem;
}

.msg-item-nome {
    font-size: .84rem;
    font-weight: 500;
    color: var(--cor-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.msg-item-dt {
    font-size: .72rem;
    color: var(--cor-sub);
    white-space: nowrap;
    opacity: .8;
}

.msg-item-assunto {
    font-size: .82rem;
    color: var(--cor-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-item-tag {
    font-size: .7rem;
    color: var(--cor-primaria);
    font-weight: 600;
    margin-top: .2rem;
}

.msg-dot {
    position: absolute;
    right: .85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cor-primaria);
    flex-shrink: 0;
}

/* Painel principal */
.msg-main {
    display: flex;
    flex-direction: column;
    padding: 1.75rem 2rem;
    min-width: 0;
}

.msg-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--cor-sub);
    text-align: center;
    gap: .6rem;
}

.msg-empty-icon {
    font-size: 2.5rem;
    opacity: .2;
    line-height: 1;
}

.msg-empty p { margin: 0; font-size: .9rem; }

/* Compose */
.msg-compose { max-width: 640px; }

.msg-compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.msg-compose-header h3 {
    font-size: 1rem;
    color: var(--cor-texto);
    margin: 0;
}

/* Viewer */
.msg-view { display: flex; flex-direction: column; height: 100%; }

.msg-view-header {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e8f0;
}

.msg-view-assunto {
    font-size: 1.1rem;
    color: var(--cor-texto);
    margin: 0 0 .6rem;
    line-height: 1.3;
}

.msg-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.25rem;
    font-size: .82rem;
    color: var(--cor-sub);
}

.msg-view-corpo {
    flex: 1;
    font-size: .93rem;
    line-height: 1.8;
    color: var(--cor-texto);
    padding: .25rem 0 1.5rem;
    white-space: pre-wrap;
}

.msg-view-acoes {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid #e5e8f0;
    margin-top: auto;
}

/* ===== Chat (estilo conversa) ===== */
.msg-main.msg-chat { padding: 0; }

.msg-badge.verde { background: #22c55e; }

.chat-header {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .7rem 1.1rem;
    border-bottom: 1px solid #e5e8f0;
    background: var(--cor-card);
    flex-shrink: 0;
}
.chat-header-info { min-width: 0; }
.chat-header-nome { font-weight: 700; font-size: .95rem; color: var(--cor-texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-sub  { font-size: .75rem; color: var(--cor-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-voltar {
    display: none;
    align-items: center; justify-content: center;
    width: 30px; height: 30px; flex-shrink: 0;
    font-size: 1.5rem; line-height: 1;
    color: var(--cor-primaria); text-decoration: none; border-radius: 50%;
}
.chat-voltar:hover { background: #eef1f6; }

.chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    background: #eef1f6;
}
.chat-vazio { margin: auto; color: var(--cor-sub); font-size: .9rem; text-align: center; line-height: 1.6; }

.chat-dia { text-align: center; margin: .5rem 0; }
.chat-dia span {
    display: inline-block;
    background: rgba(44,62,122,.08);
    color: var(--cor-sub);
    font-size: .68rem; font-weight: 600;
    padding: .2rem .7rem; border-radius: 8px;
}

.chat-bubble {
    max-width: 74%;
    padding: .45rem .7rem .3rem;
    border-radius: 12px;
    font-size: .9rem;
    box-shadow: 0 1px 1px rgba(44,62,122,.08);
    word-break: break-word;
}
.chat-bubble.recebida {
    align-self: flex-start;
    background: #e3e8f0;
    color: var(--cor-texto);
    border-top-left-radius: 3px;
}
.chat-bubble.enviada {
    align-self: flex-end;
    background: var(--cor-primaria);
    color: #fff;
    border-top-right-radius: 3px;
}
.chat-texto { line-height: 1.45; }
.chat-hora { font-size: .63rem; text-align: right; margin-top: .15rem; }
.chat-bubble.recebida .chat-hora { color: var(--cor-sub); }
.chat-bubble.enviada  .chat-hora { color: rgba(255,255,255,.8); }

.chat-compose {
    display: flex;
    align-items: flex-end;
    gap: .6rem;
    padding: .65rem .9rem;
    border-top: 1px solid #e5e8f0;
    background: var(--cor-card);
    flex-shrink: 0;
}
.chat-compose textarea {
    flex: 1;
    resize: none;
    border: 1.5px solid #dde2f0;
    border-radius: 20px;
    padding: .55rem 1rem;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.4;
    max-height: 120px;
    color: var(--cor-texto);
    outline: none;
    transition: border-color var(--transicao);
}
.chat-compose textarea:focus { border-color: var(--cor-primaria); }
.chat-send {
    flex-shrink: 0;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--cor-primaria);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transicao), transform var(--transicao);
}
.chat-send:hover  { background: #22306b; }
.chat-send:active { transform: scale(.94); }

/* Responsivo */
@media (max-width: 720px) {
    .msg-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 7rem);
    }
    .msg-sidebar {
        border-right: none;
        border-bottom: 1px solid #e5e8f0;
        max-height: 45%;
    }
    .msg-lista { overflow-y: auto; }
    .msg-main  { padding: 1.25rem; }
    .msg-main.msg-chat { padding: 0; }
    /* Ao abrir uma conversa/mensagem, mostra só o conteúdo (some a lista) */
    .msg-layout.msg-aberto .msg-sidebar { display: none; }
    .chat-voltar { display: flex; }
}
