/* ==========================================================
   SPOTTER - app.css
   Estilos base + sistema de temas mediante variables CSS
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&display=swap');

:root,
[data-theme="lime"] {
    --bg: #121416;
    --surface: #1F2224;
    --surface-elevated: #292D30;
    --primary: #7ED321;
    --secondary: #A7F044;
    --text: #FFFFFF;
    --text-secondary: #AEB5BA;
    --border: rgba(255, 255, 255, 0.08);
    --danger: #FF4F4F;
    --success: #7ED321;
    --warning: #F5B942;
    --bg-image: url('../img/backgrounds/bg-lime.jpg');
}

[data-theme="rose"] {
    --bg: #171318;
    --surface: #241B22;
    --surface-elevated: #30232C;
    --primary: #FF4F8B;
    --secondary: #FFB3CE;
    --text: #FFFFFF;
    --text-secondary: #CDBCC6;
    --border: rgba(255, 255, 255, 0.08);
    --danger: #FF4F4F;
    --success: #7ED321;
    --warning: #F5B942;
    --bg-image: url('../img/backgrounds/bg-rose.jpg');
}

[data-theme="blue"] {
    --bg: #101722;
    --surface: #182337;
    --surface-elevated: #21304A;
    --primary: #3B82F6;
    --secondary: #22D3EE;
    --text: #FFFFFF;
    --text-secondary: #B6C2D5;
    --border: rgba(255, 255, 255, 0.08);
    --danger: #FF4F4F;
    --success: #7ED321;
    --warning: #F5B942;
    --bg-image: url('../img/backgrounds/bg-blue.jpg');
}

* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

html, body {
    margin: 0;
    padding: 0;
    /* El scroll real ahora ocurre adentro de .app-shell (ver más abajo),
       no en html/body — así evitamos el bug de iOS/Safari donde
       'overscroll-behavior: none' en el body rompe el scroll con
       inercia nativo. Al no ser html/body los que scrollean, tampoco
       pueden "estirarse" (no hay overflow que rebotar), sin necesidad
       de esa propiedad conflictiva. */
    height: 100%;
    overflow: hidden;
}

body {
    position: relative;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease;
}

/* El fondo temático va en un pseudo-elemento con position:fixed propio,
   en vez de background-attachment:fixed en el body — ese truco tiene
   soporte poco confiable en Safari de iPhone y hacía que el fondo se
   "moviera" o mostrara huecos al arrastrar la pantalla. */
body::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
}

/* El contenido real siempre debe quedar por encima del fondo fijo. */

h1, h2, h3, .heading-fitness {
    font-family: 'Bebas Neue', 'Inter', sans-serif;
    letter-spacing: 0.5px;
    font-weight: 400;
    margin: 0 0 8px 0;
    line-height: 1.1;
}

h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }

p { margin: 0 0 12px 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.app-shell {
    display: flex;
    align-items: flex-start;
    height: 100dvh;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Acá SÍ es seguro usar 'none': al no ser el body/html quien
       scrollea, no dispara el bug de iOS/Safari que corta el scroll con
       inercia. Elimina el estiramiento visible sin sacrificar fluidez. */
    overscroll-behavior-y: none;
}

/* Las páginas del panel de admin no usan .app-shell (no tienen sidebar
   ni bottom-nav) — van directo <body><main class="app-main">. Como
   html/body ya no scrollean (ver arriba), estas páginas necesitan su
   propio contenedor de scroll, igual que .app-shell pero sin el sidebar. */
.admin-page-body {
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
    display: block;
}

.app-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 20px 16px 110px 16px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0 20px 0;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar__brand img { height: 44px; }
.topbar__brand-fallback {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: var(--text);
}
.topbar__brand-fallback span { color: var(--primary); }

/* ---------- Sidebar (desktop) ---------- */

.sidebar {
    display: none;
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
    padding: 0 8px;
}

.sidebar__brand img { height: 34px; }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.sidebar__link:hover {
    background: var(--surface-elevated);
    text-decoration: none;
    color: var(--text);
}

.sidebar__link.active {
    background: var(--surface-elevated);
    color: var(--primary);
}

.sidebar__icon { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar__footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ---------- Bottom nav (mobile) — dock flotante ---------- */

.bottom-nav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0));
    max-width: 1072px;
    margin: 0 auto;
    display: flex;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 50;
    padding: 6px;
}

