/* ============================================================
   Copa Quisqueya 2026 — Design Tokens & Base Styles
   Mobile-first, responsive
   ============================================================ */

/* --- Design Tokens ----------------------------------------- */
:root {
  /* Brand palette */
  --navy:    #24456B;
  --orange:  #F49819;
  --teal:    #00A19A;
  --yellow:  #F5C600;

  /* Semantic */
  --ink:     #10283f;
  --muted:   #5e7790;
  --bg:      #f3f7fa;
  --card:    #ffffff;
  --border:  rgba(36, 69, 107, 0.12);

  /* Typography */
  --font-ui:      'Inter', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;

  /* Spacing scale (8-pt grid) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-12: 3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-card: 0 2px 12px rgba(16, 40, 63, 0.08);
  --shadow-btn:  0 1px 4px rgba(16, 40, 63, 0.15);

  /* Transitions */
  --ease: 0.18s ease;
}

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* El atributo [hidden] debe ganar siempre (si no, clases con display:flex lo anulan) */
[hidden] { display: none !important; }

/* --- Header ------------------------------------------------ */
.cq-header {
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(16, 40, 63, 0.06);
}
/* Línea superior con los colores de la marca (acento, no toca el logo) */
.cq-header::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--navy) 50%, var(--orange) 100%);
}

.cq-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4);
}

.cq-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
}

/* --- Language Switcher ------------------------------------- */
.cq-lang-switcher {
  display: flex;
  gap: var(--sp-2);
}

.cq-lang-btn {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-1) var(--sp-3);
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
  line-height: 1.5;
}

.cq-lang-btn:hover,
.cq-lang-btn[aria-current="true"],
.cq-lang-btn.active {
  color: var(--navy);
  border-color: var(--orange);
  background: rgba(244, 152, 25, 0.12);
}

.cq-lang-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Header actions (logout + lang) */
.cq-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.cq-logout-btn {
  color: var(--navy);
  text-transform: none;
  letter-spacing: 0;
}
.cq-logout-btn:hover {
  color: var(--orange);
  border-color: var(--orange);
  background: rgba(244, 152, 25, 0.10);
}

/* --- Main layout ------------------------------------------- */
.cq-main {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-4) var(--sp-12);
}

/* Wide layout for admin/club views */
@media (min-width: 768px) {
  .cq-main {
    max-width: 1100px;
    padding: var(--sp-8) var(--sp-6) var(--sp-12);
  }
}

/* --- Card -------------------------------------------------- */
.cq-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-6);
}

@media (min-width: 480px) {
  .cq-card {
    padding: var(--sp-8);
  }
}

/* --- Typography -------------------------------------------- */
.cq-display {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.15;
}

h1, h2, h3 {
  color: var(--navy);
  line-height: 1.25;
}

h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h3 { font-size: 1.05rem; }

.cq-muted {
  color: var(--muted);
  font-size: 0.875rem;
}

/* --- Form controls ----------------------------------------- */
.cq-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
}

.cq-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.02em;
}

.cq-input {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  width: 100%;
  transition: border-color var(--ease), box-shadow var(--ease);
  -webkit-appearance: none;
}

.cq-input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.cq-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(36, 69, 107, 0.12);
}

.cq-input:user-invalid {
  border-color: #d9534f;
}

/* --- Buttons ----------------------------------------------- */
.cq-btn {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-6);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  text-decoration: none;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
  box-shadow: var(--shadow-btn);
  line-height: 1.4;
  white-space: nowrap;
}

.cq-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.cq-btn:active {
  transform: translateY(1px);
}

/* Primary — navy with orange hover */
.cq-btn--primary {
  background: var(--navy);
  color: #fff;
}

.cq-btn--primary:hover {
  background: #1b3552;
  box-shadow: 0 4px 14px rgba(36, 69, 107, 0.3);
}

.cq-btn--primary:focus-visible {
  background: var(--navy);
}

/* Accent — orange */
.cq-btn--accent {
  background: var(--orange);
  color: var(--ink);
}

.cq-btn--accent:hover {
  background: #e08710;
}

