/* ============================================
   Asociación de Fiestas de Caminreal
   Tema: Negro y Dorado
   ============================================ */

:root {
  --black: #0a0a0a;
  --black-light: #141414;
  --black-card: #1a1a1a;
  --black-border: #2a2a2a;
  --gold: #d4af37;
  --gold-light: #e8c84a;
  --gold-dark: #b8962e;
  --gold-muted: rgba(212, 175, 55, 0.15);
  --white: #f5f5f5;
  --gray: #a0a0a0;
  --gray-dark: #666;
  --success: #4caf50;
  --danger: #e53935;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.3s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--gold-light);
}

img {
  max-width: 100%;
  display: block;
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }

.gold-text {
  color: var(--gold);
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header p {
  color: var(--gray);
  margin-top: 0.75rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Header / Nav ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--black-border);
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
}

.logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.25));
}

.logo-img-footer {
  width: 56px;
  height: 56px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.85;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
  opacity: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--black);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--black);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 2px solid var(--gold);
}

.btn-outline:hover {
  background: var(--gold);
  color: var(--black);
}

.btn-ghost {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--black-border);
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* ---- Hero Carousel ---- */
.hero-carousel {
  position: relative;
  min-height: min(92vh, 920px);
  overflow: hidden;
  background: var(--black);
}

.carousel-slides {
  position: relative;
  width: 100%;
  height: min(92vh, 920px);
  min-height: 560px;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.carousel-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.carousel-slide-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.carousel-slide-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(10, 10, 10, 0.95) 0%,
    rgba(10, 10, 10, 0.75) 45%,
    rgba(10, 10, 10, 0.5) 100%
  );
}

.carousel-slide-bg.style-welcome {
  background:
    radial-gradient(ellipse at 80% 50%, rgba(212, 175, 55, 0.12) 0%, transparent 60%),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><defs><pattern id="p" width="60" height="60" patternUnits="userSpaceOnUse"><circle cx="30" cy="30" r="1.5" fill="%23d4af37" opacity="0.12"/></pattern></defs><rect fill="%230a0a0a" width="1200" height="600"/><rect fill="url(%23p)" width="1200" height="600"/></svg>');
}

.carousel-slide-bg.style-fiestas {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1508 50%, #0a0a0a 100%);
}

.carousel-slide-bg.style-verbenas {
  background: linear-gradient(135deg, #0a0a0a 0%, #0f0a14 50%, #0a0a0a 100%);
}

.carousel-slide-bg.style-asociacion {
  background: linear-gradient(135deg, #0a0a0a 0%, #0a120a 50%, #0a0a0a 100%);
}

.carousel-slide-bg.style-comision {
  background: linear-gradient(135deg, #0a0a0a 0%, #141008 50%, #0a0a0a 100%);
}

.carousel-slide-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(1400px, 96vw);
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.5rem) clamp(1.25rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

.carousel-slide-content.has-visual {
  grid-template-columns: minmax(280px, 44%) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.carousel-slide-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-slide-visual img:not(.carousel-slide-logo) {
  width: 100%;
  max-height: min(72vh, 620px);
  object-fit: contain;
  border-radius: var(--radius);
  filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.15));
}

.carousel-slide-visual .carousel-slide-logo {
  width: min(220px, 42vw);
  max-width: 220px;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.15));
}

.carousel-slide-text {
  max-width: none;
}

.carousel-slide-logo {
  width: clamp(180px, 25vw, 280px);
  height: auto;
  opacity: 0.9;
  filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.2));
  animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.7);
  border: 1px solid var(--gold-dark);
  color: var(--gold);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  backdrop-filter: blur(8px);
}

.carousel-arrow:hover {
  background: var(--gold);
  color: var(--black);
  border-color: var(--gold);
}

.carousel-prev { left: 1.5rem; }
.carousel-next { right: 1.5rem; }

.carousel-dots {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.6rem;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}

.carousel-dot:hover {
  background: rgba(212, 175, 55, 0.5);
}

.carousel-dot.active {
  background: var(--gold);
  border-color: var(--gold-light);
  transform: scale(1.2);
}

.carousel-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--gold);
  z-index: 10;
  transition: width 0.1s linear;
}

/* ---- Hero (legacy/static) ---- */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(10, 10, 10, 0.92) 0%, rgba(10, 10, 10, 0.75) 50%, rgba(10, 10, 10, 0.95) 100%),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><defs><pattern id="p" width="60" height="60" patternUnits="userSpaceOnUse"><circle cx="30" cy="30" r="1.5" fill="%23d4af37" opacity="0.15"/></pattern></defs><rect fill="%230a0a0a" width="1200" height="600"/><rect fill="url(%23p)" width="1200" height="600"/></svg>');
  background-size: cover;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.hero-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--gold-muted);
  border: 1px solid var(--gold);
  border-radius: 50px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero h1,