.bottom-nav__link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 600;
    min-height: 54px;
    border-radius: 20px;
}

.bottom-nav__link:hover { text-decoration: none; }

.bottom-nav__link.active { color: var(--primary); }

.bottom-nav__icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 28px;
    border-radius: 14px;
    transition: background 0.15s ease;
}

.bottom-nav__link.active .bottom-nav__icon-wrap {
    background: rgba(255, 255, 255, 0.14);
}

.bottom-nav__icon { width: 22px; height: 22px; }

/* ---------- Acordeón genérico ---------- */

.accordion-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    cursor: pointer;
}

.accordion-header h3 { margin: 0; }

.accordion-chevron {
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
    margin-left: 10px;
}

.accordion-body {
    padding: 0 18px 18px 18px;
}

.accordion-body.collapsed { display: none; }

/* ---------- Acordeón de comidas (Nutrición) ---------- */

.meal-accordion-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 8px;
    overflow: hidden;
}

.meal-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    cursor: pointer;
}

.meal-accordion-header__label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    letter-spacing: 0.3px;
}

.meal-accordion-chevron {
    color: var(--text-secondary);
    font-size: 12px;
    width: 14px;
    text-align: center;
}

.meal-accordion-body {
    padding: 0 16px 14px 16px;
}

/* ---------- Reproductor de ejercicio (entrenamiento activo) ---------- */

.exercise-player {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 320px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface-elevated);
    margin-top: 10px;
}

#exercise-media-wrap {
    width: 100%;
    height: 100%;
    position: relative;
}

#exercise-photo, #exercise-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exercise-player__play-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#rest-ring-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--surface);
}

.rest-ring {
    width: 78%;
    max-width: 240px;
    transform: rotate(-90deg);
}

.rest-ring__bg {
    fill: none;
    stroke: var(--surface-elevated);
    stroke-width: 10;
}

.rest-ring__progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 552.9; /* 2 * PI * 88 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.25s linear;
}

.rest-ring__center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.rest-ring__time {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 44px;
    color: var(--text);
    line-height: 1;
}

.rest-ring__label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

#rest-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 14px;
}

/* ---------- Barra de días (Entreno) ---------- */

.day-pill-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 2px 14px 2px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.day-pill-bar::-webkit-scrollbar { display: none; }

.day-pill {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 4px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.day-pill__label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.day-pill__date {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    color: var(--text);
}

.day-pill__dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 1px;
    visibility: hidden;
}

.day-pill.has-exercises .day-pill__dot { visibility: visible; }

.day-pill.active {
    background: #FFFFFF;
    border-color: #FFFFFF;
    transform: translateY(-2px);
}

.day-pill.active .day-pill__label,
.day-pill.active .day-pill__date { color: #10120f; }

.day-pill.active .day-pill__dot { background: #10120f; }

/* ---------- Tarjetas ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
}

.card--elevated {
    background: var(--surface-elevated);
}

.card--compact {
    padding: 14px 16px;
    margin-bottom: 12px;
}

.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* ---------- Botones ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: #10120f;
}

.btn-secondary {
    background: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-block { width: 100%; }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    min-height: auto;
    padding: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

/* ---------- Formularios ---------- */

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    font-family: 'Inter', sans-serif;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.field-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* ---------- Tarjeta moderna de subida de foto/video (con vista previa real) ---------- */

.media-upload-card {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-upload-card__preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-upload-card__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12.5px;
    text-align: center;
    padding: 0 20px;
}

.media-upload-card__placeholder-icon {
    font-size: 30px;
    opacity: 0.55;
}

.media-upload-card__overlay-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(10, 11, 12, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s ease;
}

.media-upload-card__overlay-btn:active { transform: scale(0.95); }
.media-upload-card__overlay-btn input[type="file"] { display: none; }

.media-upload-card__remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(10, 11, 12, 0.78);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
}

.media-upload-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ---------- Nutri IA: identidad visual del asistente nutricional ---------- */

.nutri-ia-card {
    position: relative;
    background: linear-gradient(150deg, rgba(126,211,33,0.14), var(--surface-elevated) 55%);
    border: 1px solid rgba(126,211,33,0.35);
    border-radius: 16px;
    padding: 16px;
    overflow: hidden;
}

.nutri-ia-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(126,211,33,0.25), transparent 70%);
    pointer-events: none;
}