/* Ghost — outline navy */
.cq-btn--ghost {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border);
  box-shadow: none;
}

.cq-btn--ghost:hover {
  background: rgba(36, 69, 107, 0.06);
  border-color: var(--navy);
}

/* Full width utility */
.cq-btn--full {
  width: 100%;
}

/* --- Links ------------------------------------------------- */
.cq-link {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--ease);
}

.cq-link:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* --- Divider ----------------------------------------------- */
.cq-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

/* --- Utility ----------------------------------------------- */
.cq-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.cq-text-center { text-align: center; }
.cq-mt-2 { margin-top: var(--sp-2); }
.cq-mt-4 { margin-top: var(--sp-4); }
.cq-mt-6 { margin-top: var(--sp-6); }

/* --- Auth: prominent "create club" CTA --------------------- */
.cq-auth-alt {
  margin-top: var(--sp-6);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  text-align: center;
}
.cq-auth-alt__txt {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: var(--sp-3);
}
/* Create — bold orange outline so new users spot it immediately */
.cq-btn--create {
  background: var(--orange);
  color: #1b1206;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(244, 152, 25, 0.32);
}
.cq-btn--create:hover {
  background: #ffae33;
  box-shadow: 0 8px 22px rgba(244, 152, 25, 0.42);
  transform: translateY(-1px);
}

/* --- Admin placeholder (Fase 5 pendiente) ------------------ */
.cq-admin-soon {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
}
.cq-admin-soon__badge {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  margin-bottom: var(--sp-4);
}
.cq-admin-soon p { color: var(--muted); margin-top: var(--sp-2); }

/* --- Collapsible card (details/summary) -------------------- */
.cq-collapse {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-6);
  margin-top: var(--sp-8);
}

.cq-collapse > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  user-select: none;
}

.cq-collapse > summary::-webkit-details-marker {
  display: none;
}

.cq-collapse > summary::before {
  content: '▸';
  display: inline-block;
  transition: transform var(--ease);
  font-size: 0.85em;
  color: var(--orange);
}

.cq-collapse[open] > summary::before {
  transform: rotate(90deg);
}

.cq-collapse > summary + * {
  margin-top: var(--sp-4);
}

/* --- Admin stat cards -------------------------------------- */
.cq-admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.cq-admin-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  text-align: center;
}

.cq-admin-stat-card__value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
}

.cq-admin-stat-card__label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ============================================================
   Admin Dashboard — Fase 7 (KPIs + Tabs + Tables)
   ============================================================ */

/* --- Admin header ------------------------------------------ */
.cq-admin-header {
  margin-bottom: var(--sp-6);
}
.cq-admin-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--navy);
}

/* --- KPI Grid ---------------------------------------------- */
/* 10 cards: 2 col mobile → 5 tablet → balanced desktop      */
.cq-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}
@media (min-width: 480px) {
  .cq-kpi-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
}
@media (min-width: 640px) {
  .cq-kpi-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 900px) {
  .cq-kpi-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 1100px) {
  .cq-kpi-grid { grid-template-columns: repeat(10, 1fr); }
}

