/* =====================================================================
   Chile Astrofoto — hoja de estilos principal (tema oscuro "cielo profundo")
   ===================================================================== */

:root,
[data-bs-theme="dark"] {
  --bs-body-bg: #070b16;
  --bs-body-color: #d7def0;
  --bs-tertiary-bg: #0e1426;
  --bs-secondary-color: #93a0bd;
  --bs-border-color: rgba(148, 163, 214, 0.14);
  --bs-primary: #5b8cff;
  --bs-primary-rgb: 91, 140, 255;
  --bs-link-color: #8fb0ff;
  --bs-link-color-rgb: 143, 176, 255;
  --bs-link-hover-color: #c3d3ff;
  --bs-link-hover-color-rgb: 195, 211, 255;
  --bs-body-font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-border-radius: 0.6rem;
  --bs-border-radius-lg: 0.9rem;

  --ca-card-bg: rgba(17, 25, 46, 0.78);
  --ca-card-bg-solid: #111a2e;
  --ca-card-border: rgba(148, 163, 214, 0.13);
  --ca-card-border-hover: rgba(var(--bs-primary-rgb), 0.55);
  --ca-accent: linear-gradient(135deg, #5b8cff 0%, #9b6bff 55%, #ff7ab6 100%);
  --ca-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.65), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --ca-radius: 1rem;
}

/* ---------- Base ---------- */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bs-body-bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 140, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(155, 107, 255, 0.10), transparent 60%),
    radial-gradient(1px 1px at 12% 22%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 68% 14%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 82% 48%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 35% 64%, rgba(255, 255, 255, 0.25), transparent);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }

h1, h2, h3, .h1, .h2, .h3, .display-5, .display-6 { letter-spacing: -0.02em; font-weight: 700; }
h4, h5, h6, .h4, .h5, .h6 { letter-spacing: -0.01em; }
.h3, h1.h3 { font-size: calc(1.15rem + 0.6vw); }
@media (min-width: 1200px) { .h3, h1.h3 { font-size: 1.6rem; } }

a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
::selection { background: rgba(var(--bs-primary-rgb), 0.45); }

/* ---------- Barra superior ---------- */
.site-nav {
  --bs-navbar-padding-y: 0.45rem;
  --bs-navbar-color: rgba(215, 222, 240, 0.78);
  --bs-navbar-hover-color: #fff;
  --bs-navbar-active-color: #fff;
  --bs-navbar-nav-link-padding-x: 0.65rem;
  background: rgba(8, 12, 24, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--ca-card-border);
  z-index: 1030;
}
.site-nav .navbar-nav .nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 999px;
  padding-top: 0.38rem;
  padding-bottom: 0.38rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.site-nav .navbar-nav .nav-link .bi { opacity: 0.8; margin-right: 0.1rem; }
.site-nav .navbar-nav .nav-link:hover { background: rgba(255, 255, 255, 0.06); }
.site-nav .navbar-nav .nav-link.active {
  background: rgba(var(--bs-primary-rgb), 0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb), 0.35);
}
.site-nav .navbar-nav { gap: 0.15rem; }
.site-nav .btn, .site-nav .dropdown-toggle { font-size: 0.8125rem; }
.site-nav .dropdown-menu {
  --bs-dropdown-font-size: 0.8125rem;
  --bs-dropdown-bg: #0f1730;
  --bs-dropdown-border-color: var(--ca-card-border);
  --bs-dropdown-link-hover-bg: rgba(var(--bs-primary-rgb), 0.15);
  --bs-dropdown-link-active-bg: rgba(var(--bs-primary-rgb), 0.35);
  border-radius: 0.75rem;
  box-shadow: var(--ca-shadow);
  padding: 0.35rem;
}
.site-nav .dropdown-item { border-radius: 0.5rem; }
.site-nav .navbar-toggler { border-color: var(--ca-card-border); padding: 0.25rem 0.5rem; }

.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 500; letter-spacing: -0.01em; color: #fff; }
.brand strong { font-weight: 800; background: var(--ca-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 1.9rem; height: 1.9rem; border-radius: 0.6rem;
  background: var(--ca-accent); color: #fff; font-size: 0.95rem;
  box-shadow: 0 4px 14px -4px rgba(155, 107, 255, 0.7);
}

@media (max-width: 1199.98px) {
  .site-nav .navbar-collapse { padding: 0.5rem 0 0.75rem; }
}

/* ---------- Pie ---------- */
.site-footer { border-top: 1px solid var(--ca-card-border); background: rgba(6, 9, 18, 0.6); font-size: 0.8rem; }
.sponsors { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--ca-card-border); text-align: center; }
.sponsors-title { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bs-secondary-color); margin-bottom: 0.75rem; }
.sponsors-list { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1rem 2rem; margin: 0; }
.sponsors-list img { display: block; height: 40px; width: auto; max-width: 140px; object-fit: contain;
  opacity: 0.7; filter: grayscale(1); transition: opacity 0.2s, filter 0.2s; }