.nutri-ia-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    margin-bottom: 8px;
}

.nutri-ia-badge__icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4a9e0a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(126,211,33,0.5);
}

.nutri-ia-card__title {
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 3px 0;
}

.nutri-ia-card__subtitle {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

/* Estado "pensando": puntitos animados en vez de un spinner plano */
.nutri-ia-thinking {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.nutri-ia-thinking.active { display: flex; }

.nutri-ia-thinking__icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4a9e0a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    animation: nutriIaPulse 1.4s ease-in-out infinite;
}

@keyframes nutriIaPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(126,211,33,0.5); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(126,211,33,0); }
}

.nutri-ia-thinking__dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    margin-left: 2px;
    animation: nutriIaDot 1.2s infinite;
}

.nutri-ia-thinking__dots span:nth-child(2) { animation-delay: 0.2s; }
.nutri-ia-thinking__dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes nutriIaDot {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.nutri-ia-resultado-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    background: rgba(126,211,33,0.12);
    border: 1px solid rgba(126,211,33,0.3);
    padding: 3px 9px;
    border-radius: 999px;
}

/* ---------- Tarjeta de análisis nutricional (lista con íconos + índice) ---------- */

.nutri-analisis {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-top: 10px;
}

.nutri-analisis__header {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.nutri-analisis__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

.nutri-analisis__row:last-of-type { border-bottom: none; }

.nutri-analisis__icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nutri-analisis__label { flex: 1; font-size: 13.5px; color: var(--text-secondary); }
.nutri-analisis__value { font-size: 13.5px; font-weight: 700; }

.nutri-analisis__indice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.nutri-analisis__indice-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }

.nutri-analisis__indice-badge {
    font-size: 13px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 999px;
    color: #10120f;
}

/* ---------- Resumen semanal moderno (índice + estados + recomendación) ---------- */

.nutri-semanal-indice {
    text-align: center;
    padding: 6px 0 14px 0;
}

.nutri-semanal-indice__numero { font-size: 40px; font-weight: 800; line-height: 1; }
.nutri-semanal-indice__sobre { font-size: 16px; color: var(--text-secondary); font-weight: 600; }
.nutri-semanal-indice__label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