.cq-kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--sp-3) var(--sp-2);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border-top: 3px solid var(--navy);
  border-left: none;
  transition: transform var(--ease), box-shadow var(--ease);
  min-width: 0; /* prevent overflow in tight grids */
}
.cq-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16,40,63,0.12);
}
.cq-kpi--navy  { border-top-color: var(--navy); }
.cq-kpi--teal  { border-top-color: var(--teal); }
.cq-kpi--orange{ border-top-color: var(--orange); }
.cq-kpi--yellow{ border-top-color: var(--yellow); }
.cq-kpi--green { border-top-color: #27ae60; }
/* Money accent cards */
.cq-kpi--money { border-top-color: var(--orange); background: rgba(244,152,25,0.06); }
.cq-kpi--amber { border-top-color: #e67e22; background: rgba(230,126,34,0.07); }

.cq-kpi-card__value {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
}
/* Money cards: value in orange, no line-break (prevents "$130 USD" splitting) */
.cq-kpi--money .cq-kpi-card__value { color: var(--orange); white-space: nowrap; font-size: 1rem; }
.cq-kpi--amber .cq-kpi-card__value { color: #d35400; white-space: nowrap; font-size: 1rem; }

.cq-kpi-card__label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

/* --- Tab Navigation ---------------------------------------- */
.cq-tab-nav {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cq-tab-nav::-webkit-scrollbar { display: none; }

.cq-tab-btn {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--ease), border-color var(--ease);
  margin-bottom: -2px;
  letter-spacing: 0.01em;
}
.cq-tab-btn:hover { color: var(--navy); }
.cq-tab-btn.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}
.cq-tab-btn:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* --- Tab Panels -------------------------------------------- */
.cq-tab-panel {
  animation: cq-fadein 0.18s ease;
}
@keyframes cq-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Section title ----------------------------------------- */
.cq-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.cq-admin-section { margin-top: var(--sp-6); }

/* --- Mini bar charts --------------------------------------- */
.cq-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 600px) {
  .cq-charts-grid { grid-template-columns: repeat(2, 1fr); }
}

.cq-mini-chart {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-card);
}
.cq-mini-chart__title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: var(--sp-3);
}
.cq-mini-chart__empty { color: var(--muted); font-size: 0.85rem; }
.cq-mini-chart__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.cq-mini-chart__row {
  display: grid;
  grid-template-columns: 90px 1fr 2rem;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.85rem;
}
.cq-mini-chart__key {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cq-mini-chart__bar {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--navy);
  min-width: 4px;
  transition: width 0.4s ease;
}
.cq-bar--navy   { background: var(--navy); }
.cq-bar--teal   { background: var(--teal); }
.cq-bar--orange { background: var(--orange); }
.cq-bar--yellow { background: var(--yellow); }
.cq-mini-chart__count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

/* --- CSV download row ------------------------------------- */
.cq-dl-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.cq-btn--sm {
  font-size: 0.8rem;
  padding: var(--sp-2) var(--sp-3);
}
.cq-btn--xs {
  font-size: 0.75rem;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
}
/* secondary variant */
.cq-btn--secondary {
  background: rgba(36,69,107,0.08);
  color: var(--navy);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.cq-btn--secondary:hover {
  background: rgba(36,69,107,0.14);
  border-color: var(--navy);
}

/* --- Data tables ------------------------------------------- */
.cq-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  background: var(--card);
}
.cq-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.cq-data-table thead {
  background: var(--navy);
  color: #fff;
}
.cq-data-table thead th {
  padding: var(--sp-3) var(--sp-4);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: left;
  white-space: nowrap;
  color: rgba(255,255,255,0.9);
}
.cq-data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
.cq-data-table tbody tr:last-child { border-bottom: none; }
.cq-data-table tbody tr:nth-child(even) { background: rgba(36,69,107,0.025); }
.cq-data-table tbody tr:hover { background: rgba(244,152,25,0.07); }
.cq-data-table tbody td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--ink);
  vertical-align: middle;
}
.cq-data-table__row--clickable { cursor: pointer; }
.cq-data-table__row--expanded { background: rgba(244,152,25,0.08) !important; }

/* Expand detail row */
.cq-data-table__expand td {
  background: rgba(36,69,107,0.03);
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 2px solid var(--border);
}
.cq-expand-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}
.cq-expand-group strong {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}
.cq-expand-group ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.cq-expand-group li {
  font-size: 0.85rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* --- Status badges ----------------------------------------- */
.cq-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.6;
  white-space: nowrap;
}
.cq-badge--verified  { background: #d4edda; color: #155724; }
.cq-badge--submitted { background: #d1ecf1; color: #0c5460; }
.cq-badge--pending   { background: #fff3cd; color: #856404; }
.cq-badge--rejected  { background: #f8d7da; color: #721c24; }
.cq-badge--role      { background: rgba(36,69,107,0.1); color: var(--navy); }

/* --- Filter row -------------------------------------------- */
.cq-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.cq-filter-input,
.cq-filter-select {
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 280px;
}
.cq-table-search {
  width: 100%;
  margin-bottom: var(--sp-4);
}

/* --- Event filter chips ------------------------------------ */
.cq-event-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.cq-event-chip {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: var(--sp-1) var(--sp-3);
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
}
.cq-event-chip:hover {
  border-color: var(--orange);
  color: var(--navy);
}
.cq-event-chip.active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--ink);
}

/* --- Config form ------------------------------------------- */
.cq-admin-config-form {
  max-width: 480px;
}
.cq-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
}
.cq-form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.02em;
}