.carousel-slide-text h1 {
  margin-bottom: 1.25rem;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.hero h1 span,
.carousel-slide-text h1 span {
  color: var(--gold);
}

.hero p,
.carousel-slide-text p {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--gray);
  margin-bottom: 2rem;
  max-width: none;
  overflow-wrap: break-word;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.carousel-slide-text .hero-badge {
  margin-bottom: 1.5rem;
}

.hero-decoration {
  position: absolute;
  right: -5%;
  top: 50%;
  transform: translateY(-50%);
  width: 45%;
  max-width: 500px;
  opacity: 0.12;
  pointer-events: none;
}

/* ---- Cards ---- */
.card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--gold-dark);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-gold {
  border-color: var(--gold-dark);
  background: linear-gradient(135deg, var(--black-card), rgba(212, 175, 55, 0.05));
}

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--gold-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--gray);
  font-size: 0.9rem;
}

/* ---- Grid ---- */
.grid {
  display: grid;
  gap: 1.5rem;
}

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

/* ---- News ---- */
.news-card {
  overflow: hidden;
  padding: 0;
}

.news-card-preview {
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.news-card-preview:hover,
.news-card-preview:focus-visible {
  transform: translateY(-3px);
  border-color: var(--gold-dark);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  outline: none;
}

.news-preview-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  min-height: 200px;
  padding: 0.5rem;
}

.news-preview-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  object-position: center;
}

.news-preview-media.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 0.85rem;
}

.news-preview-media.is-missing::after {
  content: 'Imagen no disponible';
}

.news-preview-media.is-missing .news-preview-image {
  display: none;
}

.news-preview-emoji {
  min-height: 200px;
  background: linear-gradient(135deg, var(--black-light), var(--gold-muted));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.news-preview-body {
  padding: 1.1rem 1.25rem 1.35rem;
}

.news-preview-body h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.4;
}

.news-body {
  padding: 1.5rem;
}

.news-date {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.news-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--gold-muted);
  color: var(--gold);
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

body.news-modal-open {
  overflow: hidden;
}

.news-modal {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.news-modal[hidden] {
  display: none !important;
}

.news-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}

.news-modal-box {
  position: relative;
  width: min(720px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--black-card);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.news-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--black-border);
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.85);
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.news-modal-close:hover {
  border-color: var(--gold-dark);
  color: var(--gold-light);
}

.news-modal-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  border-bottom: 1px solid var(--black-border);
}

.news-modal-image {
  display: block;
  width: 100%;
  max-height: min(52vh, 420px);
  object-fit: contain;
}

.news-modal-media.news-preview-emoji,
.news-modal-media.news-preview-media:not(:has(img)) {
  min-height: 180px;
  font-size: 3rem;
}

.news-modal-body {
  padding: 1.35rem 1.5rem 1.6rem;
}

.news-modal-body h2 {
  margin: 0.35rem 0 0.85rem;
  line-height: 1.35;
}

.news-modal-resumen {
  margin: 0;
  color: var(--gray);
  line-height: 1.65;
  font-size: 0.98rem;
  white-space: pre-wrap;
}