.nutri-estado-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.nutri-estado-row:last-child { border-bottom: none; }
.nutri-estado-row__icon { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.nutri-estado-row__label { flex: 1; font-size: 14px; }
.nutri-estado-row__valor { font-size: 13px; font-weight: 700; }

.nutri-recomendacion-card {
    background: linear-gradient(150deg, rgba(126,211,33,0.12), var(--surface-elevated));
    border: 1px solid rgba(126,211,33,0.3);
    border-radius: 14px;
    padding: 14px 16px;
    margin-top: 14px;
}

.nutri-recomendacion-card__titulo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.nutri-recomendacion-card__texto { font-size: 13.5px; line-height: 1.5; margin: 0; }

/* ---------- Tarjeta de comida ya cargada (dentro de cada acordeón: Desayuno, Almuerzo...) ---------- */

.meal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.meal-row:last-of-type { border-bottom: none; }

.meal-row__thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.meal-row__info { flex: 1; min-width: 0; }

.meal-row__name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meal-row__name--completada { text-decoration: line-through; opacity: 0.55; }

.meal-row__meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meal-row__actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.meal-row__check {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.meal-row__check--completada {
    background: var(--primary);
    border-color: var(--primary);
    color: #10120f;
}


.field.has-error input {
    border-color: var(--danger);
}

.field.has-error .field-error {
    display: block;
}

.field-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ---------- Mostrar/ocultar contraseña ---------- */

.password-field-wrapper {
    position: relative;
}

.password-field-wrapper input {
    padding-right: 46px;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.password-toggle-btn:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}

.password-toggle-btn svg {
    width: 20px;
    height: 20px;
}

/* ---------- Selector de tema (tarjetas) ---------- */

.theme-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.theme-option {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    text-align: center;
    background: var(--surface-elevated);
}

.theme-option.selected {
    border-color: var(--primary);
}

.theme-swatch {
    height: 36px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.theme-option[data-theme-option="lime"] .theme-swatch { background: linear-gradient(90deg, #7ED321, #A7F044); }
.theme-option[data-theme-option="rose"] .theme-swatch { background: linear-gradient(90deg, #FF4F8B, #FFB3CE); }
.theme-option[data-theme-option="blue"] .theme-swatch { background: linear-gradient(90deg, #3B82F6, #22D3EE); }

.theme-option span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ---------- Toasts ---------- */

#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    left: 16px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    color: var(--text);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    animation: toast-in 0.2s ease;
    pointer-events: auto;
}

.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-success { border-left-color: var(--success); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Estados vacíos ---------- */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state h3 { color: var(--text); }

/* ---------- Utilidades ---------- */

.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }

/* ---------- Tabla moderna (paneles de admin) ---------- */

.admin-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    white-space: nowrap;
}

.admin-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 700;
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

.admin-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s ease;
}

.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--surface-elevated); }

.admin-table td {
    padding: 12px 16px;
    vertical-align: middle;
    white-space: normal;
}

.admin-table td.nowrap { white-space: nowrap; }

.admin-table__primary { font-weight: 600; }
.admin-table__secondary { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

.admin-table__empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .admin-table { font-size: 12.5px; }
    .admin-table thead th, .admin-table td { padding: 10px 12px; }
}

/* ---------- Perfil moderno (portada + avatar + stats + grid de posts) ---------- */

.profile-cover-wrap {
    position: relative;
    margin: -20px -16px 56px -16px;
}

.profile-cover {
    height: 150px;
    background: linear-gradient(160deg, var(--primary), var(--secondary, var(--primary)));
    background-size: cover;
    background-position: center;
}

.profile-avatar-wrap {
    position: absolute;
    left: 50%;
    bottom: -44px;
    transform: translateX(-50%);
}

.profile-avatar,
.profile-avatar--fallback {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg);
    background: var(--surface-elevated);
    display: block;
}

.profile-avatar--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 34px;
    color: var(--primary);
}

.profile-avatar-edit-btn {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #10120f;
    border: 3px solid var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.profile-info { text-align: center; margin-bottom: 18px; }
.profile-info h2 { margin: 0 0 2px 0; }
.profile-info__username { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 10px 0; }
.profile-info__bio { font-size: 13.5px; line-height: 1.5; max-width: 340px; margin: 0 auto 16px auto; white-space: pre-line; }

.profile-stats-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 16px;
}

.profile-stats-row__item { text-align: center; cursor: default; }
.profile-stats-row__item strong { display: block; font-size: 18px; }
.profile-stats-row__item span { font-size: 11.5px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }

.profile-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-top: 8px;
}

.profile-posts-grid__tile {
    aspect-ratio: 1;
    background: var(--surface-elevated);
    background-size: cover;
    background-position: center;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: none;
}

.profile-posts-grid__tile--text {
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-secondary);
    text-align: left;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
}

.profile-posts-grid__empty {
    grid-column: 1 / -1;
    padding: 30px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--surface-elevated);
    color: var(--primary);
    border: 1px solid var(--border);
}

/* ---------- Selector de pestañas (login/registro, y tabs dentro de la
   app como "Gimnasios / Profesionales" en el directorio) ---------- */

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--surface-elevated);
    padding: 4px;
    border-radius: 12px;
}

.auth-tab {
    text-align: center;
    padding: 10px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: transparent;
}

.auth-tab.active {
    background: var(--primary);
    color: #10120f;
}

.auth-tabs--sub {
    margin-bottom: 10px;
}

.auth-tabs--sub .auth-tab {
    font-size: 12px;
    padding: 8px 6px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Modal / bottom sheet ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
}

.modal-box__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.modal-close {
    background: var(--surface-elevated);
    border: none;
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}

@media (min-width: 640px) {
    .modal-overlay { align-items: center; }
    .modal-box { border-radius: 20px; }
}

/* ---------- Editor de rutinas ---------- */

.day-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
}

.day-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.day-card__title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 0.5px;
}

.day-rest-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.exercise-card-modern {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 76px;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 8px;
    overflow: hidden;
    background-color: var(--surface-elevated);
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border);
}

