:root {
  --navy: #14213d;
  --gold: #c9a227;
  --bg: #f4f5f8;
  --borda: #e6e8ee;
  --sidebar-w: 256px;
  --bs-primary: #1d3a8a;
  --bs-primary-rgb: 29, 58, 138;
}

body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: #1f2430; }
.btn-primary { --bs-btn-bg: #1d3a8a; --bs-btn-border-color: #1d3a8a; --bs-btn-hover-bg: #14213d; --bs-btn-hover-border-color: #14213d; --bs-btn-active-bg: #14213d; }
.btn-outline-primary { --bs-btn-color: #1d3a8a; --bs-btn-border-color: #1d3a8a; --bs-btn-hover-bg: #1d3a8a; --bs-btn-hover-border-color: #1d3a8a; }
.nav-pills { --bs-nav-pills-link-active-bg: #1d3a8a; }
a { color: #1d3a8a; }

.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--gold); color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}

/* ---------- Estrutura ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--navy); color: #fff; display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; }
  .admin-main { margin-left: var(--sidebar-w); }
}
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--navy); --bs-offcanvas-width: var(--sidebar-w); }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.2rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand small { display: block; font-size: .72rem; opacity: .6; }
.sidebar-nav { padding: .6rem; overflow-y: auto; flex: 1; }
.sidebar-grupo { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; opacity: .45; padding: 1rem .7rem .4rem; }
.sidebar-nav a, .sidebar-rodape a {
  display: flex; align-items: center; gap: .7rem; color: rgba(255,255,255,.75); text-decoration: none;
  padding: .55rem .7rem; border-radius: 8px; font-size: .93rem;
}
.sidebar-nav a:hover, .sidebar-rodape a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: rgba(201,162,39,.16); color: var(--gold); font-weight: 600; }
.sidebar-rodape { padding: .6rem; border-top: 1px solid rgba(255,255,255,.08); }

.admin-main { flex: 1; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--borda); padding: .8rem 1.5rem;
  display: flex; align-items: center; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 1.2rem; font-weight: 700; margin: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--gold);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem;
}
.admin-content { padding: 1.5rem; max-width: 1400px; }

/* ---------- Componentes ---------- */
.painel { background: #fff; border: 1px solid var(--borda); border-radius: 14px; padding: 1.4rem; }
.painel-titulo { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.form-painel { max-width: 920px; }
.form-cabecalho { border-left: 4px solid var(--gold); padding-left: .9rem; margin-bottom: 1.5rem; }
.form-acoes { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--borda); }
.form-label, legend.form-label { font-weight: 600; font-size: .9rem; }

.stat {
  display: flex; flex-direction: column; gap: .2rem; background: #fff; border: 1px solid var(--borda);
  border-radius: 14px; padding: 1.1rem 1.2rem; height: 100%; color: inherit;
}
.stat-label { font-size: .8rem; color: #6b7280; font-weight: 500; }
.stat-valor { font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .78rem; color: #6b7280; }
.stat-mini .stat-valor { font-size: 1.2rem; }
.stat-entrada { border-top: 3px solid #1f6f5c; }
.stat-saida { border-top: 3px solid var(--gold); }

.filtros { display: flex; flex-wrap: wrap; gap: .8rem; background: #fff; border: 1px solid var(--borda); border-radius: 14px; padding: 1rem; margin-bottom: 1rem; }
.filtros .form-label { font-size: .78rem; margin-bottom: .2rem; }

.table > :not(caption) > * > * { padding: .7rem .9rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; font-weight: 600; background: #fafbfc; }
td, th { font-variant-numeric: tabular-nums; }

.grade-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; }
.check-card {
  display: flex; align-items: center; gap: .6rem; border: 1px solid var(--borda); border-radius: 10px;
  padding: .65rem .9rem; cursor: pointer; background: #fff; margin: 0;
}
.check-card:has(input:checked) { border-color: #1d3a8a; background: #eef2fb; }
.check-card .form-check-input { margin: 0; }
.bloco-valores { background: #f7f8fb; border: 1px dashed #cfd5e3; border-radius: 12px; padding: 1rem; }
.total-destaque { font-size: 1.5rem; font-weight: 700; color: #1f6f5c; padding-top: .2rem; }

.miniatura { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; display: inline-block; }
.placeholder-mini { background: #eef0f4; color: #9aa3b5; display: inline-flex; align-items: center; justify-content: center; }
.album-admin { display: block; background: #fff; border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; color: inherit; text-decoration: none; }
.album-admin img, .album-admin > .placeholder-mini { width: 100%; height: 140px; object-fit: cover; font-size: 2rem; }
.album-admin:hover { border-color: #1d3a8a; }
.foto-admin { background: #fff; border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; }
.foto-admin img { width: 100%; height: 150px; object-fit: cover; }

.nao-lida { border-left: 3px solid var(--gold) !important; background: #fffdf5; }
.barra { height: 6px; background: #eef0f4; border-radius: 3px; margin-top: .3rem; overflow: hidden; }
.barra span { display: block; height: 100%; background: var(--gold); }

.dados-relatorio dt { color: #6b7280; font-weight: 500; }
.dados-relatorio dd { font-weight: 600; }
.assinaturas { display: none; }
.so-print { display: none; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #14213d, #1d2d52); padding: 16px; }
.login-card { background: #fff; border-radius: 18px; padding: 2.4rem 2rem; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card .brand-mark { display: flex; width: 52px; height: 52px; font-size: 1.7rem; }

/* ---------- Impressão ---------- */
@media print {
  .sidebar, .topbar, .no-print, .filtros, .alert, .btn { display: none !important; }
  .admin-main { margin: 0 !important; }
  .admin-content { padding: 0; }
  body { background: #fff; }
  .painel, .stat { border-color: #ccc; break-inside: avoid; }
  .so-print { display: block; }
  .assinaturas { display: flex; gap: 3rem; margin-top: 4rem; }
  .assinaturas div { flex: 1; border-top: 1px solid #333; text-align: center; padding-top: .3rem; font-size: .85rem; }
}

/* O Bootstrap deixa o offcanvas transparente no desktop; garantimos o fundo da barra lateral */
.sidebar, .sidebar.offcanvas-lg { background-color: var(--navy) !important; color: #fff; }