/* --- Actions cell ------------------------------------------ */
.cq-data-table td .cq-btn + .cq-btn { margin-left: var(--sp-2); }

/* ============================================================
   Drawer — Fase 8
   ============================================================ */

/* --- Backdrop ---------------------------------------------- */
.cq-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 26, 43, 0.52);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.32s ease;
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  backdrop-filter: blur(6px) saturate(120%);
}

.cq-drawer-backdrop--visible {
  opacity: 1;
}

/* --- Panel -------------------------------------------------- */
.cq-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 100%);
  max-width: 100vw;
  background: var(--card);
  box-shadow: -24px 0 70px rgba(11, 26, 43, 0.30), -1px 0 0 rgba(16, 40, 63, 0.05);
  z-index: 310;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 20px 0 0 20px;
}

.cq-drawer--open {
  transform: translateX(0);
}

/* Mobile: full width */
@media (max-width: 640px) {
  .cq-drawer {
    width: 100%;
    border-radius: 0;
  }
}

/* --- Header ------------------------------------------------- */
.cq-drawer__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: calc(var(--sp-4) + 4px) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(180deg, #fbfdff, var(--card));
}

/* Brand accent bar across the top of the drawer */
.cq-drawer__head::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal, #00A19A), var(--navy, #24456B) 50%, var(--orange, #F49819));
}

.cq-drawer__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
  line-height: 1.3;
  flex: 1 1 auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Close button ------------------------------------------- */
.cq-drawer__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(36, 69, 107, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.25s ease;
  padding: 0;
}

.cq-drawer__close:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  transform: rotate(90deg);
}

.cq-drawer__close:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* --- Body --------------------------------------------------- */
.cq-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-6);
  background: linear-gradient(180deg, var(--card), #fcfdfe);
  -webkit-overflow-scrolling: touch;
}

