/* ================================================================
   PRISMA · Club de Patinaje Sincronizado — identidad visual
   Tipografías: Montserrat (títulos) + Inter (texto). Auto-alojadas
   (sin Google Fonts) por privacidad/RGPD y para respetar la CSP.
   ================================================================ */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/montserrat-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/montserrat-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/montserrat-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/montserrat-latin-600-normal.woff2') format('woff2'); }
:root {
  --bg: #eef3f8;
  --bg-grad-1: #e7eef6;
  --bg-grad-2: #dfeaf3;
  --surface: #ffffff;
  --surface-2: #f6f9fc;
  --border: #dbe4ee;
  --border-strong: #c3d2e2;
  --text: #16222e;
  --text-soft: #51637a;
  --text-faint: #8496a9;
  --primary: #3457d5;
  --primary-dark: #24409e;
  --primary-soft: #e5ecfb;
  --accent: #17b4c4;      /* cian hielo */
  --ok: #1f9d63;
  --ok-soft: #e2f5ec;
  --warn: #d98a00;
  --warn-soft: #fbf0d9;
  --danger: #d6455d;
  --danger-soft: #fbe4e8;
  --sapphire: #4d6bff;
  --mirum: #2fa58d;
  --fusion: #b97845;
  --shadow: 0 1px 2px rgba(22,34,46,.06), 0 8px 24px rgba(22,34,46,.06);
  --shadow-sm: 0 1px 2px rgba(22,34,46,.08);
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, var(--bg-grad-1), transparent),
              radial-gradient(900px 500px at -10% 10%, var(--bg-grad-2), transparent),
              var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 246px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, #162235, #0e1626);
  color: #cdd8ea;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(52,87,213,.4);
  flex: 0 0 auto;
}
.brand .logo svg { width: 24px; height: 24px; }
.brand .title { line-height: 1.15; }
.brand .title b { color: #fff; font-size: 17px; display: block; letter-spacing: 4px; font-weight: 500; font-family: var(--font-display); }
.brand .title .brand-word { height: 15px; width: auto; display: block; margin-bottom: 3px; }
.brand .title span { color: #8ba0c2; font-size: 10px; letter-spacing: 1px; font-family: var(--font-display); font-weight: 400; }
.brand-mark { height: 28px; width: auto; display: block; flex: 0 0 auto; }
/* Logo oficial completo (inline SVG) para páginas claras */
.brand-logo { width: 100%; max-width: 270px; height: auto; display: block; margin: 0 auto; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  color: #b9c6dc; font-size: 14.5px; font-weight: 500;
  border: 1px solid transparent; transition: background .12s, color .12s;
}
.nav-item svg { width: 19px; height: 19px; opacity: .85; flex: 0 0 auto; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(52,87,213,.28); color: #fff; border-color: rgba(120,150,240,.35); }
/* Contador de comunicaciones sin leer en el menú lateral */
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  min-width: 18px; padding: 3px 5px; border-radius: 999px; text-align: center;
}
.sidebar .spacer { flex: 1; }

/* --- Comunicaciones: hilos y burbujas ---------------------------------- */
.hilo-item {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border);
  background: none; cursor: pointer; font: inherit; color: inherit;
}
.hilo-item:hover { background: var(--surface-2); }
.hilo-item.on { background: var(--primary-soft); }
.hilo-item.sinleer .hilo-asunto { font-weight: 700; }
.hilo-punto { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: transparent; }
.hilo-item.sinleer .hilo-punto { background: var(--danger); }
.hilo-cuerpo { min-width: 0; flex: 1; }
.hilo-asunto { font-size: 13.5px; margin-bottom: 2px; }
.hilo-prev { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hilo-meta { font-size: 11px; color: var(--text-faint); white-space: nowrap; }

.chat { display: flex; flex-direction: column; gap: 10px; padding: 4px; max-height: 46vh; overflow-y: auto; }
.burbuja { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.burbuja .quien { font-size: 11px; font-weight: 600; opacity: .75; margin-bottom: 3px; }
.burbuja .cuando { font-size: 10.5px; opacity: .6; margin-top: 5px; }
.burbuja.club { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.burbuja.mia { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.burbuja.mia .quien, .burbuja.mia .cuando { opacity: .85; }
.sidebar .foot { font-size: 11px; color: #6f83a5; padding: 8px; line-height: 1.5; }

.main { padding: 30px 38px 60px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-weight: 600; font-size: 27px; margin: 0 0 3px; letter-spacing: .2px; }
.page-head p { margin: 0; color: var(--text-soft); font-size: 14px; }

/* ---------- Cards & tiles ---------- */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .cols-4 { grid-template-columns: repeat(2,1fr);} .cols-3,.cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }

.tile { position: relative; overflow: hidden; }
.tile .label { color: var(--text-soft); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.tile .value { font-size: 30px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--text-faint); font-size: 12.5px; margin-top: 2px; }
.tile .ico { position: absolute; top: 16px; right: 16px; width: 26px; height: 26px; opacity: .18; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft);
  white-space: nowrap;
}
.badge.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.b-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.b-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.b-info { background: var(--primary-soft); color: var(--primary-dark); border-color: transparent; }
.b-muted { background: #eef2f7; color: var(--text-faint); border-color: transparent; }
.team-chip { color:#fff; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text-soft); font-weight: 600; font-size: 12px;
     text-transform: uppercase; letter-spacing: .3px; padding: 10px 12px; border-bottom: 2px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
tbody tr { cursor: default; }
tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn-danger:hover { background: #f7d4da; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: 9px; font-size: 14px; font-family: inherit; color: var(--text);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 64px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 680px) { .row-2, .row-3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; padding: 7px 0; }
.check input { width: auto; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .grow { flex: 1; min-width: 160px; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); }
.search input { padding-left: 34px; }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); font-weight: 700; margin: 22px 0 10px; }
.muted { color: var(--text-faint); }
.hr { height: 1px; background: var(--border); border: 0; margin: 20px 0; }
.empty { text-align: center; color: var(--text-faint); padding: 40px 20px; }
.empty svg { width: 44px; height: 44px; opacity: .4; margin-bottom: 8px; }

/* ---------- Alertas ---------- */
.alert { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; margin-bottom: 10px; font-size: 14px; }
.alert.alta { background: var(--danger-soft); color: #97253a; }
.alert.media { background: var(--warn-soft); color: #8a5a00; }
.alert.info { background: var(--primary-soft); color: var(--primary-dark); }
.alert svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }

/* ---------- Progress / bars ---------- */
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16,26,45,.5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px rgba(10,20,40,.35);
  width: 100%; max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 19px; font-family: var(--font-display); }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot .right { display: flex; gap: 10px; margin-left: auto; }
.x { cursor: pointer; color: var(--text-faint); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.x:hover { background: var(--surface-2); color: var(--text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 9px 14px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--primary); border-color: var(--primary); }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #16222e; color: #fff; padding: 11px 18px; border-radius: 11px; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; font-size: 14px; }
.dl dt { color: var(--text-soft); font-weight: 600; }
.dl dd { margin: 0; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar .spacer, .sidebar .foot { display: none; }
  .brand { width: 100%; padding-bottom: 10px; }
  .main { padding: 20px; }
}

/* ---------- Control segmentado (vista) ---------- */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 8px 15px; font-size: 13.5px; font-weight: 600; color: var(--text-soft); cursor: pointer; font-family: inherit; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary); color: #fff; }

/* ---------- Chips de día de la semana ---------- */
.daychip { position: relative; cursor: pointer; }
.daychip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.daychip span { display: inline-block; padding: 7px 11px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-soft); }
.daychip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Calendario mensual ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; text-transform: capitalize; min-width: 165px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { margin-bottom: 6px; }
.cal-downame { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px; }
.cal-cell { min-height: 98px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; cursor: pointer; transition: background .1s; overflow: hidden; }
.cal-cell:hover { background: var(--surface-2); }
.cal-out { background: transparent; border: 0; cursor: default; }
.cal-out:hover { background: transparent; }
.cal-today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-day { font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }
.cal-today .cal-day { color: var(--primary); }
.cal-ev { font-size: 11px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; font-weight: 500; }
.cal-ev:hover { filter: brightness(.96); }
@media (max-width: 720px) {
  .cal-cell { min-height: 66px; padding: 4px; }
  .cal-ev { font-size: 9.5px; padding: 1px 4px; }
  .cal-title { min-width: 120px; font-size: 16px; }
}

/* Selector de idioma ES/EN (disponible también fuera de la web pública) */
.lang-switch { display: inline-flex; border: 1px solid #d5deea; border-radius: 999px; overflow: hidden; flex: 0 0 auto; }
.lang-switch button { border: 0; background: transparent; font-family: var(--font-display, 'Montserrat'), sans-serif; font-weight: 600; font-size: 12.5px; letter-spacing: .5px; padding: 6px 11px; cursor: pointer; color: #5a6a7e; line-height: 1; }
.lang-switch button.active { background: #3457d5; color: #fff; }
.lang-switch button:focus-visible { outline: 2px solid #3457d5; outline-offset: 1px; }
.lang-fixed { position: fixed; top: 14px; right: 14px; z-index: 100; background: #fff; box-shadow: 0 2px 10px rgba(22,34,53,.12); }

/* Espacio compartido: miniaturas + lightbox */
.rec-thumb { width: 52px; height: 52px; border-radius: 9px; background: #eef2f6; color: #8a99ab; vertical-align: middle; flex: 0 0 auto; }
img.rec-thumb { display: inline-block; object-fit: cover; cursor: zoom-in; box-shadow: 0 1px 4px rgba(22,34,53,.15); }
.rec-thumb-doc { display: inline-grid; place-items: center; }
.rec-thumb-doc svg { width: 22px; height: 22px; }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(10,15,25,.88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .lb-cap { position: fixed; bottom: 18px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; }