.sponsors-list a:hover img, .sponsors-list a:focus-visible img, .sponsors-list img:hover { opacity: 1; filter: none; }
.sponsor-thumb, .sponsor-preview { display: inline-flex; align-items: center; justify-content: center; padding: 0.35rem 0.6rem;
  border-radius: 0.5rem; background: rgba(6, 9, 18, 0.6); border: 1px solid var(--ca-card-border); }
.sponsor-thumb img { height: 32px; width: auto; max-width: 120px; object-fit: contain; }
.sponsor-preview img { height: 40px; width: auto; max-width: 160px; object-fit: contain; }

/* ---------- Botones ---------- */
.btn { font-weight: 500; }
.btn-primary {
  --bs-btn-bg: #4b7bf5;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: #3f6be0;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: #345bc4;
  background-image: linear-gradient(135deg, #5b8cff, #7a6bff);
  box-shadow: 0 6px 18px -8px rgba(91, 140, 255, 0.8);
}
.btn-primary:hover { background-image: linear-gradient(135deg, #4f80f5, #6c5cf0); }
.btn-lg { --bs-btn-font-size: 1rem; --bs-btn-padding-y: 0.6rem; --bs-btn-padding-x: 1.25rem; }
.btn-sm { --bs-btn-font-size: 0.8rem; }
.badge { font-weight: 600; letter-spacing: 0.01em; }

/* ---------- Formularios ---------- */
.form-control, .form-select {
  background-color: rgba(7, 11, 22, 0.65);
  border-color: rgba(148, 163, 214, 0.2);
  font-size: 0.875rem;
}
.form-control:focus, .form-select:focus {
  background-color: rgba(7, 11, 22, 0.85);
  border-color: rgba(var(--bs-primary-rgb), 0.7);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.2);
}
.form-label { font-size: 0.8125rem; font-weight: 500; color: #b9c3dc; margin-bottom: 0.3rem; }
.form-text { font-size: 0.75rem; }

/* ---------- Tarjetas de sección ---------- */
.section-card,
.form-section,
.filter-card {
  position: relative;
  background: var(--ca-card-bg);
  border: 1px solid var(--ca-card-border);
  border-radius: var(--ca-radius);
  box-shadow: var(--ca-shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.section-card { padding: 1.5rem; margin-bottom: 1.75rem; }
.section-card::before {
  /* fina línea de acento superior */
  content: ""; position: absolute; inset: 0 1.25rem auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--bs-primary-rgb), 0.6), rgba(155, 107, 255, 0.5), transparent);
}
.section-card > .d-flex:first-child h2,
.section-card > h2:first-child:not(.section-title) { font-size: 1.1rem; font-weight: 700; }
.section-card .text-center.py-5 { padding-top: 1.75rem !important; padding-bottom: 1.25rem !important; font-size: 0.875rem; }
.section-card .text-center.py-5 .display-6 { font-size: 1.6rem; }
.section-card > .d-flex:first-child > a,
.section-card > .d-flex:first-child a:last-child { font-size: 0.8125rem; }
.section-card-sm { padding: 1rem 1.1rem; margin-bottom: 1rem; }
.section-card[hidden] { display: none !important; }

.section-title {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.72rem !important; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--bs-secondary-color);
  margin-bottom: 0.75rem;
}
.section-title .bi {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 0.5rem;
  background: rgba(var(--bs-primary-rgb), 0.15); color: #a9c0ff; font-size: 0.85rem;
}

.form-section { padding: 1.25rem 1.35rem; margin-bottom: 1.25rem; }
.form-section legend {
  font-size: 1rem;
  font-weight: 700;
  float: none;
  width: auto;
  padding: 0 0.25rem;
}

.filter-card {
  margin: 0 0 1.25rem 0 !important;
  padding: 0.25rem 0.75rem 1rem;
}
.filter-card .form-label { font-size: 0.75rem; }

/* ---------- Portada ---------- */
.hero {
  padding: 4.5rem 0 3.5rem;
  margin-bottom: 2rem;
  background:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 20%, #cfd8ff, transparent),
    radial-gradient(1.5px 1.5px at 40% 70%, #fff, transparent),
    radial-gradient(1px 1px at 85% 60%, #fff, transparent),
    radial-gradient(1px 1px at 10% 80%, #aab8ff, transparent),
    radial-gradient(1px 1px at 55% 40%, #fff, transparent),
    radial-gradient(700px 300px at 50% 120%, rgba(155, 107, 255, 0.25), transparent 70%),
    radial-gradient(900px 400px at 50% -20%, rgba(91, 140, 255, 0.25), transparent 70%),
    linear-gradient(180deg, #0b1330 0%, #070b16 100%);
  border-bottom: 1px solid var(--ca-card-border);
}
.hero h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 3rem);
  background: linear-gradient(180deg, #ffffff 30%, #b9c9ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { font-size: 1.05rem; }

/* ---------- Tarjetas de fotos, avisos y noticias ---------- */
.photo-card {
  background: var(--ca-card-bg-solid);
  border: 1px solid var(--ca-card-border);
  border-radius: 0.9rem;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.photo-card:hover, .photo-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--ca-card-border-hover);
  box-shadow: 0 18px 40px -18px rgba(91, 140, 255, 0.55);
}
.photo-card .card-img-top { border-radius: 0; transition: transform 0.4s ease; }
.photo-card:hover .card-img-top { transform: scale(1.04); }
.photo-card > a:first-child { display: block; overflow: hidden; }
.photo-card .card-body { padding: 0.7rem 0.8rem 0.75rem; font-size: 0.78rem; gap: 0.2rem !important; }
.photo-card .card-title { font-size: 0.85rem; font-weight: 600; line-height: 1.3; }
.photo-card .small, .photo-card small { font-size: 0.72rem; }
.photo-card .badge { font-size: 0.65rem; font-weight: 500; }
.photo-card .fs-5 { font-size: 1rem !important; }
.photo-card p.small { line-height: 1.45; }

.photo-thumb {
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #050812;
  height: auto;
}
.photo-thumb-missing {
  background: repeating-linear-gradient(45deg, #0e1424, #0e1424 10px, #111a2e 10px, #111a2e 20px);
}

/* ---------- Ficha de foto ---------- */
.photo-display {
  max-height: 80vh;
  width: 100%;
  object-fit: contain;
  background: #000;
  border-radius: var(--ca-radius);
  box-shadow: var(--ca-shadow);
}
.photo-description { font-size: 0.85rem; line-height: 1.6; color: #c3cbe0; }

.spec-table { --bs-table-bg: transparent; font-size: 0.8rem; }
.spec-table th {
  width: 42%;
  font-weight: 500;
  color: var(--bs-secondary-color);
}
.spec-table td, .spec-table th { padding-top: 0.3rem; padding-bottom: 0.3rem; border-color: rgba(148, 163, 214, 0.08); }
.spec-table tr:last-child td, .spec-table tr:last-child th { border-bottom: 0; }
#astrometry dl { font-size: 0.8rem; }

/* ---------- Listas, tablas y modales ---------- */
.list-group {
  --bs-list-group-bg: var(--ca-card-bg);
  --bs-list-group-border-color: var(--ca-card-border);
  --bs-list-group-action-hover-bg: rgba(var(--bs-primary-rgb), 0.08);
  --bs-list-group-active-bg: rgba(var(--bs-primary-rgb), 0.3);
  --bs-list-group-active-border-color: rgba(var(--bs-primary-rgb), 0.5);
  border-radius: var(--ca-radius);
  font-size: 0.875rem;
}
.table { --bs-table-bg: transparent; font-size: 0.85rem; }
.card { --bs-card-bg: var(--ca-card-bg-solid); --bs-card-border-color: var(--ca-card-border); }
.modal-content { background: #0f1730; border: 1px solid var(--ca-card-border); border-radius: var(--ca-radius); box-shadow: var(--ca-shadow); }
.nav-tabs { --bs-nav-tabs-border-color: var(--ca-card-border); font-size: 0.875rem; }
.nav-pills { font-size: 0.875rem; }
.pagination { --bs-pagination-bg: var(--ca-card-bg-solid); --bs-pagination-border-color: var(--ca-card-border); font-size: 0.85rem; }
.breadcrumb { font-size: 0.8rem; }
.alert { border-radius: 0.75rem; font-size: 0.875rem; }

/* ---------- Varios ---------- */
.upload-preview {
  max-height: 320px;
  object-fit: contain;
  background: #000;
}

.rank-position {
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  font-weight: 700;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: #1c2440;
}
/* Tamaños de avatar usados por la comunidad (sin estilos en línea por la CSP). */
.avatar[width="32"], .avatar[data-size="32"] { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar[width="40"], .avatar[data-size="40"] { width: 40px; height: 40px; font-size: 0.85rem; }
.avatar[width="48"], .avatar[data-size="48"] { width: 48px; height: 48px; font-size: 0.95rem; }
.avatar[data-size="96"] { font-size: 1.75rem; }
.avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.ws-pre { white-space: pre-line; }

:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 2px;
}

/* ---------- Mapa del cielo (SVG) ---------- */
.sky-map {
  position: relative; width: 100%; aspect-ratio: 2 / 1; min-height: 260px;
  border-radius: var(--ca-radius); overflow: hidden;
  background: radial-gradient(ellipse at center, #0c1430 0%, #060a18 70%);
  border: 1px solid var(--ca-card-border); box-shadow: var(--ca-shadow);
  touch-action: none; user-select: none;
}
.sky-map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--bs-secondary-color); font-size: 0.85rem; }
.sky-map-svg { display: block; width: 100%; height: 100%; cursor: grab; }
.sky-map-svg.is-dragging { cursor: grabbing; }
.sky-fp { fill-opacity: 0.16; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: pointer; transition: fill-opacity 0.15s ease; }
.sky-fp.is-approx { stroke-dasharray: 5 4; }
.sky-fp:hover { fill-opacity: 0.38; }
.sky-marker { stroke: #fff; stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: pointer; opacity: 0.95; }
.sky-marker:hover, .sky-marker:focus-visible { stroke: #ffd166; stroke-width: 2.5; outline: none; }
.sky-map-controls { position: absolute; left: 0.75rem; bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
.sky-map-controls .btn {
  width: 2.1rem; height: 2.1rem; padding: 0; display: grid; place-items: center;
  background: rgba(10, 16, 34, 0.8); border: 1px solid var(--ca-card-border); color: #dbe4ff; border-radius: 0.6rem;
  backdrop-filter: blur(6px);
}
.sky-map-controls .btn:hover { background: rgba(var(--bs-primary-rgb), 0.35); }
.sky-map-coords {
  position: absolute; right: 0.75rem; bottom: 0.6rem; font-size: 0.72rem; font-variant-numeric: tabular-nums;
  color: #b9c6ef; background: rgba(6, 10, 24, 0.65); padding: 0.15rem 0.5rem; border-radius: 999px; pointer-events: none;
}
.sky-map-coords:empty { display: none; }
.map-info { position: absolute; top: .75rem; right: .75rem; z-index: 5; width: min(330px, calc(100% - 1.5rem)); background: rgba(15, 23, 48, 0.95); font-size: 0.85rem; backdrop-filter: blur(8px); }
.map-info-thumb { width: 96px; height: 64px; object-fit: cover; flex: none; }
#legend { font-size: 0.8rem; }

/* ---------- Imagen de contexto de una foto ---------- */
.sky-context-frame { position: relative; aspect-ratio: 1 / 1; max-width: 560px; margin: 0 auto; border-radius: 0.75rem; overflow: hidden; background: #050812; border: 1px solid var(--ca-card-border); }
.sky-context-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sky-context-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sky-context-label { fill: #fff; font-size: 26px; font-weight: 600; paint-order: stroke; stroke: rgba(0, 0, 0, 0.7); stroke-width: 5px; }
.sky-compass line { stroke: rgba(255, 255, 255, 0.75); stroke-width: 2.5; }
.sky-compass text { fill: rgba(255, 255, 255, 0.85); font-size: 22px; font-weight: 600; }
.sky-context-status { position: absolute; inset: auto 0 0 0; padding: 0.5rem 0.75rem; font-size: 0.78rem; color: #c9d3ee; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); }
.sky-context-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; margin-top: 0.5rem; font-size: 0.72rem; color: var(--bs-secondary-color); max-width: 560px; margin-inline: auto; }

/* ---------- Comunidad: noticias, foro, mercado ---------- */
.min-w-0 { min-width: 0; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; background: #2a3550; color: #dbe4ff; font-weight: 600; flex: none; }
.user-content, .news-content, .forum-content { overflow-wrap: anywhere; line-height: 1.65; }
.forum-content { font-size: 0.9rem; }
.user-content img, .news-content img, .forum-content img { max-width: 100%; height: auto; border-radius: .5rem; }
.user-content blockquote, .news-content blockquote, .forum-content blockquote { border-left: 3px solid rgba(var(--bs-primary-rgb), .6); padding-left: .75rem; color: var(--bs-secondary-color); }
.user-content pre, .news-content pre, .forum-content pre { background: #0a1020; padding: .75rem; border-radius: .5rem; overflow-x: auto; }
.user-content table, .news-content table, .forum-content table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.user-content th, .user-content td, .news-content th, .news-content td, .forum-content th, .forum-content td { border: 1px solid rgba(255,255,255,.15); padding: .35rem .5rem; }
.news-content { font-size: 1rem; max-width: 72ch; }
.news-cover { max-height: 480px; object-fit: cover; border-radius: var(--ca-radius); }
.forum-post { border-radius: var(--ca-radius); overflow: hidden; }
.forum-post .card-header { background: rgba(255,255,255,.03); border-bottom-color: var(--ca-card-border); }
.listing-main { max-height: 560px; object-fit: contain; background: #000; border-radius: var(--ca-radius); }
.listing-thumb { width: 96px; height: 72px; object-fit: cover; opacity: .7; border: 2px solid transparent; }
.listing-thumb.active, .listing-thumb:hover { opacity: 1; border-color: var(--bs-primary); }
.chat-thread { max-height: 55vh; overflow-y: auto; padding: .75rem; background: rgba(255,255,255,.02); border-radius: .75rem; border: 1px solid var(--ca-card-border); }
.chat-msg { max-width: min(80%, 560px); padding: .5rem .75rem; border-radius: .9rem; font-size: 0.875rem; }
.chat-msg.mine { background: rgba(var(--bs-primary-rgb), .25); border-bottom-right-radius: .2rem; }
.chat-msg.theirs { background: var(--ca-card-bg-solid); border: 1px solid var(--ca-card-border); border-bottom-left-radius: .2rem; }

/* ---------- Accesibilidad y movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  .photo-card, .photo-card .card-img-top { transition: none; }
  .photo-card:hover, .photo-card:hover .card-img-top { transform: none; }
}

@media (max-width: 575.98px) {
  .section-card { padding: 1.1rem; border-radius: 0.85rem; }
  .hero { padding: 3rem 0 2.5rem; }
}

/* ---------- Tarjetas: encabezado y cuerpo en tonos distintos ---------- */
:root, [data-bs-theme="dark"] {
  --ca-card-head-bg: linear-gradient(180deg, #1c2a55 0%, #18244a 100%);
  --ca-card-body-bg: #0d1428;
  --ca-card-head-border: rgba(120, 150, 255, 0.28);
}
.section-card, .form-section { background: var(--ca-card-body-bg); padding-top: 0; overflow: hidden; }
.section-card::before { display: none; }
/* Primer elemento (título o fila de título) = encabezado de la tarjeta. */
.section-card > :first-child,
.form-section > legend:first-child,
.form-section > h2:first-child {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap;
  float: none; width: auto;
  margin: 0 -1.5rem 1.25rem; padding: .85rem 1.5rem;
  background: var(--ca-card-head-bg);
  border-bottom: 1px solid var(--ca-card-head-border);
}
.section-card-sm > :first-child { margin: 0 -1.1rem .85rem; padding: .6rem 1.1rem; }
.form-section > legend:first-child, .form-section > h2:first-child { margin: 0 -1.35rem 1rem; padding: .7rem 1.35rem; font-size: 1rem; }
.section-card > :first-child h2, .section-card > h2:first-child { margin-bottom: 0 !important; }
.section-title { margin-bottom: 0; }
.section-card-sm > .section-title:first-child { color: #c9d6ff; }
/* Tarjetas sin título (ej. votos): se dejan como cuerpo. */
.section-card.d-flex { padding-top: 1rem; }
.section-card.d-flex > :first-child { margin: 0; padding: 0; background: none; border: 0; display: block; }
/* Filtros: encabezado no aplica, tono de cuerpo. */
.filter-card { background: var(--ca-card-body-bg); }

/* Tarjetas de Bootstrap (foro, mapa, etc.) */
.card { --bs-card-bg: var(--ca-card-body-bg); }
.card > .card-header { background: var(--ca-card-head-bg); border-bottom: 1px solid var(--ca-card-head-border); color: #dbe4ff; }

/* Tarjetas de fotos, avisos y noticias: título en franja de encabezado. */
.photo-card { background: var(--ca-card-body-bg); }
.photo-card .card-body > .card-title:first-child,
.photo-card .card-body > :first-child:has(+ .card-title) {
  margin: -.7rem -.8rem .35rem !important; padding: .55rem .8rem;
  background: var(--ca-card-head-bg); border-bottom: 1px solid var(--ca-card-head-border);
}
.section-card > .section-title:first-child { justify-content: flex-start; }