/* ---- Program Timeline ---- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--gold), var(--gold-dark));
}

.timeline-day {
  position: relative;
  margin-bottom: 2.5rem;
  scroll-margin-top: 8.5rem;
}

.programa-day-nav-wrap {
  margin-bottom: 2rem;
}

.programa-day-nav {
  position: sticky;
  top: 61px;
  z-index: 900;
  padding: 0.85rem 0 1rem;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.98) 0%, rgba(10, 10, 10, 0.92) 100%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--black-border);
}

.programa-day-nav-track {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding: 0.15rem 0.1rem 0.65rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dark) transparent;
}

.programa-day-nav-track::-webkit-scrollbar {
  height: 6px;
}

.programa-day-nav-track::-webkit-scrollbar-thumb {
  background: var(--gold-dark);
  border-radius: 999px;
}

.programa-day-nav-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 4.6rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--black-border);
  border-radius: 999px;
  background: var(--black-light);
  color: var(--gray);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition), transform var(--transition);
}

.programa-day-nav-item:hover {
  border-color: var(--gold-dark);
  color: var(--white);
}

.programa-day-nav-item.is-active {
  background: var(--gold-muted);
  border-color: var(--gold);
  color: var(--gold-light);
  transform: translateY(-1px);
}

.programa-day-nav-weekday {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.programa-day-nav-date {
  font-size: 0.72rem;
  opacity: 0.85;
}

.programa-day-nav-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--black-border);
  overflow: hidden;
}

.programa-day-nav-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  transition: width 0.35s ease;
}

.timeline-day:last-child {
  margin-bottom: 0;
}

.timeline-day-title {
  margin: 0 0 1.15rem;
  padding-left: 1.5rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 700;
  line-height: 1.3;
  text-transform: capitalize;
}

.timeline-day-events {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-item {
  position: relative;
  padding-bottom: 0;
  padding-left: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  border: 3px solid var(--black);
  transform: translateX(-5px);
}

.timeline-item.programa-event {
  padding-left: 0;
}

.programa-event-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.programa-event-layout.has-image {
  grid-template-columns: minmax(150px, 260px) minmax(0, 1fr);
  gap: 1.25rem;
}

.programa-event-media {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--black);
  border: 1px solid var(--black-border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.4rem;
  min-height: 120px;
}

.programa-event-media.is-loading {
  background: linear-gradient(110deg, var(--black-card) 8%, var(--black-light) 18%, var(--black-card) 33%);
  background-size: 200% 100%;
  animation: programa-image-shimmer 1.4s linear infinite;
}

.programa-event-image.is-lazy-pending {
  visibility: hidden;
  min-height: 120px;
}

.programa-event-image.is-loaded,
.programa-event-image:not(.is-lazy-pending) {
  visibility: visible;
}

@keyframes programa-image-shimmer {
  to { background-position-x: -200%; }
}

.programa-event-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  border-radius: 4px;
}

.programa-event-media.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  color: var(--gray);
  font-size: 0.85rem;
  background: var(--black-card);
}

.programa-event-media.is-missing::after {
  content: 'Imagen no disponible';
}

.programa-event-media.is-missing .programa-event-image {
  display: none;
}

.programa-event-body h3 {
  margin: 0.15rem 0 0;
}

.programa-event-desc {
  color: var(--gray);
  margin: 0.65rem 0 0;
  line-height: 1.55;
}

.programa-event-contact {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--gray);
  line-height: 1.45;
}

.programa-event-contact strong {
  color: var(--gold);
}

.timeline-summary {
  color: var(--gray);
  margin-top: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.timeline-more-hint {
  font-size: 0.78rem;
  color: var(--gold);
}

@media (max-width: 640px) {
  .programa-event-layout.has-image {
    grid-template-columns: 1fr;
  }

  .programa-event-media {
    max-width: none;
    width: 100%;
    margin: 0;
    min-height: 200px;
  }

  .programa-event-image {
    width: 100%;
    max-height: min(75vw, 420px);
  }
}

@media (max-width: 768px) {
  .programa-event-detail.has-image,
  .cal-event-detail.programa-event-detail.has-image {
    grid-template-columns: 1fr;
  }

  .programa-popover-media {
    max-width: none;
    width: 100%;
    margin: 0;
    min-height: 200px;
  }

  .programa-popover-image {
    width: 100%;
    max-height: min(75vw, 420px);
  }

  .calendar-day-event .programa-event-detail.has-image {
    grid-template-columns: 1fr;
  }
}

.timeline-page-hint {
  display: none;
}

.programa-event-detail.has-image,
.cal-event-detail.programa-event-detail.has-image {
  display: grid;
  grid-template-columns: minmax(130px, 210px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 992px) {
  .programa-event-detail.has-image,
  .cal-event-detail.programa-event-detail.has-image {
    grid-template-columns: 1fr;
  }

  .programa-popover-media {
    width: 100%;
    max-width: none;
  }

  .programa-popover-body {
    width: 100%;
  }

  .cal-event-title {
    font-size: 1.08rem;
  }

  .cal-event-meta,
  .cal-event-desc,
  .cal-event-note {
    font-size: 0.9rem;
  }

  .calendar-day-event .cal-event-detail.programa-event-detail.has-image {
    padding: 0;
    gap: 0;
  }

  .calendar-day-event .programa-popover-media {
    border: none;
    border-bottom: 1px solid var(--black-border);
    border-radius: 0;
    min-height: 180px;
    padding: 0.5rem;
  }

  .calendar-day-event .programa-popover-image {
    max-height: min(70vw, 360px);
  }

  .calendar-day-event .programa-popover-body {
    padding: 0.85rem 1rem 1rem;
  }

  .calendar-popover:has(.programa-event-detail.has-image) {
    max-width: calc(100vw - 1rem);
    padding: 0.75rem;
  }

  .calendar-popover .programa-event-detail.has-image {
    gap: 0.75rem;
  }
}

.programa-popover-media {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.35rem;
}

.programa-popover-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  border-radius: 4px;
}

.programa-popover-media.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--gray);
  font-size: 0.8rem;
}

.programa-popover-media.is-missing::after {
  content: 'Imagen no disponible';
}

.programa-popover-media.is-missing .programa-popover-image {
  display: none;
}

.programa-popover-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.programa-event-detail .cal-event-title {
  margin-top: 0.15rem;
}

.timeline-date {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.timeline-time {
  color: var(--gold-light);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.programa-event .timeline-time {
  font-size: 1.5rem;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--white);
}

.form-group label .required {
  color: var(--gold);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--black-light);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-muted);
}

.form-control::placeholder {
  color: var(--gray-dark);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.35rem;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  margin-top: 0.2rem;
}

/* ---- Auth Pages ---- */
.auth-page {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: 12px;
  padding: 2.5rem;
}

.auth-card h1 {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--gray);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--gray);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--black-border);
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--gray);
}

/* ---- Dashboard ---- */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 73px);
}

.sidebar {
  background: var(--black-light);
  border-right: 1px solid var(--black-border);
  padding: 1.5rem;
}

.sidebar-user {
  text-align: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--black-border);
  margin-bottom: 1rem;
}

.user-avatar {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  margin: 0 auto 0.75rem;
}

.user-name {
  font-weight: 600;
}

.user-role {
  font-size: 0.8rem;
  color: var(--gold);
  margin-top: 0.25rem;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--gray);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--gold-muted);
  color: var(--gold);
}

.dashboard-main {
  padding: 2rem;
  padding-bottom: 2.5rem;
  min-width: 0;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  font-family: var(--font-display);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.25rem;
}

/* ---- Calendar ---- */
.calendar {
  width: 100%;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-week-view {
  width: 100%;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--black-light);
  border-bottom: 1px solid var(--black-border);
}

.calendar-header h3 {
  margin: 0;
  text-align: center;
  flex: 1;
  font-size: 1.05rem;
}