/* Content fades/rises in once the drawer is open */
.cq-drawer--open .cq-drawer__body {
  animation: cqDrawerContentIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cqDrawerContentIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Custom scrollbar for a more polished feel */
.cq-drawer__body::-webkit-scrollbar { width: 10px; }
.cq-drawer__body::-webkit-scrollbar-thumb {
  background: rgba(36, 69, 107, 0.18);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
.cq-drawer__body::-webkit-scrollbar-thumb:hover { background: rgba(36, 69, 107, 0.32); background-clip: padding-box; }

/* ============================================================
   Club page — How-to instructions block — Fase 8
   ============================================================ */

.cq-how-to {
  background: linear-gradient(135deg, rgba(0,161,154,0.06) 0%, rgba(244,152,25,0.06) 100%);
  border: 1.5px solid rgba(0, 161, 154, 0.22);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
}

.cq-how-to__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: var(--sp-4);
}

.cq-how-to__list {
  list-style: none;
  counter-reset: how-to-step;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: 0;
  margin: 0;
}

.cq-how-to__list li {
  counter-increment: how-to-step;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: 0.925rem;
  color: var(--ink);
  line-height: 1.5;
}

.cq-how-to__list li::before {
  content: counter(how-to-step);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

/* Highlight step 4 — PayPal */
.cq-how-to__step--highlight {
  font-weight: 600;
}

.cq-how-to__step--highlight::before {
  background: var(--orange) !important;
  color: var(--ink) !important;
}

/* ============================================================
   Prominent "Agregar participante" button — Fase 8
   ============================================================ */

.cq-add-btn-wrap {
  margin-bottom: var(--sp-2);
}

.cq-btn--add-participant {
  padding: var(--sp-4) var(--sp-8);
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(244, 152, 25, 0.35);
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
}

.cq-btn--add-participant:hover {
  background: #e08710;
  box-shadow: 0 6px 24px rgba(244, 152, 25, 0.45);
  transform: translateY(-1px);
}

.cq-btn--add-participant:active {
  transform: translateY(0);
}

/* Full width on mobile */
@media (max-width: 540px) {
  .cq-btn--add-participant {
    width: 100%;
  }
}

/* ============================================================
   Responsive — Mobile-first enhancements (Phase 11)
   ============================================================ */

/* --- Charts grid: 1 col on mobile, 2 col on wider ---------- */
@media (max-width: 599px) {
  .cq-charts-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Admin tables: ensure horizontal scroll container ------ */
/* (cq-table-wrap already has overflow-x:auto; this reinforces
   it and prevents the page itself from scrolling horizontally) */
.cq-tab-panel .cq-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Prevent body/page-level horizontal scroll */
body {
  overflow-x: hidden;
}

/* --- Club panel mini-dashboard: 2 cols on narrow mobile ---- */
@media (max-width: 479px) {
  .cq-dash {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* --- Add/Invoice button row: stack on mobile --------------- */
@media (max-width: 479px) {
  .cq-add-btn-wrap {
    flex-direction: column;
  }
  .cq-add-btn-wrap .cq-btn {
    width: 100%;
    justify-content: center;
  }
}

/* --- KPI grid: ensure no page overflow on mobile ----------- */
@media (max-width: 479px) {
  .cq-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cq-kpi-card__value {
    font-size: 1.05rem;
  }
  /* Money cards: keep nowrap but scale down so "$130 USD" fits */
  .cq-kpi--money .cq-kpi-card__value,
  .cq-kpi--amber .cq-kpi-card__value {
    font-size: 0.875rem;
  }
}

/* --- Tab nav: already has overflow-x:auto; ensure buttons
   don't shrink below readable size ----------------------- */
.cq-tab-btn {
  flex-shrink: 0;
}

/* --- Admin filter row: full-width inputs on mobile --------- */
@media (max-width: 479px) {
  .cq-filter-input,
  .cq-filter-select {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .cq-filter-row {
    flex-direction: column;
  }
}

/* --- Payments/Actions cell: wrap buttons on mobile --------- */
.cq-td-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  align-items: center;
}

/* --- Drawer: full-width on mobile (already set, reinforce) -- */
@media (max-width: 479px) {
  .cq-drawer {
    width: 100% !important;
    border-radius: 0 !important;
  }
}

/* --- How-to block: tighten on mobile ----------------------- */
@media (max-width: 479px) {
  .cq-how-to {
    padding: var(--sp-4);
  }
}

/* ============================================================
   Footer + versión + aviso de nueva versión
   ============================================================ */
.cq-footer {
  text-align: center;
  padding: var(--sp-4, 1rem) 0 calc(var(--sp-6, 1.5rem) + env(safe-area-inset-bottom, 0px));
}
.cq-version {
  font-size: 0.75rem;
  color: var(--muted, #5e7790);
  opacity: 0.8;
  letter-spacing: 0.02em;
}
.cq-update-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4, 1rem);
  flex-wrap: wrap;
  padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem);
  background: var(--navy, #24456B);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 -6px 24px rgba(11, 26, 43, 0.28);
}
.cq-update-banner .cq-btn { padding: 0.45rem 1.1rem; }

/* ============================================================
   Selects — aspecto profesional y visible que son desplegables
   ============================================================ */
select.cq-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%2324456B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 20px 20px;
  padding-right: 2.6rem;
  cursor: pointer;
}
/* Cuando no se ha elegido nada (placeholder seleccionado), se ve como pista */
select.cq-input:required:invalid,
select.cq-input.cq-input--placeholder {
  color: var(--muted, #5e7790);
}
select.cq-input option { color: var(--color-text, #1a1a1a); }
select.cq-input option[value=""][disabled] { color: var(--muted, #5e7790); }