/* Cuando el ejercicio tiene foto propia: va de fondo, con un degradado
   oscuro encima para que el texto se siga leyendo bien — nunca la foto
   sola, sin overlay, porque ahí es donde se pone confuso. */
.exercise-card-modern--con-foto::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(10,11,12,0.88) 35%, rgba(10,11,12,0.45) 100%);
    z-index: 0;
}

/* Sin foto: el ícono del grupo muscular queda grande de fondo, como
   marca de agua tenue — mantiene la misma sensación de "tarjeta con
   imagen" sin depender de que el profe haya cargado una foto. */
.exercise-card-modern__icon-watermark {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 52px;
    opacity: 0.16;
    z-index: 0;
    line-height: 1;
    pointer-events: none;
}

.exercise-card-modern__info {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.exercise-card-modern__category {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 2px;
}

.exercise-card-modern__name {
    font-weight: 700;
    font-size: 14.5px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exercise-card-modern__meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.exercise-card-modern--con-foto .exercise-card-modern__meta { color: rgba(255,255,255,0.75); }

.exercise-card-modern__actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.day-categorias-resumen {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin: -4px 0 12px 0;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { color: var(--text); }

.exercise-lib-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid transparent;
}

.exercise-lib-item:hover { background: var(--surface-elevated); }

.exercise-lib-categoria {
    font-size: 13px;
    color: var(--primary);
    margin: 18px 0 4px 0;
    font-weight: 800;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.exercise-lib-categoria:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.exercise-lib-group {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 14px 0 6px 0;
    font-weight: 700;
}

/* ---------- Grilla de estadísticas compactas (dashboard, resúmenes) ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-tile__icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.stat-tile__value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    letter-spacing: 0.5px;
    line-height: 1;
    color: var(--text);
}

.stat-tile__value small {
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
}

.stat-tile__label {
    font-size: 10.5px;
    color: var(--text-secondary);
    line-height: 1.3;
}

@media (min-width: 640px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .stat-tile { padding: 18px 12px; }
    .stat-tile__value { font-size: 28px; }
    .stat-tile__label { font-size: 11.5px; }
}

/* ---------- Tarjeta "vidrio" (glassmorphism), para usar sobre el fondo temático ---------- */

.glass-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    margin-bottom: 16px;
}

/* ---------- Carta de rendimiento (estilo FIFA) ---------- */

.rating-badge {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: linear-gradient(160deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.rating-badge span {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 30px;
    color: #10120f;
}

.rating-badge.tier-elite { background: linear-gradient(160deg, #FFD700, #FFA500); }
.rating-badge.tier-muy-bueno { background: linear-gradient(160deg, var(--primary), var(--secondary)); }
.rating-badge.tier-bueno { background: linear-gradient(160deg, #3B82F6, #22D3EE); }
.rating-badge.tier-regular { background: linear-gradient(160deg, #F5B942, #FFD98A); }
.rating-badge.tier-a-mejorar { background: linear-gradient(160deg, #FF4F4F, #FF8F8F); }

.rating-attrs {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rating-attr {
    display: grid;
    grid-template-columns: 34px 1fr 40px;
    align-items: center;
    gap: 10px;
}

.rating-attr__label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.rating-attr__bar {
    background: var(--surface-elevated);
    border-radius: 999px;
    height: 7px;
    overflow: hidden;
}

.rating-attr__bar > div {
    background: var(--primary);
    height: 100%;
    transition: width 0.4s ease;
}

.rating-attr__value {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.period-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
    flex-shrink: 0;
}

.period-btn-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.period-btn-row::-webkit-scrollbar {
    display: none;
}

.period-btn.active {
    background: var(--primary);
    color: #10120f;
    border-color: transparent;
}

/* ---------- Banners publicitarios ---------- */

.ad-banner {
    display: block;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0 16px 0;
    border: 1px solid var(--border);
    max-height: 120px;
}

.ad-banner img {
    width: 100%;
    height: 100%;
    max-height: 120px;
    object-fit: cover;
    display: block;
}

.ad-banner__label {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.5);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ---------- Editor de contenido enriquecido (Quill) ---------- */

.rich-editor {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}

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

.rich-editor .ql-container.ql-snow {
    border: none;
    font-family: inherit;
    font-size: 14px;
    min-height: 160px;
}

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

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

.rich-editor .ql-editor a {
    color: var(--primary);
}

.rich-editor .ql-stroke {
    stroke: var(--text-secondary);
}

.rich-editor .ql-fill {
    fill: var(--text-secondary);
}

.rich-editor .ql-picker-label {
    color: var(--text-secondary);
}

.rich-editor .ql-toolbar button:hover .ql-stroke,
.rich-editor .ql-toolbar button.ql-active .ql-stroke,
.rich-editor .ql-toolbar .ql-picker-label:hover {
    stroke: var(--primary);
}

.rich-editor .ql-toolbar button:hover .ql-fill,
.rich-editor .ql-toolbar button.ql-active .ql-fill {
    fill: var(--primary);
}

.rich-editor .ql-picker-options {
    background: var(--surface-elevated);
    border: 1px solid var(--border) !important;
}

.rich-editor .ql-snow .ql-tooltip {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.rich-editor .ql-snow .ql-tooltip input[type="text"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

/* Estilos del contenido ya publicado (vista de detalle) */
.rich-content {
    overflow-wrap: break-word;
}
.rich-content h2 { font-size: 19px; margin: 18px 0 8px; }
.rich-content h3 { font-size: 16px; margin: 16px 0 6px; }
.rich-content p { margin: 0 0 12px; line-height: 1.6; }
.rich-content ul, .rich-content ol { margin: 0 0 12px; padding-left: 22px; }
.rich-content li { margin-bottom: 4px; line-height: 1.5; }
.rich-content blockquote {
    border-left: 3px solid var(--primary);
    margin: 0 0 12px;
    padding: 4px 0 4px 14px;
    color: var(--text-secondary);
}
.rich-content img {
    max-width: 100%;
    border-radius: 10px;
    margin: 8px 0 14px;
    display: block;
}
.rich-content a { color: var(--primary); }

/* ---------- Campanita de notificaciones ---------- */

.notif-bell-btn {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-bell-btn:hover {
    color: var(--text);
}

.notif-bell-btn--sidebar {
    padding: 4px;
}

.notif-bell-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #FFFFFF;
    font-size: 9.5px;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

.notif-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
}

.notif-panel-overlay.hidden { display: none; }

.notif-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 301;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.4);
}

.notif-panel.hidden { display: none; }

.notif-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.notif-panel__header h3 { margin: 0; font-size: 16px; }

.notif-panel__list {
    overflow-y: auto;
    flex: 1;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 13px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    text-align: left;
    cursor: pointer;
    color: var(--text);
}

.notif-item:hover { background: var(--surface-elevated); }

.notif-item--no-leida { background: rgba(126, 211, 33, 0.06); }

.notif-item__icon { font-size: 18px; flex-shrink: 0; line-height: 1.3; }

.notif-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.notif-item__mensaje { font-size: 13.5px; line-height: 1.4; }

.notif-item__tiempo { font-size: 11px; color: var(--text-secondary); }

.notif-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 4px;
}

@media (min-width: 480px) {
    .notif-panel { border-radius: 0; }
}

/* ---------- Etiqueta de cohorte de lanzamiento (pionero / beta) ---------- */

.cohort-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    margin-top: 5px;
    white-space: nowrap;
}

.cohort-badge--pionero {
    background: rgba(255, 200, 40, 0.15);
    color: #FFC828;
    border: 1px solid rgba(255, 200, 40, 0.35);
}

.cohort-badge--beta {
    background: rgba(126, 211, 33, 0.15);
    color: var(--primary);
    border: 1px solid rgba(126, 211, 33, 0.35);
}

.cohort-badge--admin {
    background: rgba(255, 80, 80, 0.15);
    color: #FF6B6B;
    border: 1px solid rgba(255, 80, 80, 0.35);
}

.cohort-badge--master {
    background: rgba(180, 140, 255, 0.15);
    color: #B48CFF;
    border: 1px solid rgba(180, 140, 255, 0.35);
}

/* ---------- Carrusel de contenido destacado (Home) ---------- */

.content-slides {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 4px;
}

.content-slides::-webkit-scrollbar { height: 6px; }
.content-slides::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.content-slide {
    flex: 0 0 auto;
    width: 128px;
    scroll-snap-align: start;
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-elevated);
    transition: transform 0.15s ease;
}

.content-slide:active { transform: scale(0.98); }

.content-slide__image {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--surface);
    background-size: cover;
    background-position: center;
    position: relative;
}

.content-slide__type {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #10120f;
    background: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.content-slide__body {
    padding: 7px 8px 8px;
}

.content-slide__title {
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 28px;
}

.content-slide__resumen {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-slide__author {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 9.5px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    padding-top: 6px;
    line-height: 1.2;
}

.content-slide__author img,
.content-slide__author-fallback {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.content-slide__author-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--primary);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 9px;
}

.content-slide__author span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Feed social ---------- */

.feed-composer {
    display: flex;
    gap: 10px;
}

.feed-composer__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-elevated);
}

.feed-composer__body { flex: 1; min-width: 0; }

.feed-composer textarea {
    width: 100%;
    resize: none;
    border-radius: 16px;
    padding: 12px 16px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    min-height: 56px;
}

.feed-composer textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.feed-composer__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.feed-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.feed-photo-preview {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    margin: 10px 0;
    max-height: 260px;
}

.feed-photo-preview img { width: 100%; max-height: 260px; object-fit: cover; display: block; }

.feed-photo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tarjeta de publicación (misma base que .card, sin padding lateral para que la foto llegue al borde) */
.feed-post {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
}

.feed-post__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px 16px;
}

.feed-post__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    color: var(--primary);
    font-size: 18px;
}

.feed-post__name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.feed-post__meta { font-size: 12px; color: var(--text-secondary); }

.feed-post__delete {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
}
.feed-post__delete:hover { background: var(--surface-elevated); color: var(--danger, #FF4F4F); }

.feed-post__text {
    padding: 0 16px 12px 16px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.feed-post__image {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
    display: block;
}

.feed-post__actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.feed-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.feed-action-btn:hover { background: rgba(255,255,255,0.06); }

.feed-action-btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.feed-action-btn.is-liked {
    color: #FF4F8B;
    border-color: rgba(255,79,140,0.35);
    background: rgba(255,79,140,0.08);
}

.feed-comments {
    padding: 4px 16px 14px 16px;
    border-top: 1px solid var(--border);
}

.feed-comment {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.feed-comment__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    color: var(--primary);
    font-size: 12px;
}

.feed-comment__bubble {
    background: var(--surface-elevated);
    border-radius: 14px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
}

.feed-comment__author { font-weight: 700; margin-right: 4px; }
.feed-comment__time { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.feed-comment-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.feed-comment-form input {
    flex: 1;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
}

.feed-comment-form input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.feed-comment-form button {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--primary);
    color: #10120f;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- Accesos rápidos (tarjetas cuadradas) ---------- */

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    aspect-ratio: 1 / 1;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px 6px;
    text-decoration: none;
    color: var(--text);
    text-align: center;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.quick-action-tile:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    text-decoration: none;
    background: var(--surface);
}

.quick-action-tile__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-action-tile__label {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

@media (min-width: 640px) {
    .quick-actions-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .quick-action-tile__icon { width: 46px; height: 46px; }
    .quick-action-tile__label { font-size: 13px; }
}

/* SPOTTER - Gráficos de seguimiento */
.seguimiento-graficos {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 20px;
}

.seguimiento-chart-card {
    min-width: 0;
}

.seguimiento-chart-card h2 {
    margin-bottom: 5px;
}

.seguimiento-chart-wrap {
    position: relative;
    height: 260px;
    width: 100%;
    margin-top: 18px;
}

@media (min-width: 950px) {
    .seguimiento-chart-wrap {
        height: 300px;
    }
}

@media (max-width: 600px) {
    .seguimiento-chart-wrap {
        height: 220px;
    }
}


/* SPOTTER - Mejoras del panel de notificaciones */
.notif-panel__header {
    position: relative;
    padding-right: 65px;
    padding-top: max(18px, env(safe-area-inset-top));
    min-height: 65px;
}

.notif-panel__close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary, #ffffff);
    font-size: 21px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.notif-panel__close:active {
    transform: scale(.95);
}

.notif-panel__list {
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (max-width: 600px) {
    .notif-panel {
        max-width: 100%;
        height: 100dvh;
        bottom: auto;
    }
}