.calendar-header-title {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.calendar-header-title h3 {
  font-size: 0.95rem;
  line-height: 1.35;
}

.calendar-header-year {
  display: block;
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.15rem;
}

.calendar-nav-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  background: var(--black-card);
  color: var(--gold);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}

.calendar-nav-btn:hover {
  border-color: var(--gold-dark);
  background: var(--gold-muted);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 100%;
}

.calendar-week-view .calendar-week-grid {
  align-items: stretch;
}

.calendar-week-view .calendar-day {
  display: flex;
  flex-direction: column;
  min-height: 110px;
  max-height: 300px;
  overflow: hidden;
  isolation: isolate;
}

.calendar-week-view .calendar-day.has-events {
  min-height: 130px;
}

.calendar-week-view .calendar-day-events-wrap {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-right: 0.1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.45) transparent;
}

.calendar-week-view .calendar-day-events-wrap::-webkit-scrollbar {
  width: 4px;
}

.calendar-week-view .calendar-day-events-wrap::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.45);
  border-radius: 999px;
}

.calendar-day-name {
  padding: 0.75rem 0.35rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  background: var(--black-light);
}

.calendar-day {
  padding: 0.5rem;
  border: 1px solid var(--black-border);
  font-size: 0.85rem;
  position: relative;
  cursor: default;
  min-height: 80px;
  min-width: 0;
}

.calendar-week-view .calendar-day-toolbar {
  padding: 0.65rem 1rem 0;
}

.calendar-event-more {
  display: none;
}

@media (min-width: 900px) {
  .calendar-month-view .calendar-day {
    aspect-ratio: 1;
  }

  .calendar-week-view .calendar-day {
    max-height: 340px;
  }
}

.calendar-day.other-month {
  opacity: 0.3;
}

.calendar-day.today {
  background: var(--gold-muted);
}

.calendar-day .day-number {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.calendar-week-view .calendar-day .day-number {
  flex-shrink: 0;
}

.calendar-week-view .calendar-day:has(.calendar-event:hover),
.calendar-week-view .calendar-day:has(.calendar-event.is-active) {
  z-index: 2;
}

.calendar-event {
  font-size: 0.65rem;
  padding: 0.2rem 0.35rem;
  border-radius: 3px;
  margin-top: 0;
  cursor: pointer;
  transition: filter var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}

.calendar-week-view .calendar-event {
  white-space: normal;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.calendar-month-view .calendar-event,
.calendar-day-view .calendar-event {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event:hover,
.calendar-event.is-active {
  filter: brightness(1.12);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.45);
}

.calendar-event:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.calendar-popover {
  position: fixed;
  z-index: 2000;
  max-width: min(320px, calc(100vw - 1.5rem));
  padding: 0.85rem 1rem;
  background: var(--black-light);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.calendar-popover:has(.programa-event-detail.has-image) {
  max-width: min(620px, calc(100vw - 1.5rem));
  padding: 1rem 1.1rem;
}

.cal-event-detail {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cal-event-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.cal-event-title {
  font-size: 0.95rem;
  line-height: 1.35;
}

.cal-event-meta,
.cal-event-desc,
.cal-event-note {
  font-size: 0.82rem;
  color: var(--gray);
  margin: 0;
  line-height: 1.45;
}

.cal-event-badge {
  align-self: flex-start;
  margin-top: 0.15rem;
}

.cal-event-link {
  margin-top: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--gold-light);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.cal-event-link:hover {
  text-decoration: underline;
}

.cal-event-madrugada-note {
  display: inline;
  color: var(--gold-light);
  font-size: 0.82rem;
}

.calendar-event.event-madrugada {
  border-left: 2px solid rgba(212, 175, 55, 0.65);
  padding-left: 0.35rem;
}

.calendar-legend {
  margin-top: 1.5rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray);
}

.calendar-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.calendar-legend-swatch.event-turno {
  background: rgba(212, 175, 55, 0.5);
}

.calendar-legend-swatch.event-encuesta {
  background: rgba(76, 175, 80, 0.3);
}

.calendar-legend-swatch.event-fiesta {
  background: rgba(229, 57, 53, 0.3);
}

.calendar-legend-hint {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--gray);
}

.encuesta-highlight {
  animation: encuestaPulse 2s ease;
}

@keyframes encuestaPulse {
  0%, 100% { box-shadow: none; }
  25%, 75% { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(212, 175, 55, 0.25); }
}

.doc-item-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
}

.event-turno {
  background: rgba(212, 175, 55, 0.3);
  color: var(--gold-light);
}

.event-encuesta {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success);
}

.event-fiesta {
  background: rgba(229, 57, 53, 0.2);
  color: #ef5350;
}

.calendar-day-toolbar {
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem 0;
}

.calendar-day-toolbar .btn.is-active {
  opacity: 0.55;
  cursor: default;
}

.calendar-day-events {
  list-style: none;
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.calendar-day-event {
  padding: 0;
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  background: var(--black-light);
  overflow: hidden;
}

.calendar-day-event .cal-event-detail {
  padding: 0.85rem 1rem;
}

.calendar-day-event-type {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray);
}

.calendar-day-event-label {
  font-size: 0.92rem;
  line-height: 1.4;
}

.calendar-day-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--gray);
  border: 1px dashed var(--black-border);
  border-radius: var(--radius);
}

/* ---- Shifts Table ---- */
.table-wrapper {
  overflow: auto;
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.table-socios {
  max-height: min(68vh, 760px);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--black-border);
}

th {
  background: var(--black-light);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  font-size: 0.9rem;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(212, 175, 55, 0.03);
}

.table-socios .cell-ellipsis {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-socios th.actions-cell,
.table-socios td.actions-cell {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--black-card);
  box-shadow: -8px 0 16px rgba(0, 0, 0, 0.35);
}

.table-socios th.actions-cell {
  background: var(--black-light);
  z-index: 2;
}

.table-socios tr:hover td.actions-cell {
  background: #17130a;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 10.5rem;
}

.btn-danger-ghost {
  color: var(--danger) !important;
  border: 1px solid rgba(229, 57, 53, 0.35);
}

.btn-danger-ghost:hover {
  background: rgba(229, 57, 53, 0.12) !important;
  border-color: var(--danger);
}

.member-picker {
  position: relative;
}

.member-picker-trigger {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  cursor: pointer;
  background: var(--black-light) !important;
}

.member-picker-trigger:hover {
  border-color: var(--gold-dark);
}

.member-picker-chevron {
  color: var(--gold);
  font-size: 0.85rem;
  transition: transform var(--transition);
}

.member-picker.is-open .member-picker-chevron {
  transform: rotate(180deg);
}

.member-picker-panel {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  background: var(--black-card);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
}

.member-picker-search {
  margin-bottom: 0.5rem;
}

.member-picker-toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--black-border);
}

.member-picker-link {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.member-picker-link:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

.member-picker-list {
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.member-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.35rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}

.member-picker-item:hover {
  background: rgba(212, 175, 55, 0.06);
}

.member-picker-item input {
  margin-top: 0.2rem;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.member-picker-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.member-picker-item-text strong {
  font-weight: 500;
  color: var(--white);
}

.member-picker-meta {
  font-size: 0.78rem;
  color: var(--gray);
}

.member-picker-empty {
  color: var(--gray);
  font-size: 0.85rem;
  padding: 1rem 0.5rem;
  text-align: center;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-gold {
  background: var(--gold-muted);
  color: var(--gold);
}

.badge-green {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
}

.badge-red {
  background: rgba(229, 57, 53, 0.15);
  color: var(--danger);
}

/* ---- Survey ---- */
.survey-card {
  border-left: 4px solid var(--gold);
}

.survey-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.survey-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--black-light);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.survey-option:hover {
  border-color: var(--gold);
}

.survey-option input {
  accent-color: var(--gold);
}

.encuesta-chart {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.encuesta-chart-summary {
  color: var(--gray);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.encuesta-bar-block {
  margin-bottom: 0.35rem;
}

.encuesta-bar-row--clickable {
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.encuesta-bar-row--clickable:hover,
.encuesta-bar-row--clickable.is-open {
  border-color: var(--gold-dark);
  background: rgba(184, 134, 11, 0.08);
}

.encuesta-voters-panel {
  margin: 0.25rem 0 0.75rem 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--black-light);
  border: 1px solid var(--black-border);
  border-radius: 8px;
}

.encuesta-voters-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.encuesta-voters-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: baseline;
  font-size: 0.9rem;
}

.encuesta-voter-email {
  color: var(--gray);
  font-size: 0.85rem;
}

.encuesta-voters-loading,
.encuesta-voters-empty,
.encuesta-voters-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--gray);
}

.encuesta-voters-error {
  color: var(--danger);
}

.table-socios .th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.table-socios .th-sort:hover,
.table-socios .th-sort.sort-asc,
.table-socios .th-sort.sort-desc {
  color: var(--gold-light);
}

.table-socios .sort-indicator {
  font-size: 0.65rem;
  opacity: 0.9;
}

.encuesta-bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 28%) 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.encuesta-bar-label {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.encuesta-bar-track {
  height: 1.25rem;
  background: var(--black-light);
  border: 1px solid var(--black-border);
  border-radius: 999px;
  overflow: hidden;
}

.encuesta-bar-fill {
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.encuesta-bar-stat {
  font-size: 0.8rem;
  color: var(--gray);
  min-width: 4.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .encuesta-bar-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .encuesta-bar-stat {
    text-align: left;
  }
}

/* ---- Documents ---- */
.doc-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  transition: all var(--transition);
}

.doc-item:hover {
  border-color: var(--gold-dark);
}

.doc-icon {
  width: 48px;
  height: 48px;
  background: var(--gold-muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.doc-info {
  flex: 1;
}

.doc-info h4 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.doc-meta {
  font-size: 0.8rem;
  color: var(--gray);
}

.upload-zone {
  border: 2px dashed var(--black-border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2rem;
}

.upload-zone:hover {
  border-color: var(--gold);
  background: var(--gold-muted);
}

.upload-zone .icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

/* ---- CTA Banner ---- */
.cta-banner {
  background: linear-gradient(135deg, var(--black-card), rgba(212, 175, 55, 0.1));
  border: 1px solid var(--gold-dark);
  border-radius: 12px;
  padding: 3rem;
  text-align: center;
  margin: 2rem 0;
}

.cta-banner h2 {
  margin-bottom: 1rem;
}

.cta-banner p {
  color: var(--gray);
  margin-bottom: 1.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Footer ---- */
.footer {
  background: var(--black-light);
  border-top: 1px solid var(--black-border);
  padding: 3rem 0 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-brand p {
  color: var(--gray);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.footer h4 {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--gold);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--gray);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--gold);
}

.footer-bottom {
  border-top: 1px solid var(--black-border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-bottom p {
  color: var(--gray-dark);
  font-size: 0.85rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  width: 36px;
  height: 36px;
  border: 1px solid var(--black-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  transition: all var(--transition);
}

.social-links a:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ---- Alerts / Toast ---- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success {
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-warning {
  background: var(--gold-muted);
  border: 1px solid var(--gold);
  color: var(--gold-light);
}

.alert-info {
  background: rgba(33, 150, 243, 0.1);
  border: 1px solid #2196f3;
  color: #64b5f6;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--black-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: var(--white);
  box-shadow: var(--shadow);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.confirm-dialog[hidden] {
  display: none !important;
}

.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.confirm-dialog-box {
  position: relative;
  width: min(420px, 100%);
  padding: 1.35rem 1.5rem;
  background: var(--black-card);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.confirm-dialog-message {
  margin: 0 0 1.25rem;
  line-height: 1.5;
  color: var(--white);
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.confirm-dialog-ok.confirm-dialog-danger {
  background: linear-gradient(135deg, #ef5350, #c62828);
  color: #fff;
}

.confirm-dialog-ok.confirm-dialog-danger:hover {
  background: linear-gradient(135deg, #ff6659, #d32f2f);
  color: #fff;
}

/* ---- Page Header ---- */
.page-header {
  background: linear-gradient(180deg, var(--black-light) 0%, var(--black) 100%);
  padding: 3rem 0;
  border-bottom: 1px solid var(--black-border);
  text-align: center;
}

.page-header h1 {
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--gray);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--black-border);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.tab {
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--gray);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--white);
}

.tab.active {
  color: var(--gold);
  background: var(--gold-muted);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---- Admin / Dashboard app shell ---- */
body.dashboard-app,
body.admin-body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

body.dashboard-app .dashboard-layout,
body.admin-body .dashboard-layout {
  min-height: calc(100vh - 73px);
  min-height: calc(100dvh - 73px);
}

body.dashboard-app .dashboard-main,
body.admin-body .dashboard-main {
  overflow: visible;
  min-height: auto;
}

/* ---- Admin ---- */
.admin-body {
  display: block;
}

.header-admin {
  border-bottom-color: var(--gold-dark);
}

.admin-badge {
  padding: 0.35rem 0.75rem;
  background: var(--gold-muted);
  border: 1px solid var(--gold);
  border-radius: 50px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-admin {
  border-right-color: var(--gold-dark);
}

.admin-avatar {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.admin-body .dashboard-main h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

/* ---- Responsive ---- */

/* Dashboard mobile navigation */
.dashboard-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--gold-muted);
  border: 1px solid var(--gold-dark);
  border-radius: var(--radius);
  color: var(--gold);
  font-size: 1.35rem;
  cursor: pointer;
  line-height: 1;
}

.nav-dashboard {
  gap: 0.75rem;
}

.nav-dashboard .logo {
  min-width: 0;
  flex: 1;
}

.nav-dashboard .logo span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-actions-compact {
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1090;
}

.sidebar-backdrop.is-visible {
  display: block;
}

.dashboard-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.15rem;
  padding: 0.35rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom));
  background: rgba(10, 10, 10, 0.98);
  border-top: 1px solid var(--black-border);
  backdrop-filter: blur(12px);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 52px;
  padding: 0.25rem 0.15rem;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--gray);
  font-family: var(--font-body);
  font-size: 0.65rem;
  cursor: pointer;
  transition: all var(--transition);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--gold);
  background: var(--gold-muted);
}

.bottom-nav-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.bottom-nav-label {
  line-height: 1.1;
  text-align: center;
}

body.dashboard-sidebar-open {
  overflow: hidden;
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-layout { grid-template-columns: 1fr; }

  .dashboard-menu-toggle {
    display: inline-flex;
  }

  .dashboard-bottom-nav {
    display: grid;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    z-index: 1100;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(1rem + env(safe-area-inset-top));
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .dashboard-main {
    padding: 1rem 1rem calc(6.5rem + env(safe-area-inset-bottom));
    min-height: calc(100vh - 73px);
    min-height: calc(100dvh - 73px);
  }

  body.dashboard-app .dashboard-layout,
  body.admin-body .dashboard-layout {
    min-height: auto;
  }

  .dashboard-header {
    margin-bottom: 1.25rem;
  }

  .dashboard-header h1 {
    font-size: clamp(1.35rem, 5vw, 1.85rem);
  }

  .table-socios {
    max-height: none;
  }

  .member-picker-panel {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    top: auto;
    bottom: calc(4.5rem + env(safe-area-inset-bottom));
    max-height: min(55vh, 420px);
  }
}

@media (max-width: 992px) {
  .header .nav-links {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1001;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin: 0;
    padding: 1rem;
    list-style: none !important;
    background: rgba(10, 10, 10, 0.98);
    border-bottom: 1px solid var(--black-border);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  }

  .header .nav-links.open {
    display: flex !important;
  }

  .header .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .header .logo {
    flex: 1;
    min-width: 0;
  }

  .header .nav-actions {
    flex-shrink: 0;
  }

  .hero-carousel {
    min-height: auto;
  }

  .carousel-slides {
    display: grid;
    grid-template-areas: "slide";
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .carousel-slide {
    grid-area: slide;
    position: relative;
    inset: auto;
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
  }

  .carousel-slide.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    max-height: none;
    overflow: visible;
    z-index: 1;
  }

  .carousel-slide-visual {
    display: none !important;
  }

  .carousel-slide-content,
  .carousel-slide-content.has-visual {
    grid-template-columns: 1fr;
    text-align: center;
    min-height: auto;
    width: 100%;
    padding: 1.75rem 3.25rem 3.5rem;
  }

  .carousel-slide-text {
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
  }

  .carousel-slide-text h1 {
    font-size: clamp(1.5rem, 6.5vw, 2.25rem);
  }

  .carousel-slide-text p {
    font-size: clamp(0.92rem, 3.8vw, 1.05rem);
    margin-bottom: 1.5rem;
  }

  .carousel-slide-text .hero-badge {
    font-size: 0.72rem;
    padding: 0.35rem 0.85rem;
    margin-bottom: 1rem;
  }

  .carousel-slide-text .hero-actions {
    justify-content: center;
  }

  .carousel-slide-text .hero-actions .btn-lg {
    padding: 0.85rem 1.25rem;
    font-size: 0.92rem;
  }

  .carousel-arrow {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }

  .carousel-prev { left: 0.5rem; }
  .carousel-next { right: 0.5rem; }

  .carousel-dots {
    bottom: 0.85rem;
    z-index: 11;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--black);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--black-border);
  }

  .nav-links.open {
    display: flex;
  }

  .menu-toggle {
    display: block;
  }

  .nav {
    padding: 0.75rem 1rem;
  }

  .logo {
    font-size: 1.05rem;
  }

  .logo-img {
    width: 40px;
    height: 40px;
  }

  .nav-actions .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .header-admin .admin-badge {
    display: none;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

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

  .stat-value {
    font-size: 1.65rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .hero-decoration {
    display: none;
  }

  .news-preview-image {
    max-height: 280px;
  }

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

  .calendar-week-view .calendar-day {
    max-height: 260px;
  }

  .calendar-day-name {
    padding: 0.5rem 0.2rem;
    font-size: 0.62rem;
  }

  .calendar-day {
    min-height: 58px;
    padding: 0.35rem;
    font-size: 0.72rem;
  }

  .calendar-event {
    font-size: 0.58rem;
    padding: 0.1rem 0.25rem;
  }

  .calendar-header {
    padding: 0.85rem 1rem;
  }

  .doc-item {
    flex-wrap: wrap;
  }

  .doc-item .btn {
    width: 100%;
    margin-top: 0.35rem;
  }

  .upload-zone {
    padding: 2rem 1rem;
  }

  .survey-options {
    gap: 0.5rem;
  }

  .survey-option {
    padding: 0.75rem;
  }

  .table-actions {
    min-width: 8.5rem;
  }

  th, td {
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
  }

  .cta-banner {
    padding: 2rem 1.25rem;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
  }
}

@media (max-width: 1024px) {
  .carousel-slide-content.has-visual {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .carousel-slide-visual img:not(.carousel-slide-logo) {
    max-height: min(36vh, 280px);
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-carousel .carousel-slide-content {
    padding: 1.35rem 2.85rem 3.75rem;
  }

  .carousel-slide-text h1 {
    font-size: clamp(1.35rem, 7.5vw, 1.85rem);
    line-height: 1.25;
    margin-bottom: 0.75rem;
  }

  .carousel-slide-text p {
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 1.15rem;
  }

  .carousel-slide-text .hero-badge {
    font-size: 0.65rem;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
  }

  .carousel-slide-text .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .carousel-slide-text .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .carousel-arrow {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .carousel-prev { left: 0.35rem; }
  .carousel-next { right: 0.35rem; }

  .carousel-dots {
    bottom: 0.65rem;
    gap: 0.45rem;
  }

  .carousel-dot {
    width: 8px;
    height: 8px;
  }

  .bottom-nav-label {
    font-size: 0.6rem;
  }

  .nav-dashboard .logo span {
    max-width: 9rem;
  }

  .encuesta-bar-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .encuesta-bar-stat {
    text-align: left;
  }
}

@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* ---- Rich email editor (Quill) ---- */
.rich-editor {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  min-height: 220px;
}

.rich-editor .ql-toolbar.ql-snow {
  background: var(--black-light);
  border: none;
  border-bottom: 1px solid var(--black-border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.rich-editor .ql-container.ql-snow {
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  min-height: 180px;
}

.rich-editor .ql-editor {
  color: var(--white);
  min-height: 180px;
}

.rich-editor .ql-editor.ql-blank::before {
  color: var(--gray);
  font-style: normal;
}

.rich-editor .ql-snow .ql-stroke {
  stroke: var(--gray);
}

.rich-editor .ql-snow .ql-fill {
  fill: var(--gray);
}

.rich-editor .ql-snow .ql-picker {
  color: var(--gray);
}

.rich-editor .ql-snow .ql-picker-options {
  background: var(--black-light);
  border-color: var(--black-border);
}

.rich-editor .ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label,
.rich-editor .ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options {
  border-color: var(--gold-dark);
}

.rich-editor .ql-snow.ql-toolbar button:hover,
.rich-editor .ql-snow .ql-toolbar button:hover,
.rich-editor .ql-snow.ql-toolbar button.ql-active,
.rich-editor .ql-snow .ql-toolbar button.ql-active {
  color: var(--gold);
}

.rich-editor .ql-snow.ql-toolbar button:hover .ql-stroke,
.rich-editor .ql-snow .ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--gold);
}

.mail-doc-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--black-light);
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
}

.mail-doc-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.35rem 0.25rem;
  border-radius: var(--radius);
}

.mail-doc-item:hover {
  background: rgba(212, 175, 55, 0.06);
}

.mail-doc-item input {
  margin-top: 0.2rem;
  accent-color: var(--gold);
}

/* ---- Mensajes internos (admin ↔ socios) ---- */
.msg-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.msg-section-header {
  flex-shrink: 0;
}

.nav-notify-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.nav-notify-btn:hover {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.35);
}

.nav-notify-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.nav-notify-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}

.msg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  flex: 1;
  min-height: min(560px, calc(100dvh - 15rem));
  min-width: 0;
  width: 100%;
}

.msg-inbox {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
}

.msg-thread-placeholder {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 2rem 1.5rem;
  border: 1px dashed var(--black-border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.15);
  color: var(--gray);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
}

.msg-layout:not(.has-thread) .msg-thread-panel {
  display: none !important;
}

.msg-inbox-loading,
.msg-thread-empty {
  color: var(--gray);
  padding: 1.5rem 1rem;
  text-align: center;
}

.msg-inbox-item {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 0.85rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.msg-inbox-item:hover,
.msg-inbox-item.is-active {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.25);
}

.msg-inbox-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.msg-inbox-item-name {
  font-weight: 600;
  font-size: 0.92rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.msg-inbox-item-time {
  color: var(--gray);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.msg-inbox-item-preview {
  color: var(--gray);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-inbox-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--gold);
  color: #111;
  font-size: 0.7rem;
  font-weight: 700;
}

.msg-thread-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.msg-thread-panel[hidden] {
  display: none !important;
}

.msg-thread-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--black-border);
  flex-shrink: 0;
}

.msg-thread-header > div {
  min-width: 0;
  flex: 1;
}

.msg-thread-header h3 {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.msg-thread-subtitle {
  margin: 0.25rem 0 0;
  color: var(--gray);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.msg-back-btn {
  flex-shrink: 0;
}

.msg-thread-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.msg-bubble {
  max-width: min(85%, 520px);
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--black-border);
}

.msg-bubble-mine {
  align-self: flex-end;
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.3);
}

.msg-bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: var(--gray);
  flex-wrap: wrap;
}

.msg-bubble-author {
  font-weight: 600;
  color: var(--gold);
}

.msg-bubble-body {
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: pre-wrap;
}

.msg-reply-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 1.1rem calc(0.85rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--black-border);
  flex-shrink: 0;
}

.msg-reply-form textarea {
  min-width: 0;
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
  max-height: 40vh;
}

.msg-reply-form .btn {
  align-self: flex-end;
}

@media (min-width: 769px) {
  .msg-reply-form {
    flex-direction: row;
    align-items: flex-end;
  }

  .msg-reply-form textarea {
    flex: 1;
  }
}

.msg-socio-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--black-border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  min-width: 0;
  height: min(560px, calc(100dvh - 14rem));
  min-height: 360px;
}

.msg-socio-panel .msg-thread-body {
  min-height: 0;
  max-height: none;
}

@media (min-width: 1025px) {
  .msg-layout {
    grid-template-columns: clamp(220px, 28%, 300px) minmax(0, 1fr);
  }

  .msg-layout:not(.has-thread) .msg-thread-placeholder {
    display: flex;
  }

  .msg-layout.has-thread .msg-thread-placeholder {
    display: none !important;
  }

  .msg-back-btn {
    display: none;
  }
}

@media (max-width: 1024px) {
  .msg-section .msg-layout {
    min-height: calc(100dvh - 12rem - env(safe-area-inset-bottom));
    max-height: none;
  }

  .msg-thread-placeholder {
    display: none !important;
  }

  .msg-layout.has-thread.is-thread-open .msg-inbox {
    display: none;
  }

  .msg-layout.has-thread.is-thread-open .msg-thread-panel:not([hidden]) {
    display: flex !important;
  }

  .msg-back-btn {
    display: inline-flex;
  }

  .msg-section-header {
    margin-bottom: 1rem;
  }

  .msg-section-header .btn {
    width: 100%;
  }

  .msg-bubble {
    max-width: min(92%, 520px);
  }

  .msg-reply-form {
    flex-direction: column;
  }

  .msg-reply-form .btn {
    width: 100%;
    align-self: stretch;
  }

  .msg-socio-panel {
    height: calc(100dvh - 11rem - env(safe-area-inset-bottom));
    min-height: 320px;
  }
}

@media (max-width: 768px) {
  .msg-thread-panel[hidden] {
    display: none !important;
  }
}
