:root {
    /* Tokens de color. Las superficies, textos y bordes neutros de toda la
    hoja (salvo la landing, que es siempre clara) leen de aquí, para que el
    modo oscuro sea un único bloque de valores (ver :root[data-theme="dark"]
    más abajo). El tema lo fija el script del <head> de base.html. */
    color-scheme: light;
    /* Testigo de que la hoja cargó: si falta, base.html la vuelve a pedir. */
    --gyre-css: 1;
    --color-brand: #7c4dff;
    /* Acento: rellenos con texto blanco, degradados, sombras y focos.
    Iguales en claro y oscuro; cambian con el color de acento (Configuración). */
    --accent: #7c4dff;
    --accent-2: #536dfe;
    --accent-rgb: 124, 77, 255;
    --accent-light: #8b5cff;
    --color-brand-dark: #5a4fcf;
    --color-brand-deep: #3d2b8a;
    --color-brand-soft: #6f62c4;
    --color-success: #22c98c;
    --color-success-dark: #17a973;
    --color-success-text: #0f7d54;
    --color-danger: #c62828;
    --color-neutral-bg: #f8f8fc;
    --color-text: #222;
    --color-text-soft: #555;
    /* #888 daba 3,5:1 sobre blanco (por debajo del 4,5:1 de WCAG AA para
    texto pequeño); #6b6780 da 5,3:1. */
    --color-text-muted: #6b6780;
    --color-border-soft: #e0d9ff;
    --color-surface-hover: #f5f3ff;
    --color-surface-active: #ece7ff;
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fcfbff;
    --surface-3: #f8f7fd;
    --border-subtle: #f0edfa;
    --border-strong: #d9d2ff;
    --radius-card: 18px;
    --shadow-elevated: 0 8px 28px rgba(var(--accent-rgb), 0.18);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --color-brand: #9b7bff;
    --color-brand-dark: #b9a8ff;
    --color-brand-deep: #d6ccff;
    --color-brand-soft: #a99de0;
    --color-danger: #ff6b6b;
    --color-success-text: #5cf0b4;
    --color-neutral-bg: #1d1a2c;
    --color-text: #ece9f7;
    --color-text-soft: #c9c4dd;
    --color-text-muted: #a49fbd;
    --color-border-soft: #3a3260;
    --color-surface-hover: #262141;
    --color-surface-active: #2f2852;
    --bg: #0f0d1a;
    --surface: #1a1729;
    --surface-2: #211d34;
    --surface-3: #1f1b31;
    --border-subtle: #2a2542;
    --border-strong: #463c78;
    --shadow-elevated: 0 8px 28px rgba(0, 0, 0, 0.45);
}

html {
    /* Evita que Chrome Android "infle" el tamaño de letra dentro de celdas
    estrechas (font boosting) -- sin esto, el texto en columnas comprimidas
    de .set-table puede renderizar más grande que el font-size declarado,
    y solo se ve en un móvil real: Chrome de escritorio no reproduce este
    comportamiento, así que no se puede verificar aquí, solo en el móvil. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* El "flash" táctil gris nativo de Android compite con nuestros propios
    estilos :active (p.ej. hacía que el menú "Más" pareciera seguir pulsado
    tras tocar un enlace de dentro) -- se desactiva globalmente y se deja
    el feedback táctil enteramente en manos de las reglas :active propias. */
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
    color: var(--color-text);
    background: var(--bg);
}
html { background: var(--bg); }

/* Foco visible al navegar con teclado (no aparece al tocar con el dedo). */
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible,
[role="button"]:focus-visible, input[type="checkbox"]:focus-visible {
    outline: 3px solid rgba(var(--accent-rgb), 0.55);
    outline-offset: 2px;
}

/* font-size 16px evita el zoom automático de iOS al enfocar el campo; width
100%+box-sizing evita que un <textarea cols=N> sin más CSS (como el de
exercise_notes.html) se renderice más ancho que la pantalla en móvil -- eso
desborda horizontalmente y se percibe como "zoom" (confirmado en Android). */
textarea {
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    padding: 10px 16px;
    margin-bottom: 16px;
}
.top-nav-brand {
    font-weight: 800;
    color: var(--color-brand-dark);
    margin-right: 10px;
    font-size: 1.05rem;
}

.btn, button, input[type="submit"] {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 3px 6px 3px 0;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

@media (hover: hover) {
    .btn:hover, button:hover, input[type="submit"]:hover {
        background: linear-gradient(135deg, #6a3dff, #3d5afe);
        color: white;
        box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    }
}

.btn:disabled, button:disabled, input[type="submit"]:disabled {
    background: #ccc;
    color: var(--color-text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-danger, input[type="submit"].btn-danger {
    background: linear-gradient(135deg, #ff5252, #d32f2f);
}
@media (hover: hover) {
    .btn-danger:hover {
        background: linear-gradient(135deg, #e04848, #b71c1c);
    }
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--color-text-soft);
    text-decoration: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-nav .icon { color: var(--color-brand); }
.btn-nav.active { background: var(--color-surface-active); color: var(--color-brand-dark); }
.btn-nav.active .icon { color: var(--color-brand-dark); }
.btn-nav.btn-nav-danger { color: var(--color-danger); }
.btn-nav.btn-nav-danger .icon { color: var(--color-danger); }
@media (hover: hover) {
    .btn-nav:hover { background: var(--color-surface-hover); color: var(--color-text); }
    .btn-nav.btn-nav-danger:hover { background: #fdecea; color: var(--color-danger); }
}

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

.analysis-summary {
    border-left: 4px solid var(--accent);
    background: #f2eefd;
    color: #4a3a8f;
    font-size: 1.05rem;
}
.analysis-section h3 {
    margin-top: 0;
    margin-bottom: 8px;
}
.analysis-section ul, .analysis-section ol {
    margin: 0;
    padding-left: 20px;
}
.analysis-section li { margin-bottom: 4px; }
.analysis-placeholder {
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}
.analysis-fortalezas {
    border-left: 4px solid #22c98c;
    background: #e7faf1;
}
.analysis-fortalezas h3 { color: #0e7550; }
.analysis-fortalezas .analysis-placeholder { color: #3d8a6b; }

.analysis-areas-mejora {
    border-left: 4px solid #c62828;
    background: #fdecec;
}
.analysis-areas-mejora h3 { color: #a11f1f; }
.analysis-areas-mejora .analysis-placeholder { color: #a15a5a; }

.analysis-proximos-pasos {
    border-left: 4px solid var(--accent);
    background: #f2eefd;
}
.analysis-proximos-pasos h3 { color: var(--color-brand-dark); }
.analysis-proximos-pasos .analysis-placeholder { color: #6b5fa8; }

.workout-card {
    display: block;
    background: var(--color-neutral-bg);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    padding: 14px 18px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--color-text);
    transition: transform 0.1s ease, border-color 0.15s ease;
}
@media (hover: hover) {
    .workout-card:hover {
        border-color: var(--color-brand);
        transform: translateY(-1px);
    }
}
.workout-card .wc-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-brand-deep);
}
.workout-card .wc-date {
    font-size: 0.85rem;
    color: var(--color-text-soft);
    font-weight: 600;
    background: #ececf7;
    padding: 3px 10px;
    border-radius: 999px;
    float: right;
}

.btn-outline {
    display: inline-block;
    padding: 5px 12px;
    background: var(--surface);
    color: #3d50d6;
    border: 1.5px solid var(--accent-2);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    margin: 2px 4px 2px 0;
    transition: background 0.15s ease;
}
@media (hover: hover) {
    .btn-outline:hover { background: #ececf7; }
}

.active-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--surface);
    color: var(--color-brand-deep);
    border: 1.5px solid var(--accent);
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 6px 18px rgba(var(--accent-rgb),0.25);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 8px;
}
.active-toast::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c98c;
    display: inline-block;
}
@media (hover: hover) {
    .active-toast:hover { background: var(--color-surface-hover); color: var(--color-brand-deep); }
}


.exercise-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    padding: 14px 18px;
    margin-bottom: 10px;
}
.drag-handle {
    cursor: grab;
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    margin: -12px -2px -12px -14px;
    touch-action: none;
}
.pill {
    display: inline-block;
    background: var(--color-surface-hover);
    color: var(--color-brand-dark);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}
.pill-label {
    background: transparent;
    color: var(--color-text, #222);
    font-weight: 700;
    padding: 4px 4px 4px 0;
}
.pill-success {
    background: #e8f8f0;
    color: var(--color-success-dark);
}
.pill-muted {
    background: transparent;
    color: var(--color-text-muted);
    font-weight: 600;
}

.btn-icon {
    background: none;
    border: none;
    color: #c62828;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
}
@media (hover: hover) {
    .btn-icon:hover { background: #fdecea; }
}


.flash {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #664d03;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    transition: opacity 0.4s ease-out;
}
.flash.flash-fade { opacity: 0; }


/* Descanso: píldora compacta (≈52 px de alto) encima de la barra inferior.
   .is-compact = solo anillo y tiempo. */
.rest-toast {
    position: fixed;
    bottom: 24px;
    right: 16px;
    background: var(--surface);
    border: 1.5px solid var(--accent);
    color: var(--color-brand-deep);
    padding: 5px 5px 5px 10px;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.22);
    z-index: 1002;
    align-items: center;
    gap: 6px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.rest-toast.rest-toast-dragging { cursor: grabbing; }
body.has-rest-timer { padding-bottom: 84px; }
.rest-toast button { touch-action: auto; }
.rt-main {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    cursor: pointer;
}
.rt-ring { flex-shrink: 0; display: block; }
.rt-ring-track { stroke: var(--color-surface-active); }
.rt-ring-fill {
    stroke: var(--color-brand);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}
@media (prefers-reduced-motion: no-preference) {
    .rt-ring-fill { transition: stroke-dashoffset 1s linear; }
}
.rt-text { display: flex; flex-direction: column; justify-content: center; line-height: 1.1; min-width: 0; }
.rt-label { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 0.68rem; font-weight: 800; color: var(--accent); }
.rt-label[hidden] { display: none; }
.rest-toast .rt-time {
    font-size: 1.35rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.rest-toast .rt-adjust { display: flex; gap: 2px; }
.rest-toast .rt-adjust button {
    margin: 0;
    min-width: 42px;
    height: 40px;
    padding: 0 8px;
    border: 0;
    border-radius: 999px;
    background: var(--color-surface-hover);
    color: var(--color-brand-dark);
    font-size: 0.88rem;
    font-weight: 700;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rest-toast .rt-adjust .rt-stop { color: var(--color-text-muted); }
.rest-toast.is-compact { padding-right: 14px; }
.rest-toast.is-compact .rt-adjust { display: none; }
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.rest-badge {
    display: inline-block;
    background: var(--color-surface-hover);
    color: var(--color-brand-dark);
    border: 1px solid var(--border-strong);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
@media (hover: hover) {
    .rest-badge:hover { background: var(--color-surface-active); }
}


.set-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
    font-size: 0.95rem;
}
.set-row .set-weight { font-weight: 700; color: var(--color-brand-deep); min-width: 70px; }

.form-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
    align-items: end;
    background: var(--surface-3);
    padding: 14px;
    border-radius: 10px;
}
.form-table label { display: block; font-size: 0.8rem; margin-bottom: 3px; }
.form-table input, .form-table select { width: 100%; box-sizing: border-box; }
.form-table .form-submit { grid-column: 1 / -1; }


.set-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}
.set-table th {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    text-align: center;
    padding: 4px;
}
.set-table td { text-align: center; padding: 4px; }
.set-table tr:nth-child(even) { background: var(--surface-3); }
.cell-input {
    width: 55px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 6px 2px;
    border-radius: 6px;
}
.cell-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.5;
}
select.cell-input {
    width: 100px;
    padding-right: 22px;
    text-align: left;
    -webkit-appearance: menulist;
    appearance: menulist;
}
.cell-input:focus { background: var(--color-surface-active); outline: none; }
.set-num { font-weight: 700; color: var(--color-brand-deep); position: relative; }
.pr-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 2px auto 0;
    border-radius: 50%;
    background: #ffb300;
    font-size: 0.65rem;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(255, 179, 0, 0.5);
}
.set-previous { font-size: 0.8rem; color: var(--color-text-muted); white-space: nowrap; }
.delete-set-btn { background: none; border: none; color: #c62828; cursor: pointer; font-size: 0.9rem; }
/* Tick de serie: antes era un círculo blanco vacío sin pista de qué hacía.
Ahora muestra siempre el check (tenue sin marcar, blanco sobre degradado
al marcar) -- se entiende a la primera como "pulsa para completar". */
.set-check-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border-radius: 10px;
    border: 2px solid #ddd7f3;
    background: var(--surface);
    color: #cfc8e8;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease,
                transform 0.12s ease, box-shadow 0.12s ease;
}
.set-check-btn .icon { width: 18px; height: 18px; }
@media (hover: hover) {
    .set-check-btn:hover { background: #f0fbf6; border-color: var(--color-success); color: var(--color-success); box-shadow: none; }
    .set-check-btn.checked:hover { background: linear-gradient(135deg, #22c98c, #17a973); color: #fff; }
}
.set-check-btn:active { transform: scale(0.88); }
.set-check-btn.checked {
    background: linear-gradient(135deg, #22c98c, #17a973);
    border-color: transparent;
    color: white;
    box-shadow: 0 3px 10px rgba(34, 201, 140, 0.4);
}
.set-table tr.set-row-done {
    background: rgba(34, 201, 140, 0.11);
    transition: background 0.15s ease-out;
}
@media (prefers-reduced-motion: no-preference) {
    .set-table tr.set-row-sweep {
        background-image: linear-gradient(100deg,
            transparent 0%, rgba(255, 255, 255, 0.5) 45%,
            rgba(34, 201, 140, 0.35) 50%, rgba(255, 255, 255, 0.5) 55%, transparent 100%);
        background-repeat: no-repeat;
        background-size: 60% 100%;
        animation: set-row-sweep-anim 360ms ease-out;
    }
    .set-check-btn.just-checked {
        animation: set-check-pop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1.4);
    }
}
@keyframes set-row-sweep-anim {
    from { background-position: -150% 0; }
    to   { background-position: 250% 0; }
}
@keyframes set-check-pop {
    0% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(34, 201, 140, 0.55); }
    60% { transform: scale(1.18); box-shadow: 0 0 0 7px rgba(34, 201, 140, 0); }
    100% { transform: scale(1); box-shadow: 0 3px 10px rgba(34, 201, 140, 0.4); }
}

/* Tipo de serie: pastilla de color con la inicial (N/C/F/D) en móvil y el
nombre completo en escritorio. El <select> nativo va encima, invisible,
para que al tocar se abra el selector del sistema con los nombres enteros. */
.set-type-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.set-type-short { display: none; }
.set-type-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 16px;
}
.set-type-normal        { background: transparent; color: var(--color-text-muted); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.set-type-calentamiento { background: #fbbf24; color: #3b2a00; }
.set-type-fallo         { background: #dc2626; color: #fff; }
.set-type-dropset       { background: #2563eb; color: #fff; }
.set-type-bump { transform: scale(1.15); }

/* En móvil, la tabla de series no debe necesitar scroll horizontal -- se
oculta la columna "Anterior" (solo referencia, no se rellena) y se
comprimen el resto de columnas para que quepan todas a la vez. La papelera
de cada fila se sustituye por deslizar la fila hacia la izquierda (ver
.swipe-delete-zone / JS en workout_detail.html) -- libera la columna entera
en vez de solo encogerla, que era lo que seguía sin caber.  */
@media (max-width: 600px) {
    .card-elevated { padding-left: 8px; padding-right: 8px; }
    .set-table th:nth-child(2), .set-table td:nth-child(2) { display: none; }
    .set-table th:last-child, .set-table td:last-child { display: none; }
    .set-table th, .set-table td { padding: 3px 0; }
    .cell-input { width: 26px; min-width: 0; font-size: 0.8rem; padding: 6px 0; }
    .cell-input-weight { width: 40px; }
    select.cell-input {
        width: 36px;
        min-width: 0;
        padding-right: 8px;
        font-size: 0.6rem;
        text-overflow: ellipsis;
    }
    .set-check-btn { width: 28px; height: 28px; border-radius: 8px; }
    .set-check-btn .icon { width: 15px; height: 15px; }
    .set-type-pill { min-width: 24px; height: 24px; padding: 0 7px; font-size: 0.72rem; }
    .set-type-short { display: inline; }
    .set-type-long { display: none; }
    .pr-badge { width: 13px; height: 13px; font-size: 0.55rem; margin-top: 1px; }

    .set-table-wrap { position: relative; }
    .set-table tr[id^="row-"] { position: relative; left: 0; transition: left 0.2s ease; touch-action: pan-y; }
    .swipe-delete-zone {
        display: none;
        position: absolute;
        right: 0;
        width: 64px;
        background: #ff5252;
        border-radius: 0 8px 8px 0;
        z-index: 1;
        align-items: center;
        justify-content: center;
    }
    .swipe-delete-zone button {
        background: none;
        border: none;
        color: white;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
}

.confetti-piece {
    position: fixed;
    top: -10px;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    z-index: 999;
    animation: confetti-fall linear forwards;
    pointer-events: none;
}
@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.action-menu {
    position: relative;
    display: inline-block;
}
.action-menu-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--color-text-soft);
}
.action-menu-content {
    display: none;
    position: absolute;
    bottom: 110%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 100;
    overflow: hidden;
}
.action-menu-content.open { display: block; }
.action-menu-content button, .action-menu-content input[type=submit] {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--color-text);
    font-family: inherit;
}
@media (hover: hover) {
    .action-menu-content button:hover, .action-menu-content input[type=submit]:hover {
        background: var(--color-surface-hover);
    }
}
.action-menu-content .danger { color: #c62828; }
.action-menu-btn .icon { color: var(--color-brand); }
.action-menu-content button:not(.danger) .icon { color: var(--color-brand); }

.btn-finish {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #22c98c, #17a973);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    box-shadow: 0 6px 16px rgba(34,201,140,0.35);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
@media (hover: hover) {
    .btn-finish:hover {
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 8px 20px rgba(34,201,140,0.45);
    }
}
.btn-finish::before {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: inline-block;
    position: relative;
}
.btn-finish::before {
    background-image: none;
}

.btn-text-danger {
    background: none !important;
    border: none !important;
    color: #c62828 !important;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    text-decoration: none !important;
    font-family: inherit;
}
@media (hover: hover) {
    .btn-text-danger:hover {
        color: #8e0000 !important;
        text-decoration: none !important;
    }
}

.btn-danger-outline {
    display: inline-block;
    background: var(--surface);
    border: 1.5px solid #c62828;
    color: #c62828;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
}
@media (hover: hover) {
    .btn-danger-outline:hover {
        background: #fdecea;
        color: #8e0000;
    }
}

.dashboard-panel {
    background: var(--surface-3);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    padding: 22px 24px;
    margin-bottom: 20px;
}
.dash-eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-brand-soft);
    margin-bottom: 14px;
}
.dash-metrics {
    display: flex;
    align-items: baseline;
    gap: 28px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.dash-metric { display: flex; flex-direction: column; }
.dash-metric-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-brand-dark);
}
.dash-metric-primary .dash-metric-value { font-size: 2rem; }
.dash-metric-soon .dash-metric-value { color: var(--color-text-muted); }
.dash-metric-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}
@media (max-width: 600px) {
    .dash-eyebrow { margin-bottom: 10px; }
    .dash-metrics {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px 16px;
        margin-bottom: 14px;
    }
    .dash-metric-primary .dash-metric-value { font-size: 1.7rem; }
}
.dash-body {
    display: flex;
    gap: 20px;
    align-items: stretch;
}
.dash-muscle-map {
    flex: 0 0 50%;
    background: var(--surface);
    border: 1px solid var(--color-surface-active);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.mm-row { display: flex; gap: 10px; align-items: flex-start; }
.mm-figure { width: 135px; height: auto; }
.dash-muscle-caption {
    font-size: 0.68rem;
    color: var(--color-text-muted);
    margin-top: 8px;
    text-align: center;
}
.dash-calendar {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--color-surface-active);
    border-radius: 14px;
    padding: 14px;
    overflow-x: auto;
}
.dash-toggle {
    display: none;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    padding: 8px;
    margin-top: 14px;
    color: var(--color-brand);
    font-size: 0.8rem;
    font-weight: 600;
}
.dash-toggle .icon { transition: transform 0.2s; }
.dash-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
@media (max-width: 600px) {
    .dash-body { flex-direction: column; }
    .dash-muscle-map { flex-basis: auto; padding: 8px; }
    .mm-figure { width: 108px; }
    .dashboard-panel:not(.dash-expanded) .dash-calendar,
    .dashboard-panel:not(.dash-expanded) .dash-weight {
        display: none;
    }
    .dash-toggle { display: flex; }
}
.dash-weight {
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--color-surface-active);
    border-radius: 14px;
    padding: 10px 14px;
}
.dash-weight-empty {
    margin: 4px 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: center;
}
.dash-weight-empty a { color: var(--color-brand); font-weight: 600; }

.dash-notes {
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--color-surface-active);
    border-radius: 14px;
    padding: 10px 14px;
}
.dash-notes textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--color-surface-active);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 8px;
}

.calendar-grid { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.calendar-col { display: flex; flex-direction: column; gap: 3px; }
.calendar-col.new-month { margin-left: 8px; }
.calendar-day {
    width: 22px; height: 22px; border-radius: 5px;
    background: var(--icon-tile, #ececf7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--color-text-muted);
}
.calendar-day.trained { background: #22c98c; color: white; font-weight: 700; }
.calendar-day.empty { background: transparent; }

/* ===== Piloto de rediseño: workout_detail.html ===== */

.card-elevated {
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    border-color: var(--color-border-soft);
}
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--surface);
    color: #3c4043;
    border: 1.5px solid #dadce0;
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) {
    .btn-google:hover { background: #f7f8f8; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
}
.card.exercise-card-complete {
    background: rgba(34, 201, 140, 0.07);
    border-color: var(--color-success);
    box-shadow: 0 8px 28px rgba(34, 201, 140, 0.18);
    transition: background 0.3s ease-out, border-color 0.3s ease-out, box-shadow 0.3s ease-out;
}

.icon {
    display: inline-block;
    vertical-align: -3px;
    flex-shrink: 0;
}

.workout-meta {
    background: var(--color-surface-hover);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}
.workout-meta .icon {
    color: var(--color-text-muted); /* gris con un toque de morado, no un gris neutro puro -- contraste ~4.1:1 sobre el chip, verificado */
    background: rgba(var(--accent-rgb), 0.12);
    border-radius: 50%;
    padding: 4px;
    box-sizing: content-box;
}
.workout-meta-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.workout-meta .set-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

.progress-ring-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}
.progress-ring-track { stroke: #ece7ff; }
.progress-ring-fill {
    stroke: var(--color-brand);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}
@media (prefers-reduced-motion: no-preference) {
    .progress-ring-fill { transition: stroke-dashoffset 0.6s ease-out; }
}
.progress-ring-value {
    position: absolute;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-brand-dark);
}

.plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border-soft);
}
.plan-row:last-child { border-bottom: 0; }
.plan-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
    transition: color 0.2s ease;
}
.plan-pills { display: flex; gap: 6px; flex-shrink: 0; }
.plan-pills .pill { margin: 0; white-space: nowrap; }
.plan-row.is-done .plan-name,
.plan-row.is-done .plan-target {
    color: var(--color-text-muted);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.exercise-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-exercise-row {
    display: flex;
    gap: 8px;
    position: relative;
}
.add-exercise-row .exercise-input-wrap {
    flex: 1;
    position: relative;
}

.cell-input-number {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-text);
    width: 62px;
}
.cell-input-number::-webkit-outer-spin-button,
.cell-input-number::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.cell-input-number[type=number] { -moz-appearance: textfield; }
.cell-input-weight { width: 84px; } /* admite decimales (p.ej. "102.5") -- 62px recortaba, verificado con scrollWidth > clientWidth */
.set-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.swipe-delete-zone { display: none; }

/* ===== Barra de navegación inferior (solo móvil) ===== */

.bottom-nav {
    display: none;
}

@media (max-width: 600px) {
    body { padding-bottom: 76px; }

    .top-nav .btn-nav {
        display: none;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--surface);
        border-top: 1px solid var(--color-surface-active);
        box-shadow: 0 -2px 12px rgba(var(--accent-rgb), 0.08);
        padding: 6px 4px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
        z-index: 900;
    }

    /* En escritorio va a la derecha; en móvil se mueve a la izquierda porque a la
    derecha, en la fila inferior, está el botón "Más" y su menú desplegable se
    abre justo encima -- se solapaban. */
    .active-toast {
        bottom: 84px;
        left: 16px;
        right: auto;
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    .active-toast::before { width: 7px; height: 7px; }
    .rest-toast { bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; }
    body.has-rest-timer { padding-bottom: calc(76px + 64px); }
    /* Con el aviso "en curso" abajo a la izquierda, el descanso sube una fila. */
    body:has(.active-toast) .rest-toast { bottom: calc(126px + env(safe-area-inset-bottom)); }
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.bottom-nav-item.active { color: var(--color-brand); }
.nav-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 26px;
    border-radius: 999px;
}
.bottom-nav-item.active .nav-icon-wrap,
.bottom-nav-profile-btn.active .nav-icon-wrap {
    background: #ece3ff;
}

.bottom-nav-profile {
    position: relative;
    padding: 0;
}
.bottom-nav-profile-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.68rem;
    font-family: inherit;
}
.bottom-nav-profile-btn.active { color: var(--color-brand); }
.bottom-nav-profile-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 4px;
    margin-bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    overflow: hidden;
    min-width: 180px;
}
.bottom-nav-profile-menu.open { display: block; }
.bottom-nav-profile-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}
.bottom-nav-profile-menu a .icon { color: var(--color-brand); flex-shrink: 0; }
.bottom-nav-profile-menu a.danger { color: var(--color-danger); }
.bottom-nav-profile-menu a.danger .icon { color: var(--color-danger); }
.bottom-nav-profile-menu a + a { border-top: 1px solid var(--color-surface-active); }
@media (hover: hover) {
    .bottom-nav-profile-menu a:hover { background: var(--color-surface-hover); }
}
.bottom-nav-profile-menu a:active,
.bottom-nav-profile-menu a.touch-pressed { background: var(--color-surface-active); }
.bottom-nav-profile-btn:active .nav-icon-wrap,
.bottom-nav-profile-btn.touch-pressed .nav-icon-wrap { background: #ece3ff; }

/* ===== Selector de ejercicios (bottom sheet) ===== */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 12, 40, 0.45);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.confirm-box {
    max-width: 340px;
    width: 100%;
}
.confirm-box p {
    margin-top: 0;
}
.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 12, 40, 0.45);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.sheet-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    background: var(--surface);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    box-shadow: var(--shadow-elevated);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-sheet.open {
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .sheet-backdrop, .bottom-sheet { transition: none; }
}

.bottom-sheet-grabber {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #e0d9ff;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 4px;
    flex-shrink: 0;
}
.bottom-sheet-title {
    margin: 0;
    font-size: 1.05rem;
}
.sheet-close-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
}
@media (hover: hover) {
    .sheet-close-btn:hover { background: var(--color-surface-hover); }
}

.bottom-sheet-search-wrap {
    position: relative;
    padding: 8px 16px 12px;
    flex-shrink: 0;
}
.bottom-sheet-search-wrap .icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}
.bottom-sheet-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px 10px 38px;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 10px;
    font-size: 1rem;
}
.bottom-sheet-search-input:focus {
    outline: none;
    border-color: var(--color-brand);
}

.bottom-sheet-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
}

.exercise-picker-hint {
    padding: 24px 16px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* ===== Selector de RIR/RPE (bottom sheet) ===== */

.effort-chip {
    display: inline-block;
    background: var(--color-surface-hover);
    color: var(--color-brand-dark);
    border: none;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    min-width: 32px;
}
.effort-chip-empty {
    background: #fdecea;
    color: var(--color-danger);
    border: 1.5px solid var(--color-danger);
    font-weight: 600;
    font-size: 0.65rem;
}
.effort-chip-placeholder {
    background: transparent;
    color: var(--color-text-muted);
    opacity: 0.5;
    border: 1.5px dashed var(--border-strong);
}
@media (max-width: 600px) {
    .effort-chip { padding: 3px 6px; font-size: 0.7rem; min-width: 24px; }
    .effort-chip-empty { font-size: 0.55rem; }
}
.effort-picker-subtitle {
    margin: 0;
    padding: 0 16px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}
.effort-picker-preview {
    text-align: center;
    padding: 16px;
}
.effort-picker-big {
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-brand-dark);
    line-height: 1;
}
.effort-picker-desc {
    margin-top: 6px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}
.effort-picker-row {
    display: flex;
    gap: 8px;
    padding: 4px 16px 16px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}
.effort-picker-option {
    flex-shrink: 0;
    scroll-snap-align: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--color-surface-active);
    background: var(--surface);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--color-text);
    cursor: pointer;
}
.effort-picker-option.selected {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: white;
}
.effort-picker-clear { color: var(--color-text-muted); }
.effort-picker-confirm {
    display: block;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    text-align: center;
}

.exercise-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
}
.exercise-result-row:focus-visible { background: var(--color-surface-hover); }
@media (hover: hover) {
    .exercise-result-row:hover { background: var(--color-surface-hover); }
}
.exercise-result-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}
.exercise-result-thumb-fallback {
    width: 44px;
    height: 44px;
    background: #ececf7;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.exercise-result-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.exercise-result-muscles {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.exercise-favorite-star {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 6px;
    color: #ccc;
    cursor: pointer;
    display: flex;
}
.exercise-favorite-star.is-favorite { color: #ffb300; }
.exercise-favorite-star.is-favorite .icon { fill: #ffb300; }

.exercise-picker-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 10px 16px;
}

.exercise-picker-create-form { padding: 4px 16px 16px; }
.exercise-picker-create-form input[type=text] {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}
.exercise-picker-muscle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin-bottom: 10px;
    max-height: 140px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px;
}
.exercise-picker-muscle-grid label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    padding: 2px 4px;
}
.exercise-picker-error {
    color: var(--color-danger);
    font-size: 0.8rem;
    margin-bottom: 6px;
    display: none;
}

.exercise-picker-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.exercise-chip {
    display: none;
    align-items: center;
    gap: 6px;
    background: var(--color-surface-hover);
    color: var(--color-brand-dark);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}
.exercise-chip.visible {
    display: inline-flex;
}

.debug-error-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #a11f1f;
    color: white;
    padding: 12px 16px;
    z-index: 2000;
    font-size: 0.8rem;
    word-break: break-word;
}
.debug-error-banner button {
    margin-top: 8px;
    background: var(--surface);
    color: #a11f1f;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 700;
}

.rest-finished-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    color: var(--color-brand-deep);
    border: 1.5px solid var(--accent);
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 6px 18px rgba(var(--accent-rgb),0.25);
    z-index: 1003;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.rest-finished-toast.visible {
    opacity: 1;
}

.picker-error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    color: #a11f1f;
    border: 1.5px solid var(--color-danger);
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 6px 18px rgba(198,40,40,0.25);
    z-index: 1003;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.picker-error-toast.visible {
    opacity: 1;
}

/* ===== Piloto de rediseño: routines.html ===== */

.routine-card {
    border-color: color-mix(in srgb, var(--block-color, #ece7ff) 45%, var(--surface));
    background: color-mix(in srgb, var(--block-color, #ece7ff) 8%, var(--surface));
}
.routine-card .exercise-header {
    flex-wrap: wrap;
    gap: 8px;
}

.routine-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    color: var(--color-text-muted);
    padding: 32px 18px;
}
.routine-empty-state p {
    margin: 0;
    font-style: italic;
}

.routine-section-title {
    margin: 18px 0 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.routine-section-title .icon { color: #f0b400; }
.routine-section:first-of-type { margin-top: 0; }

.routine-pin-btn { color: var(--color-text-muted); }
.routine-pin-btn.active { color: #f0b400; }
@media (hover: hover) {
    .routine-pin-btn:hover { background: var(--color-surface-hover); }
}

.routine-block-select,
.routine-block-input {
    flex: 1;
    min-width: 140px;
    max-width: 260px;
    font-size: 0.85rem;
    padding: 6px 8px;
    border: 1.5px solid var(--block-color, #e0d9ff);
    border-radius: 8px;
}

.routine-block-details {
    margin: 18px 0 8px;
}
.routine-block-details:first-of-type { margin-top: 0; }
.routine-block-details > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-text);
    padding: 10px 14px;
    border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--block-color) 16%, var(--surface));
    border: 1.5px solid color-mix(in srgb, var(--block-color) 45%, var(--surface));
    margin-bottom: 14px;
}
.routine-block-details > summary::-webkit-details-marker { display: none; }
/* Bloque blanco = "sin color": la mezcla con blanco daría un borde invisible. */
.routine-block-details.block-neutral > summary {
    background: var(--surface);
    border-color: var(--color-border-soft);
}
.routine-block-details > summary .icon {
    color: color-mix(in srgb, var(--block-color) 70%, var(--color-text));
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.routine-block-details[open] > summary .icon { transform: rotate(180deg); }
.routine-block-name { flex: 1; }
.routine-block-color-input {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 2px solid white;
    box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}
.routine-block-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.routine-block-color-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.routine-block-default-btn {
    background: none;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    white-space: nowrap;
}
.routine-block-default-btn.active {
    background: var(--color-surface-active);
    border-color: transparent;
    color: var(--color-brand-dark);
}
@media (hover: hover) {
    .routine-block-default-btn:hover { border-color: var(--color-brand); color: var(--color-brand-dark); }
}
.routine-block-empty {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    padding: 4px 2px;
}

/* ===== Piloto de rediseño: exercise_progress.html ===== */

/* .notes-list también se usa en workout_detail.html -- estas reglas solo
tocan espaciado vertical (quitan el margen por defecto del <ul> del
navegador), no ancho/bullets/color, así que son seguras -- y una mejora,
no una regresión -- para ambas plantillas. */
.weight-entry-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.weight-entry-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0eefa;
}
.weight-entry-list li:last-child { border-bottom: none; }
.weight-entry-date { color: var(--color-text-muted); font-size: 0.85rem; }
.weight-entry-value { font-weight: 700; margin-left: auto; }
.weight-entry-list form { display: flex; }

.notes-list {
    margin: 0;
    padding-left: 20px;
}
.notes-list li {
    margin-bottom: 4px;
    line-height: 1.4;
}
.notes-list li:last-child {
    margin-bottom: 0;
}

/* Red de seguridad CSS para el <canvas width="600"> del gráfico: Chart.js
v4 trae responsive:true por defecto y debería reescalarlo solo, pero eso
depende de que el script del CDN cargue bien -- esto cubre el caso de
que falle o vaya lento, coste cero. */
.progress-chart {
    max-width: 100%;
    height: auto;
}

/* ===== Piloto de rediseño: index.html ===== */

.week-divider {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-brand-soft);
    margin: 24px 0 10px;
}

.wc-exercises {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.wc-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.wc-meta .icon {
    color: #b7b2c9;
}

/* Misma red de seguridad que .progress-chart para el <canvas> del gráfico
de peso: sin width/height HTML fijos y con maintainAspectRatio:false,
depende de que Chart.js cargue bien -- coste cero. */
#weightMiniChart {
    max-width: 100%;
    height: auto;
}

/* ===== Landing pública (/) =====
Página a todo el ancho (base.html: body_attrs/top_nav), con su propia
cabecera. Hero oscuro con maqueta del entreno hecha en HTML/CSS, secciones
claras debajo. Todo con prefijo lp- para no chocar con la app. */

body.landing-page {
    max-width: none;
    padding: 0;
    background: #fff;
    color: #1d1a2e;
}
.landing-page .flash { margin: 12px 16px; }
.lp-container { max-width: 1120px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }
.landing-page h1, .landing-page h2, .landing-page h3, .lp-brand {
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}

/* Botones */
.lp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.lp-btn:active { transform: scale(0.97); }
.lp-btn-sm { padding: 8px 14px; font-size: 0.88rem; border-radius: 10px; }
.lp-btn-lg { padding: 15px 24px; font-size: 1rem; border-radius: 14px; }
.lp-btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #8b5cff, #536dfe);
    box-shadow: 0 10px 28px rgba(124, 77, 255, 0.45);
}
.lp-btn-google { color: #fff; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22); }
.lp-btn-white { color: #4a2fd0; background: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25); }
.lp-btn-ghost { color: #fff; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.3); }
@media (hover: hover) {
    .lp-btn-primary:hover { color: #fff; box-shadow: 0 14px 34px rgba(124, 77, 255, 0.6); transform: translateY(-1px); }
    .lp-btn-google:hover, .lp-btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.2); }
    .lp-btn-white:hover { color: #4a2fd0; transform: translateY(-1px); }
}

/* Cabecera */
.lp-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(18, 12, 44, 0.78);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.lp-header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.lp-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; font-size: 1.2rem; text-decoration: none; }
.lp-brand img { width: 30px; height: 30px; object-fit: contain; }
.lp-header-nav { display: flex; align-items: center; gap: 6px; }
.lp-header-link { color: rgba(255, 255, 255, 0.85); text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 8px 10px; }
@media (hover: hover) { .lp-header-link:hover { color: #fff; } }

/* Hero */
.lp-hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: radial-gradient(1200px 600px at 80% -10%, #3b1f96 0%, transparent 60%),
                linear-gradient(180deg, #120c2c 0%, #1c1247 100%);
    padding: 64px 0 88px;
}
.lp-hero-glow { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.55; pointer-events: none; }
.lp-hero-glow-a { width: 420px; height: 420px; background: #7c4dff; top: -120px; left: -140px; }
.lp-hero-glow-b { width: 360px; height: 360px; background: #22c98c; bottom: -200px; right: 10%; opacity: 0.25; }
.lp-hero-grid { position: relative; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; }
.lp-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #d9cfff;
    font-size: 0.8rem;
    font-weight: 600;
}
.lp-hero-title {
    margin: 20px 0 18px;
    font-size: clamp(2.3rem, 5.2vw, 3.7rem);
    line-height: 1.06;
    letter-spacing: -0.035em;
    font-weight: 800;
}
.lp-grad-text {
    background: linear-gradient(90deg, #b69cff, #7fd8ff 55%, #5cf0b4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.lp-lead { max-width: 520px; margin: 0 0 30px; color: rgba(255, 255, 255, 0.75); font-size: 1.12rem; line-height: 1.6; }
.lp-cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-cta-center { justify-content: center; }
.lp-microcopy { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; padding: 0; margin: 22px 0 0; color: rgba(255, 255, 255, 0.7); font-size: 0.86rem; }
.lp-microcopy li { display: inline-flex; align-items: center; gap: 6px; }
.lp-microcopy .icon { color: #5cf0b4; }

/* Maqueta del móvil */
.lp-hero-visual { position: relative; display: flex; justify-content: center; padding: 10px 0; text-align: left; }
.lp-phone {
    position: relative;
    width: 290px;
    padding: 12px;
    border-radius: 44px;
    background: linear-gradient(160deg, #2d2552, #0e0a20);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5), inset 0 0 0 1.5px rgba(255, 255, 255, 0.12);
    rotate: -3deg;
}
.lp-phone-notch { position: absolute; top: 20px; left: 50%; width: 84px; height: 22px; margin-left: -42px; border-radius: 999px; background: #0e0a20; z-index: 2; }
.lp-phone-screen { border-radius: 34px; background: #f4f3f8; padding: 50px 12px 16px; color: #222; min-height: 480px; box-sizing: border-box; }
.lp-mock-header { display: flex; justify-content: space-between; align-items: center; margin: 0 4px 12px; }
.lp-mock-title { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.lp-mock-time { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700; color: #5a4fcf; background: #ece7ff; padding: 4px 8px; border-radius: 999px; }
.lp-mock-card { background: #fff; border-radius: 16px; padding: 12px; margin-bottom: 10px; box-shadow: 0 4px 14px rgba(124, 77, 255, 0.12); }
.lp-mock-card-dim { opacity: 0.75; }
.lp-mock-ex { display: flex; align-items: center; gap: 10px; }
.lp-mock-ex-img { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #ece7ff; color: #7c4dff; flex-shrink: 0; }
.lp-mock-ex strong { display: block; font-size: 0.9rem; }
.lp-mock-ex small { color: #888; font-size: 0.72rem; }
.lp-mock-table { margin-top: 10px; font-size: 0.8rem; }
.lp-mock-row { display: grid; grid-template-columns: 22px 1fr 1fr 1fr 28px; align-items: center; text-align: center; padding: 6px 4px; border-radius: 8px; font-weight: 700; }
.lp-mock-row + .lp-mock-row { margin-top: 3px; }
.lp-mock-head { color: #999; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; }
.lp-tick { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid #d9d2ff; color: transparent; background: #fff; box-sizing: border-box; }
.lp-mock-row.is-done { background: rgba(34, 201, 140, 0.11); }
.lp-mock-row.is-done .lp-tick { border-color: transparent; color: #fff; background: linear-gradient(135deg, #22c98c, #17a973); }
.lp-mock-finish { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; padding: 11px; border-radius: 14px; color: #fff; font-weight: 700; font-size: 0.85rem; background: linear-gradient(135deg, #22c98c, #17a973); }

/* Tarjetas flotantes */
.lp-float {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 10px 10px;
    border-radius: 16px;
    background: #fff;
    color: #222;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}
.lp-float strong { display: block; font-size: 0.85rem; }
.lp-float small { color: #777; font-size: 0.72rem; }
.lp-float-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #fff4d6; font-size: 1.2rem; }
.lp-float-pr { top: 44%; right: -6px; }
.lp-float-rest { bottom: 30px; left: -10px; }
.lp-ring {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: conic-gradient(#7c4dff 0 70%, #ece7ff 70% 100%);
}
.lp-ring span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; font-size: 0.62rem; font-weight: 800; color: #5a4fcf; }

@media (prefers-reduced-motion: no-preference) {
    .lp-phone { animation: lp-float 7s ease-in-out infinite; }
    /* Bucle de 6 s: la 3.ª serie se marca y a la vez salta el PR. */
    .lp-mock-row-live { animation: lp-row-done 6s infinite; }
    .lp-mock-row-live .lp-tick { animation: lp-tick-done 6s infinite; }
    .lp-float-pr { animation: lp-pr-pop 6s infinite; }
    .lp-float-rest { animation: lp-float 6s ease-in-out -2s infinite; }
}
@media (prefers-reduced-motion: reduce) {
    .lp-mock-row-live { background: rgba(34, 201, 140, 0.11); }
    .lp-mock-row-live .lp-tick { border-color: transparent; color: #fff; background: linear-gradient(135deg, #22c98c, #17a973); }
}
@keyframes lp-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes lp-row-done {
    0%, 28% { background: transparent; }
    32%, 92% { background: rgba(34, 201, 140, 0.11); }
    100% { background: transparent; }
}
@keyframes lp-tick-done {
    0%, 28% { color: transparent; background: #fff; border-color: #d9d2ff; transform: scale(1); }
    31% { transform: scale(1.25); }
    33%, 92% { color: #fff; background: #22c98c; border-color: transparent; transform: scale(1); }
    100% { color: transparent; background: #fff; border-color: #d9d2ff; }
}
@keyframes lp-pr-pop {
    0%, 32% { opacity: 0; transform: translateY(10px) scale(0.9); }
    37% { opacity: 1; transform: translateY(0) scale(1.05); }
    40%, 88% { opacity: 1; transform: translateY(0) scale(1); }
    94%, 100% { opacity: 0; transform: translateY(-6px) scale(0.96); }
}

/* Secciones */
.lp-section { padding: 88px 0; }
.lp-section-tint { background: linear-gradient(180deg, #f7f5ff, #fff); }
.lp-section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.lp-kicker { display: inline-block; color: #7c4dff; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.lp-section-head h2 { margin: 10px 0 12px; font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; color: #1d1a2e; }
.lp-section-head p { margin: 0; color: #6b6780; font-size: 1.05rem; line-height: 1.6; }

.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.lp-feature {
    padding: 26px 24px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #ece8fb;
    box-shadow: 0 6px 24px rgba(40, 20, 120, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.6s ease;
}
@media (hover: hover) {
    .lp-feature:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(40, 20, 120, 0.12); }
}
.lp-feature h3 { margin: 16px 0 8px; font-size: 1.1rem; letter-spacing: -0.01em; color: #1d1a2e; }
.lp-feature p { margin: 0; color: #6b6780; font-size: 0.93rem; line-height: 1.6; }
.lp-feature-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; }
.lp-c-green  { background: #e3f9ef; color: #13a06b; }
.lp-c-amber  { background: #fff4d6; color: #c98a00; }
.lp-c-pink   { background: #ffe6f1; color: #d63384; }
.lp-c-violet { background: #ede7ff; color: #7c4dff; }
.lp-c-blue   { background: #e3efff; color: #2f6fed; }
.lp-c-teal   { background: #dff7f7; color: #0f9a9a; }

/* Comparativa */
.lp-compare-wrap { max-width: 720px; }
.lp-compare { background: #fff; border-radius: 22px; border: 1px solid #ece8fb; box-shadow: 0 10px 34px rgba(40, 20, 120, 0.08); overflow: hidden; }
.lp-compare-row { display: grid; grid-template-columns: 1fr 76px 76px; align-items: center; padding: 15px 22px; font-size: 0.97rem; color: #2b2840; }
.lp-compare-row + .lp-compare-row { border-top: 1px solid #f1eefb; }
.lp-compare-row > span:not(:first-child) { display: grid; place-items: center; }
.lp-compare-top { font-weight: 800; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: #9a96ad; background: #fbfaff; }
.lp-compare-us { color: #7c4dff; }
.lp-no { color: #d0cbe0; }
.lp-yes .icon { width: 26px; height: 26px; padding: 5px; box-sizing: border-box; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #22c98c, #17a973); }

/* Pasos */
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; list-style: none; padding: 0; margin: 0; }
.lp-step { position: relative; padding: 26px 24px; border-radius: 20px; background: #faf9ff; border: 1px solid #ece8fb; }
.lp-step-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; font-weight: 800; background: linear-gradient(135deg, #8b5cff, #536dfe); box-shadow: 0 8px 18px rgba(124, 77, 255, 0.35); }
.lp-step h3 { margin: 16px 0 8px; font-size: 1.1rem; color: #1d1a2e; }
.lp-step p { margin: 0; color: #6b6780; font-size: 0.93rem; line-height: 1.6; }

/* CTA final */
.lp-final {
    position: relative;
    overflow: hidden;
    max-width: 1080px;
    margin: 0 auto;
    border-radius: 28px;
    color: #fff;
    text-align: center;
    background: linear-gradient(135deg, #5b2ee8, #3f51e0 60%, #2a2f9e);
    padding: 72px 0;
}
.lp-final-inner { position: relative; }
.lp-final h2 { margin: 0 0 14px; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; }
.lp-final p { margin: 0 auto 30px; max-width: 460px; color: rgba(255, 255, 255, 0.82); font-size: 1.05rem; line-height: 1.6; }

/* Pie */
.lp-footer { padding: 36px 0 44px; }
.lp-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lp-brand-sm { color: #1d1a2e; font-size: 1.05rem; }
.lp-brand-sm img { width: 26px; height: 26px; }
.lp-footer nav { display: flex; gap: 20px; }
.lp-footer a { color: #6b6780; text-decoration: none; font-size: 0.9rem; }
@media (hover: hover) { .lp-footer a:hover { color: #7c4dff; } }

/* Aparición al hacer scroll (solo si el script la activa) */
@media (prefers-reduced-motion: no-preference) {
    .lp-anim .lp-reveal { opacity: 0; translate: 0 18px; transition: opacity 0.6s ease, translate 0.6s ease, transform 0.2s ease, box-shadow 0.2s ease; }
    .lp-anim .lp-reveal.is-visible { opacity: 1; translate: 0 0; }
    .lp-anim .lp-features .lp-reveal:nth-child(3n+2), .lp-anim .lp-steps .lp-reveal:nth-child(2) { transition-delay: 0.08s; }
    .lp-anim .lp-features .lp-reveal:nth-child(3n), .lp-anim .lp-steps .lp-reveal:nth-child(3) { transition-delay: 0.16s; }
}

/* Responsive */
@media (max-width: 1120px) {
    .lp-final { margin: 0 20px; }
}
@media (max-width: 900px) {
    .lp-hero { padding: 44px 0 64px; }
    .lp-hero-grid { grid-template-columns: 1fr; gap: 40px; text-align: center; }
    .lp-lead { margin-left: auto; margin-right: auto; }
    .lp-hero-copy .lp-cta-row, .lp-microcopy { justify-content: center; }
    .lp-features { grid-template-columns: repeat(2, 1fr); }
    .lp-steps { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .lp-container { padding: 0 16px; }
    .lp-header-link { display: none; }
    .lp-hero-title { font-size: 2.25rem; }
    .lp-lead { font-size: 1.02rem; }
    .lp-hero-copy .lp-cta-row { flex-direction: column; }
    .lp-hero-copy .lp-btn-lg { width: 100%; box-sizing: border-box; }
    .lp-phone { width: 260px; }
    .lp-phone-screen { min-height: 440px; }
    .lp-float-pr { right: -4px; top: 62%; }
    .lp-float-rest { left: -4px; bottom: -6px; }
    .lp-features { grid-template-columns: 1fr; gap: 12px; }
    .lp-feature { display: grid; grid-template-columns: 44px 1fr; column-gap: 14px; align-items: start; padding: 18px 16px; }
    .lp-feature-icon { grid-row: span 2; width: 44px; height: 44px; border-radius: 13px; }
    .lp-feature h3 { margin: 2px 0 4px; font-size: 1.02rem; }
    .lp-feature p { font-size: 0.9rem; line-height: 1.5; }
    .lp-steps { gap: 12px; }
    .lp-step { display: grid; grid-template-columns: 40px 1fr; column-gap: 14px; padding: 18px 16px; }
    .lp-step-num { grid-row: span 2; }
    .lp-step h3 { margin: 2px 0 4px; font-size: 1.02rem; }
    .lp-section { padding: 64px 0; }
    .lp-section-head { margin-bottom: 32px; }
    .lp-compare-row { grid-template-columns: 1fr 60px 60px; padding: 13px 14px; font-size: 0.9rem; }
    .lp-compare-top { font-size: 0.7rem; letter-spacing: 0.04em; }
    .lp-final { margin: 0 12px; padding: 56px 0; }
    .lp-final h2 br { display: none; }
    .lp-final .lp-cta-row { flex-direction: column; align-items: stretch; padding: 0 8px; }
    .lp-footer-inner { justify-content: center; text-align: center; }
}

/* ===== Estadísticas de la landing (landing_stats.html) ===== */
.stats-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stats-period-chip {
    padding: 7px 13px;
    border-radius: 999px;
    border: 1.5px solid var(--color-border-soft);
    background: var(--surface);
    color: var(--color-brand-dark);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}
.stats-period-chip.active { background: var(--color-brand); border-color: var(--color-brand); color: #fff; }
.stats-period-date { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }
.stats-period-date input { padding: 5px 8px; border: 1.5px solid var(--color-border-soft); border-radius: 10px; font-family: inherit; }
.stats-period-label { margin: 10px 0 14px; color: var(--color-text-muted); font-size: 0.85rem; }
.stats-funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats-funnel .card { margin: 0; }
@media (max-width: 900px) { .stats-funnel { grid-template-columns: repeat(2, 1fr); } }
.stats-tile { display: flex; flex-direction: column; gap: 2px; }
.stats-tile-value { font-size: 2.1rem; font-weight: 800; color: var(--color-brand-dark); line-height: 1.1; }
.stats-tile-label { font-weight: 700; font-size: 0.9rem; }
.stats-tile-sub { color: var(--color-text-muted); font-size: 0.78rem; line-height: 1.45; margin-top: 4px; }
.stats-tile-sub strong { color: var(--color-text); }
.stats-tile-goal { background: rgba(34, 201, 140, 0.07); border-color: var(--color-success); }
.stats-tile-goal .stats-tile-value { color: var(--color-success-dark); }
.stats-footnote { margin: 10px 2px 16px; color: var(--color-text-muted); font-size: 0.78rem; line-height: 1.45; }
.stats-daily { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.stats-daily th { text-align: right; color: var(--color-text-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 4px; }
.stats-daily td { text-align: right; padding: 7px 4px; border-top: 1px solid var(--border-subtle); }
.stats-daily th:first-child, .stats-daily td:first-child { text-align: left; }
.stats-daily td strong { color: var(--color-success-dark); }
.stats-daily td:first-child strong { color: var(--color-brand-dark); }
.stats-muted { color: var(--color-text-muted); font-style: italic; }
.stats-footnote code { background: var(--color-surface-active); padding: 1px 5px; border-radius: 5px; font-size: 0.95em; word-break: break-all; }
@media (max-width: 600px) {
    .stats-funnel { grid-template-columns: 1fr; }
}


/* ===== Ordenar ejercicios arrastrando el asa (workout_detail.html) =====
Mientras dura el arrastre, la lista (.reorder-mode) y el clon que sigue al
dedo (.sortable-fallback, colgado de <body>) se compactan al título. */

#workoutExercisesList .drag-handle { color: #b5b0c9; cursor: grab; }
#workoutExercisesList.reorder-mode .notes-box,
#workoutExercisesList.reorder-mode .set-table-wrap,
#workoutExercisesList.reorder-mode > .card > .btn-outline,
#workoutExercisesList.reorder-mode .exercise-card-actions,
.card.sortable-fallback .notes-box,
.card.sortable-fallback .set-table-wrap,
.card.sortable-fallback > .btn-outline,
.card.sortable-fallback .exercise-card-actions { display: none; }
/* !important: ese <span> de acciones lleva display:flex en línea. */
#workoutExercisesList.reorder-mode .exercise-header > span,
.card.sortable-fallback .exercise-header > span { display: none !important; }
#workoutExercisesList.reorder-mode > .card,
.card.sortable-fallback {
    padding-top: 8px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    animation: none !important;
}
.card.sortable-fallback {
    height: auto !important;
    opacity: 0.96 !important;
    cursor: grabbing;
    box-shadow: 0 16px 36px rgba(var(--accent-rgb), 0.35) !important;
}
#workoutExercisesList.reorder-mode .exercise-header a { pointer-events: none; }
#workoutExercisesList.reorder-mode .exercise-header h3 > img,
#workoutExercisesList.reorder-mode .exercise-header h3 > div,
.card.sortable-fallback .exercise-header h3 > img,
.card.sortable-fallback .exercise-header h3 > div {
    width: 36px !important;
    height: 36px !important;
}
#workoutExercisesList.reorder-mode .drag-handle,
.card.sortable-fallback .drag-handle { color: var(--color-brand); }
.sortable-ghost { opacity: 0.35; }

/* ===== Filas de series: entrar / salir ===== */

.set-table tr.set-row-removing {
    opacity: 0;
    transform: translateX(-14px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
    .set-table tr.set-row-entering { animation: row-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
}
@keyframes row-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

/* ===== Fluidez general ===== */

/* Sin retardo de doble toque en móvil al pulsar controles. */
button, a, select, input, label { touch-action: manipulation; }

/* Respuesta al pulsar: todo lo tocable "se hunde" un poco. .btn ya tenía
transición de transform; el resto la gana aquí. */
.btn-outline, .btn-icon, .btn-nav, .effort-chip, .bottom-nav-item,
.bottom-nav-profile-btn, .routine-block-default-btn {
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
                transform 0.1s ease, box-shadow 0.15s ease;
}
@media (prefers-reduced-motion: no-preference) {
    .btn:active, .btn-outline:active, .btn-icon:active, .btn-nav:active,
    .effort-chip:active, .bottom-nav-item:active, .bottom-nav-profile-btn:active,
    .routine-block-default-btn:active, .btn-google:active, .btn-finish:active {
        transform: scale(0.95);
    }

    /* Las tarjetas entran con un leve deslizamiento escalonado al cargar.
    fill-mode "backwards" (no "both") a propósito: al terminar no deja un
    transform fijado que pise las animaciones inline de SortableJS. */
    .card { animation: card-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
    .card:nth-child(2) { animation-delay: 0.03s; }
    .card:nth-child(3) { animation-delay: 0.06s; }
    .card:nth-child(4) { animation-delay: 0.09s; }
    .card:nth-child(5) { animation-delay: 0.12s; }
    .card:nth-child(n+6) { animation-delay: 0.15s; }

    .routine-block-details[open] > .routine-section { animation: fade-down 0.22s ease-out; }
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
@keyframes fade-down {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* ===== Añadir ejercicio al entreno (workout_detail.html) =====
Clases propias: .add-exercise-row/.exercise-picker-field siguen siendo las
del formulario de rutinas, que no cambia. Es un <button>, así que se
sobrescribe explícitamente todo lo que pone la regla global de button. */

.add-exercise-form { margin: 4px 0 18px; }
.add-exercise-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 0;
    padding: 16px 18px;
    background: var(--surface-3);
    color: var(--color-brand-dark);
    border: 2px dashed #cbbfff;
    border-radius: var(--radius-card);
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.add-exercise-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}
.add-exercise-tile-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.add-exercise-tile-text strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.add-exercise-tile-text small {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text-muted);
}
.add-exercise-tile-search { display: flex; color: var(--color-brand); flex-shrink: 0; }
@media (hover: hover) {
    .add-exercise-tile:hover {
        background: #f3efff;
        border-color: var(--color-brand);
        color: var(--color-brand-dark);
        box-shadow: none;
    }
}
.add-exercise-tile:active { transform: scale(0.98); }
.add-exercise-form.is-submitting .add-exercise-tile { pointer-events: none; opacity: 0.75; }
@media (prefers-reduced-motion: no-preference) {
    .add-exercise-form.is-submitting .add-exercise-tile-icon { animation: tile-pulse 0.8s ease-in-out infinite; }
}
@keyframes tile-pulse {
    50% { transform: scale(0.9); }
}
@media (max-width: 600px) {
    .add-exercise-tile { padding: 14px; gap: 12px; }
    .add-exercise-tile-icon { width: 42px; height: 42px; border-radius: 12px; }
}

/* Al volver de añadir un ejercicio, la página salta a su tarjeta
(#ex-<nombre>) y la resalta un momento para que se vea dónde ha caído. */
.card[id^="ex-"] { scroll-margin-top: 16px; }
@media (prefers-reduced-motion: no-preference) {
    .card[id^="ex-"]:target { animation: target-flash 1.4s ease-out; }
}
@keyframes target-flash {
    0%, 30% { box-shadow: 0 0 0 3px var(--color-brand), var(--shadow-elevated); }
    100% { box-shadow: var(--shadow-elevated); }
}

/* ===== Terminar entrenamiento (workout_detail.html) =====
Sustituye al "✓ Guardar y finalizar" pequeño: botón ancho con icono de
bandera, texto que dice claramente qué hace y el progreso de series en
vivo. .btn-finish se mantiene para el botón de la propia página de cierre. */

.finish-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
}
/* Separa "Añadir ejercicio" (sigue el entreno) de "Terminar entreno" (lo
cierra): línea con etiqueta centrada para que no se lean como un mismo bloque. */
.workout-end-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 34px 0 18px;
    color: var(--color-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.workout-end-divider::before,
.workout-end-divider::after {
    content: "";
    flex: 1;
    height: 1.5px;
    background: var(--color-border-soft);
}
.finish-workout-cta {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, #22c98c, #17a973);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(34, 201, 140, 0.35);
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.finish-cta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
}
.finish-cta-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.finish-cta-text strong { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.01em; }
.finish-cta-text small {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.88;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.finish-cta-arrow { display: flex; flex-shrink: 0; opacity: 0.9; }
@media (hover: hover) {
    .finish-workout-cta:hover { color: #fff; box-shadow: 0 10px 26px rgba(34, 201, 140, 0.45); }
}
.finish-workout-cta:active { transform: scale(0.97); }
.finish-bar .action-menu-btn { height: 48px; }
/* Todas las series hechas: el botón "llama" suavemente para cerrar el entreno. */
@media (prefers-reduced-motion: no-preference) {
    .finish-workout-cta.all-done { animation: finish-glow 1.8s ease-in-out infinite; }
}
@keyframes finish-glow {
    0%, 100% { box-shadow: 0 8px 22px rgba(34, 201, 140, 0.35); }
    50%      { box-shadow: 0 8px 22px rgba(34, 201, 140, 0.35), 0 0 0 6px rgba(34, 201, 140, 0.22); }
}
@media (max-width: 600px) {
    .finish-workout-cta { padding: 12px 14px; gap: 12px; }
    .finish-cta-icon { width: 40px; height: 40px; }
    .finish-cta-text strong { font-size: 1rem; }
}

/* ===== Menú ⋮ del entreno: guardar como rutina / eliminar =====
Cada opción con su propio sombreado (morado = guardar, rojo = eliminar),
subtítulo que dice qué hace, y una línea entre ambas para no pulsar una
por la otra. */

.workout-actions-menu {
    min-width: 250px;
    padding: 6px;
    border-color: var(--color-border-soft);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
}
.workout-actions-menu form { margin: 0; }
.workout-actions-menu button {
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
}
.workout-actions-menu .menu-item-save { background: var(--color-surface-hover); }
.workout-actions-menu .menu-item-delete { background: #fff1f1; }
.workout-actions-menu .menu-item-delete .icon { color: var(--color-danger); }
.workout-actions-menu form + form {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1.5px solid var(--color-border-soft);
}
.menu-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.menu-item-text strong { font-size: 0.9rem; }
.menu-item-text small { font-size: 0.75rem; color: var(--color-text-muted); font-weight: 500; }
.menu-item-delete .menu-item-text strong { color: var(--color-danger); }
@media (hover: hover) {
    .workout-actions-menu .menu-item-save:hover { background: var(--color-surface-active); }
    .workout-actions-menu .menu-item-delete:hover { background: #ffe3e3; }
}
/* "Eliminar rutina" (routine_detail.html): mismo aspecto que la opción roja
del menú ⋮ del entreno, pero como botón suelto junto a "Iniciar". */
.routine-actions-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.routine-actions-bar form { margin: 0; }
.routine-actions-bar .btn { margin: 0; }
button.delete-tile {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: #fff1f1;
    color: var(--color-danger);
    text-align: left;
    font-family: inherit;
}
.delete-tile .menu-item-text strong { color: var(--color-danger); }
@media (hover: hover) {
    button.delete-tile:hover { background: #ffe3e3; }
}
button.delete-tile:active { transform: scale(0.97); }

/* ===== Botón del análisis de IA (ai_analysis.html) =====
Antes era un .btn deshabilitado con "Disponible el dd/mm/aaaa" -- parecía
roto. Ahora: tarjeta de estado con cuánto falta y barra de progreso
cuando está bloqueado, y un botón grande tipo "Terminar entreno" cuando
se puede pedir. */

.ai-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: var(--radius-card);
    text-align: left;
    font-family: inherit;
}
.ai-cta-icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
}
.ai-cta-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-cta-body strong { font-size: 1rem; line-height: 1.25; }
.ai-cta-body small { font-size: 0.78rem; }

.ai-cta-locked {
    background: var(--surface);
    border: 1px solid var(--color-border-soft);
    box-shadow: var(--shadow-elevated);
}
.ai-cta-locked .ai-cta-icon { background: var(--color-surface-active); color: var(--color-brand); }
.ai-cta-locked .ai-cta-body small {
    color: var(--color-brand);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem;
}
.ai-cta-locked .ai-cta-body strong { color: var(--color-text); }
.ai-cta-detail { color: var(--color-text-muted); font-size: 0.8rem; line-height: 1.35; }
.ai-cta-progress {
    height: 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: var(--color-surface-active);
    overflow: hidden;
}
.ai-cta-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.ai-request-form p { margin-top: 0; }
.ai-request-form textarea {
    margin-top: 6px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 12px;
    resize: vertical;
}
.ai-request-form textarea:focus { outline: none; border-color: var(--color-brand); }
button.ai-cta-ready {
    margin: 4px 0 0;
    border: none;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 22px rgba(var(--accent-rgb), 0.35);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.ai-cta-ready .ai-cta-icon { background: rgba(255, 255, 255, 0.2); color: #fff; }
.ai-cta-ready .ai-cta-body small { color: rgba(255, 255, 255, 0.85); font-weight: 500; }
.ai-cta-ready .ai-cta-arrow { flex-shrink: 0; display: flex; opacity: 0.85; }
@media (hover: hover) {
    button.ai-cta-ready:hover { box-shadow: 0 10px 26px rgba(var(--accent-rgb), 0.45); }
}
button.ai-cta-ready:active { transform: scale(0.97); }
button.ai-cta-ready:disabled { opacity: 0.8; cursor: progress; }
@media (prefers-reduced-motion: no-preference) {
    button.ai-cta-ready:disabled .ai-cta-icon { animation: tile-pulse 0.8s ease-in-out infinite; }
}

/* ===== Login y registro (login.html / register.html) =====
Tarjeta centrada a juego con la landing: es el siguiente paso tras
"Crear cuenta gratis", así que no puede verse como un formulario suelto. */

.auth-card {
    max-width: 400px;
    margin: 20px auto 40px;
    padding: 28px 22px 24px;
    background: var(--surface);
    border: 1px solid var(--color-border-soft);
    border-radius: 22px;
    box-shadow: var(--shadow-elevated);
    text-align: center;
    box-sizing: border-box;
}
.auth-logo { width: 52px; height: 52px; object-fit: contain; }
.auth-card h1 { margin: 10px 0 6px; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-subtitle { margin: 0 0 20px; color: var(--color-text-muted); }
.btn-google.auth-google { display: flex; width: 100%; box-sizing: border-box; padding: 12px 18px; border-radius: 12px; margin: 0; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--color-text-muted); font-size: 0.82rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border-soft); }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; font-weight: 600; color: #444; }
.auth-form input[type="text"], .auth-form input[type="email"], .auth-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 12px;
    background: var(--surface-2);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-form input:focus { outline: none; border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); background: var(--surface); }
.auth-form input.auth-input-error { border-color: var(--color-danger); }
.auth-error { color: var(--color-danger); font-size: 0.8rem; font-weight: 500; }
.auth-form label.auth-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.auth-form input.auth-submit {
    width: 100%;
    margin: 4px 0 0;
    padding: 13px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.35);
}
.auth-switch { margin: 18px 0 0; font-size: 0.9rem; color: var(--color-text-muted); }
.auth-switch a { color: var(--color-brand); font-weight: 700; text-decoration: none; }

/* ===== Compartir récord (app/static/share_card.js) ===== */
.pr-badge[role="button"] { cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
    .pr-badge[role="button"]:active { transform: scale(1.3); transition: transform 0.1s ease; }
}

.share-card-sheet { max-width: 520px; margin: 0 auto; }
.share-card-preview {
    display: grid;
    place-items: center;
    min-height: 200px;
    padding: 4px 16px 0;
}
.share-card-preview img {
    display: block;
    max-width: 100%;
    max-height: 52vh;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(18, 12, 44, 0.35);
}
.share-card-loading { color: var(--color-text-muted); font-size: 0.9rem; }
.share-card-actions { display: flex; gap: 10px; padding: 16px 16px 4px; }
.share-card-actions button { flex: 1; margin: 0; padding: 12px; font-size: 0.95rem; border-radius: 12px; }
.share-card-actions button:disabled { opacity: 0.5; cursor: progress; }
.share-card-hint { margin: 6px 16px 18px; text-align: center; color: var(--color-text-muted); font-size: 0.8rem; }

.pr-share-toast {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    left: 50%;
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(420px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 10px 10px 10px 12px;
    border-radius: 16px;
    background: #1c1247;
    color: #fff;
    box-shadow: 0 14px 34px rgba(18, 12, 44, 0.4);
    transform: translate(-50%, -140%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.pr-share-toast.visible { transform: translate(-50%, 0); }
.pr-share-toast-medal { font-size: 1.6rem; line-height: 1; }
.pr-share-toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pr-share-toast-text strong { font-size: 0.95rem; }
.pr-share-toast-text small { color: rgba(255, 255, 255, 0.7); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.pr-share-toast-btn {
    margin: 0;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #1c1247;
    background: linear-gradient(135deg, #5cf0b4, #22c98c);
    white-space: nowrap;
}

/* ===== Inicio: acción principal (index.html) =====
Continuar el entreno en curso / empezar la rutina que toca / entreno libre. */
.home-cta { margin: 0 0 16px; }
.home-cta form { margin: 0; }
.home-cta-main {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 16px 16px 16px 14px;
    border: none;
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, var(--accent-light), var(--accent-2));
    color: #fff;
    text-align: left;
    text-decoration: none;
    font-family: inherit;
    box-shadow: 0 10px 26px rgba(var(--accent-rgb), 0.35);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.home-cta-main.home-cta-continue {
    background: linear-gradient(135deg, #22c98c, #17a973);
    box-shadow: 0 10px 26px rgba(34, 201, 140, 0.35);
}
@media (hover: hover) {
    .home-cta-main:hover { color: #fff; box-shadow: 0 14px 32px rgba(var(--accent-rgb), 0.45); }
    .home-cta-main.home-cta-continue:hover { box-shadow: 0 14px 32px rgba(34, 201, 140, 0.45); }
}
.home-cta-main:active { transform: scale(0.98); }
.home-cta-icon {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
}
.home-cta-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.home-cta-text small {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.85;
}
.home-cta-text strong { font-size: 1.15rem; line-height: 1.25; overflow-wrap: anywhere; }
.home-cta-text > span { font-size: 0.82rem; opacity: 0.85; }
.home-cta-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7); }
.home-cta-arrow { flex-shrink: 0; display: flex; opacity: 0.85; }
.home-cta-secondary { display: flex; gap: 8px; margin-top: 10px; }
.home-cta-secondary form { flex: 1; }
.home-cta-secondary a,
.home-cta-secondary button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 12px;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--color-brand-dark);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
@media (hover: hover) {
    .home-cta-secondary a:hover, .home-cta-secondary button:hover { background: var(--color-surface-hover); }
}

/* ===== Inicio: primeros pasos de un usuario nuevo ===== */
.onboarding { margin-bottom: 16px; }
.onboarding-head { display: flex; justify-content: space-between; align-items: baseline; }
.onboarding-head strong { font-size: 1rem; }
.onboarding-head span { color: var(--color-text-muted); font-size: 0.82rem; font-weight: 600; }
.onboarding-bar { height: 6px; margin: 10px 0 14px; border-radius: 999px; background: var(--color-surface-active); overflow: hidden; }
.onboarding-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c98c, #17a973); }
.onboarding-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.onboarding-steps li { display: flex; align-items: flex-start; gap: 12px; color: var(--color-text-muted); }
.onboarding-steps li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.onboarding-steps strong { font-size: 0.92rem; font-weight: 600; }
.onboarding-steps small { font-size: 0.8rem; line-height: 1.4; }
.onboarding-check {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--color-border-soft);
    font-size: 0.8rem;
    font-weight: 700;
}
.onboarding-steps li.current { color: var(--color-text); }
.onboarding-steps li.current strong { font-weight: 700; }
.onboarding-steps li.current .onboarding-check { border-color: var(--color-brand); color: var(--color-brand-dark); background: var(--color-surface-hover); }
.onboarding-steps li.done strong { text-decoration: line-through; }
.onboarding-steps li.done .onboarding-check { border: none; color: #fff; background: linear-gradient(135deg, #22c98c, #17a973); }

/* ===== Título del entreno renombrable (workout_detail.html) ===== */
.workout-title { display: flex; align-items: center; gap: 8px; margin: 0.67em 0; }
.workout-title h1 { margin: 0; font-weight: 800; letter-spacing: -0.02em; min-width: 0; overflow-wrap: anywhere; }
button.workout-rename-btn {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: var(--color-surface-active);
    color: var(--color-brand);
}
.workout-title-input {
    width: 100%;
    padding: 4px 10px;
    font: inherit;
    font-size: 1.6rem;
    font-weight: 800;
    border: 2px solid var(--color-brand);
    border-radius: 12px;
    box-sizing: border-box;
}

/* ===== Terminar entreno (finish_workout.html) =====
Primero el resumen de la sesión (el momento de "lo he hecho"), luego la
valoración con botones en vez del <select> que se salía de la pantalla. */
.finish-hero {
    margin: 4px 0 16px;
    padding: 22px 18px 18px;
    border-radius: 22px;
    color: #fff;
    text-align: center;
    background: radial-gradient(500px 240px at 85% -20%, rgba(var(--accent-rgb), 0.55), transparent 70%),
                linear-gradient(160deg, #1c1247, #2a1670);
    box-shadow: 0 14px 34px rgba(28, 18, 71, 0.3);
}
.finish-hero-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, #22c98c, #17a973); }
.finish-hero h1 { margin: 12px 0 4px; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.finish-hero > p { margin: 0; color: rgba(255, 255, 255, 0.72); font-size: 0.9rem; }
.finish-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 18px; }
.finish-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); }
.finish-stats strong { font-size: 1.15rem; font-weight: 800; white-space: nowrap; }
.finish-stats strong small { font-size: 0.7rem; font-weight: 600; opacity: 0.8; }
.finish-stats span { font-size: 0.7rem; color: rgba(255, 255, 255, 0.7); }
p.finish-compare { margin: 14px 0 0; font-size: 0.88rem; font-weight: 700; color: rgba(255, 255, 255, 0.85); }
p.finish-compare.up { color: #5cf0b4; }
p.finish-compare.down { color: #ffb4b4; }
.finish-warning { margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: #fff8e1; border: 1px solid #ffe08a; color: #6b5200; font-size: 0.88rem; line-height: 1.45; }
.finish-warning a { display: inline-block; margin-top: 6px; font-weight: 700; color: #6b5200; }
.finish-prs h3 { margin: 0 0 10px; font-size: 1rem; }
.finish-pr-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.finish-pr-row div { display: flex; flex-direction: column; min-width: 0; }
.finish-pr-row small { color: var(--color-text-muted); }
.finish-pr-row .finish-pr-share { margin: 0; flex-shrink: 0; }
.finish-form { display: flex; flex-direction: column; gap: 20px; }
.finish-field { display: flex; flex-direction: column; gap: 8px; }
.finish-label { font-weight: 700; font-size: 0.95rem; }
.finish-label small { font-weight: 500; color: var(--color-text-muted); }
.finish-form textarea {
    padding: 10px 12px;
    font-family: inherit;
    font-size: 16px;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 12px;
    resize: vertical;
}
.finish-form textarea:focus, .duration-inputs input:focus { outline: none; border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
.rating-scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
button.rating-chip {
    margin: 0;
    padding: 0;
    height: 42px;
    border-radius: 10px;
    border: 1.5px solid var(--chip);
    background: var(--surface);
    color: var(--chip-text, var(--chip));
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
button.rating-chip.selected { background: var(--chip-text, var(--chip)); border-color: var(--chip-text, var(--chip)); color: #fff; transform: scale(1.06); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15); }
.rating-1, .rating-2 { --chip: #e5484d; --chip-text: #b8282d; }
.rating-3, .rating-4 { --chip: #f08c2e; --chip-text: #9a5200; }
.rating-5, .rating-6 { --chip: #c9a400; --chip-text: #7a6300; }
.rating-7, .rating-8 { --chip: #4cb35a; --chip-text: #2a7a35; }
.rating-9, .rating-10 { --chip: #17a973; --chip-text: #0f7d54; }
.rating-scale-ends { display: flex; justify-content: space-between; color: var(--color-text-muted); font-size: 0.72rem; }
.rating-desc { margin: 0; min-height: 2.6em; color: var(--color-text-muted); font-size: 0.86rem; line-height: 1.4; }
.rating-desc strong { color: var(--color-text); }
.rating-desc.rating-desc-missing, .finish-error { color: var(--color-danger); font-weight: 600; }
.finish-error { margin: 0; font-size: 0.85rem; }
.duration-inputs { display: flex; gap: 10px; }
.duration-inputs label { display: flex; align-items: center; gap: 6px; color: var(--color-text-muted); font-weight: 600; }
.duration-inputs input {
    width: 72px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 12px;
    box-sizing: border-box;
}
.finish-hint { margin: 0; color: #8a6d00; background: #fff8e1; padding: 8px 10px; border-radius: 10px; font-size: 0.8rem; line-height: 1.4; }
button.finish-submit { width: 100%; margin: 4px 0 0; border: none; font-family: inherit; text-align: left; cursor: pointer; }
.finish-back { text-align: center; margin: 16px 0 24px; }
.finish-back a { color: var(--color-text-muted); text-decoration: none; font-weight: 600; }
@media (max-width: 380px) {
    .finish-stats strong { font-size: 1rem; }
    button.rating-chip { height: 38px; font-size: 0.85rem; border-radius: 8px; }
}

/* ===== Fase 2: Progreso, página de ejercicio y tarjetas de rutina ===== */
.page-title { font-weight: 800; letter-spacing: -0.02em; }
.page-back { margin: 4px 0 -6px; }
.page-back a { color: var(--color-text-muted); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
@media (hover: hover) { .page-back a:hover { color: var(--color-brand); } }
.section-title { margin: 24px 0 10px; font-size: 1.1rem; font-weight: 800; }

/* Progreso (progress.html) */
a.progress-weight { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; }
.progress-weight-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--color-surface-active); color: var(--color-brand); flex-shrink: 0; }
.progress-weight-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.progress-weight-text small { color: var(--color-text-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.progress-weight-text strong { font-size: 1.2rem; }
.progress-weight-text span { color: var(--color-text-muted); font-size: 0.8rem; }
a.progress-weight > .icon { color: var(--color-text-muted); }
.progress-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 22px 0 10px; }
.progress-toolbar h2 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.progress-toolbar h2 span { color: var(--color-text-muted); font-weight: 600; font-size: 0.9rem; margin-left: 4px; }
.progress-search {
    flex: 1 1 180px;
    max-width: 280px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 16px;
    border: 1.5px solid var(--color-border-soft);
    border-radius: 12px;
    background: var(--surface);
}
.progress-search:focus { outline: none; border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
.progress-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--color-border-soft); border-radius: var(--radius-card); box-shadow: var(--shadow-elevated); overflow: hidden; }
.progress-list li + li { border-top: 1px solid var(--border-subtle); }
a.progress-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; }
@media (hover: hover) { a.progress-row:hover { background: var(--color-surface-hover); } }
a.progress-row:active { background: var(--color-surface-active); }
.progress-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.progress-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.progress-main strong { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-main small { color: var(--color-text-muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.progress-figures strong { font-size: 1rem; font-weight: 800; color: var(--color-brand-dark); }
.trend { font-size: 0.72rem; font-weight: 700; color: var(--color-text-muted); padding: 2px 7px; border-radius: 999px; background: var(--surface-3); }
.trend-up { color: #0f7d54; background: #e3f9ef; }
.trend-down { color: #c62828; background: #fdecec; }
.trend-stuck { color: #845800; background: #fff4d6; }
.progress-footnote { color: var(--color-text-muted); font-size: 0.78rem; margin: 10px 2px 24px; }
.progress-empty-search { color: var(--color-text-muted); text-align: center; margin: 16px 0; }
.progress-empty { text-align: center; }
.progress-empty p { color: var(--color-text-muted); margin: 6px 0; }
.progress-empty p strong { color: var(--color-text); }
.progress-empty .btn { margin-top: 10px; }

/* Página de ejercicio (exercise_progress.html) */
.exercise-title { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.02em; }
.exercise-title img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }
.exercise-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.exercise-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 4px; text-align: center; background: var(--surface); border: 1px solid var(--color-border-soft); border-radius: 14px; }
.exercise-stats strong { font-size: 1.2rem; font-weight: 800; color: var(--color-brand-dark); white-space: nowrap; }
.exercise-stats strong small { font-size: 0.7rem; font-weight: 600; color: var(--color-text-muted); }
.exercise-stats strong.up { color: var(--color-success-text); }
.exercise-stats strong.down { color: #c62828; }
.exercise-stats span { font-size: 0.7rem; color: var(--color-text-muted); }
.exercise-stats-foot { margin: 8px 2px 16px; color: var(--color-text-muted); font-size: 0.82rem; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h3 { margin: 0; font-size: 1rem; }
.chart-legend { display: flex; gap: 12px; color: var(--color-text-muted); font-size: 0.75rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.chart-box { position: relative; height: 230px; }
.session-card { padding-top: 14px; padding-bottom: 14px; }
.session-card-pr { border-color: rgba(34, 201, 140, 0.45); }
.session-card-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.session-card-head > span { color: var(--color-text-muted); font-size: 0.82rem; }
.session-pr-badge { color: #0f7d54 !important; font-weight: 700; }
.session-1rm { margin-left: auto; font-weight: 700; color: var(--color-brand-dark) !important; }
.session-sets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.session-set { padding: 5px 10px; border-radius: 10px; background: var(--surface-3); font-size: 0.85rem; font-weight: 600; }
.session-set small { color: var(--color-text-soft); font-weight: 500; }
.session-set.best { background: var(--color-surface-active); color: var(--color-brand-dark); }
.session-card-head { align-items: center; }
button.session-set { border: 0; font-family: inherit; color: inherit; cursor: pointer; line-height: inherit; }
button.session-set.best { color: var(--color-brand-dark); }
.session-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: -6px -6px -6px 0;
    border: 0; border-radius: 10px; background: transparent; color: var(--color-text-muted); cursor: pointer; }
.session-edit-hint { margin: -4px 0 10px; }
.session-sheet a.set-type-option { text-decoration: none; color: inherit; }
.session-sheet-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 10px; background: var(--surface-3); color: var(--accent); }
.session-sheet-danger .session-sheet-icon, .session-sheet-danger strong { color: var(--color-danger, #c62828); }
@media (max-width: 340px) {
    .exercise-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Tarjeta de rutina compacta (routines.html) */
.routine-card.routine-card-compact { padding: 12px 12px 12px 6px; }
.routine-card-row { display: flex; align-items: center; gap: 8px; }
.routine-card-compact .drag-handle { flex-shrink: 0; width: 28px; height: 40px; display: grid; place-items: center; }
a.routine-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
a.routine-card-main strong { font-size: 1.02rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.routine-card-main small { color: var(--color-text-muted); font-size: 0.8rem; }
@media (hover: hover) { a.routine-card-main:hover strong { color: var(--color-brand); } }
.routine-card-compact .routine-pin-btn { margin: 0; flex-shrink: 0; }
.routine-start-form { margin: 0; flex-shrink: 0; }
button.routine-start-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 14px;
    box-shadow: 0 6px 14px rgba(var(--accent-rgb), 0.3);
}
button.routine-start-btn:disabled { opacity: 0.35; box-shadow: none; cursor: not-allowed; }
.routine-card-sub { display: flex; align-items: center; gap: 10px; margin: 8px 0 0 34px; }
.routine-card-exercises { flex: 1; min-width: 0; color: var(--color-text-muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-card-exercises a { color: var(--color-brand-dark); font-weight: 600; text-decoration: none; }
.routine-block-chip {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 50%;
    padding: 4px 8px 4px 9px;
    border-radius: 999px;
    border: 1.5px solid var(--color-border-soft);
    background: var(--surface);
    color: var(--color-text);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}
.routine-block-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-color, #c9c3e6); flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); }
.routine-block-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-block-chip.none { color: var(--color-text-muted); border-style: dashed; }
.routine-block-chip .icon { flex-shrink: 0; color: var(--color-text-muted); }
/* El <select> real cubre la etiqueta entera, invisible: un toque abre el
selector nativo del sistema, igual que antes. */
.routine-block-chip select.routine-block-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    max-width: none;
    opacity: 0;
    margin: 0;
    padding: 0;
    border: 0;
    cursor: pointer;
    font-size: 16px;
}
.routine-card-sub .routine-block-input { flex: 0 1 50%; min-width: 0; }

/* ===== Fase 3: cabecera móvil, formularios y página de rutina ===== */

/* Con sesión iniciada, en el móvil la barra inferior ya navega: la píldora
"Gyre" de arriba solo ocupaba ~70 px en cada pantalla. */
@media (max-width: 600px) {
    .top-nav.top-nav-app { display: none; }
    body:has(.top-nav-app) { padding-top: max(10px, env(safe-area-inset-top)); }
    .page-back { margin-top: 0; }
}

/* Formularios (.form-ui, opt-in por página: no toca los campos de la tabla
de series ni el buscador de ejercicios, que tienen su propio estilo). */
.form-ui .field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 18px; }
.form-ui .field:last-child { margin-bottom: 0; }
.form-ui .field-label { font-weight: 700; font-size: 0.92rem; color: var(--color-text); }
.form-ui .field-help { color: var(--color-text-muted); font-size: 0.8rem; line-height: 1.45; margin: 0; }
.form-ui p.field-help { margin: -6px 0 16px; }
.form-ui .field-error { color: var(--color-danger); font-size: 0.82rem; font-weight: 600; }
.form-section-title { margin: 0 0 16px; font-size: 1.05rem; font-weight: 800; }
.form-ui input[type="text"],
.form-ui input[type="number"],
.form-ui input[type="email"],
.form-ui input[type="password"],
.form-ui input[type="date"],
.form-ui select,
.form-ui textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 16px;
    color: var(--color-text);
    border: 1.5px solid var(--color-border-soft);
    border-radius: 12px;
    background-color: var(--surface-2);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-ui textarea { resize: vertical; line-height: 1.45; }
.form-ui select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237c4dff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.form-ui input:focus, .form-ui select:focus, .form-ui textarea:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    background-color: var(--surface);
}
.form-ui .input-short { max-width: 110px; }
.form-ui .inline-inputs { display: flex; gap: 12px; }
.form-ui .inline-inputs label { display: flex; align-items: center; gap: 6px; color: var(--color-text-muted); font-weight: 600; }
.form-ui .form-submit { display: block; width: 100%; margin: 18px 0 8px; padding: 13px; font-size: 1rem; border-radius: 12px; }
.form-ui.card .form-submit { margin-bottom: 0; }

/* Interruptor en lugar de casilla. */
.form-ui .toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}
input[type="checkbox"].toggle {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    position: relative;
    width: 48px;
    height: 28px;
    margin: 0;
    border-radius: 999px;
    background: #d9d4ea;
    cursor: pointer;
    transition: background 0.2s ease;
}
input[type="checkbox"].toggle::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;  /* siempre blanca, también en oscuro */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}
input[type="checkbox"].toggle:checked { background: linear-gradient(135deg, #22c98c, #17a973); }
input[type="checkbox"].toggle:checked::after { transform: translateX(20px); }
input[type="checkbox"].toggle:focus-visible { outline: 3px solid rgba(var(--accent-rgb), 0.35); outline-offset: 2px; }

/* Peso corporal */
.weight-form-row { display: flex; gap: 10px; align-items: stretch; }
.input-suffix { position: relative; flex: 1; max-width: 220px; }
.input-suffix input { padding-right: 42px !important; font-weight: 700; }
.input-suffix > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); font-weight: 700; pointer-events: none; }
.weight-form-row .btn { margin: 0; padding: 0 20px; border-radius: 12px; }

/* Página de rutina (routine_detail.html) */
.routine-detail-meta { display: flex; align-items: center; gap: 6px; margin: -8px 0 14px; color: var(--color-text-muted); font-size: 0.88rem; }
.routine-detail-meta .home-cta-dot { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); }
.routine-detail-hint { margin: -4px 0 12px; color: var(--color-text-muted); font-size: 0.82rem; }
.routine-ex-list { list-style: none; margin: 0 0 14px; padding: 0; }
.card.routine-ex { padding: 12px 12px 14px 6px; margin-bottom: 10px; }
.routine-ex-head { display: flex; align-items: center; gap: 8px; }
.routine-ex-head .drag-handle { flex-shrink: 0; width: 28px; height: 40px; display: grid; place-items: center; }
.routine-ex-img { width: 40px; height: 40px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
a.routine-ex-name { flex: 1; min-width: 0; font-weight: 800; font-size: 1rem; color: var(--color-text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { a.routine-ex-name:hover { color: var(--color-brand); } }
.routine-ex-head .btn-icon { margin: 0; flex-shrink: 0; }
.routine-ex-delete { margin: 0; }
.routine-ex-plan { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 10px 0 0 34px; }
.plan-field { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.plan-field input {
    width: 56px;
    box-sizing: border-box;
    padding: 8px 4px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    color: var(--color-brand-dark);
    border: 1.5px solid var(--color-border-soft);
    border-radius: 10px;
    background: var(--surface-2);
    -moz-appearance: textfield;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.plan-field input::-webkit-outer-spin-button,
.plan-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.plan-field-reps input { width: 76px; }
.plan-field input:focus { outline: none; border-color: var(--color-brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
.plan-field span { font-size: 0.68rem; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.plan-x { align-self: center; margin-bottom: 18px; color: var(--color-text-muted); font-weight: 700; }
.plan-field.saved input { border-color: var(--color-success); background: rgba(34, 201, 140, 0.08); }
a.routine-ex-rest { align-self: center; margin: 0 0 18px auto; }
.routine-detail-empty { display: flex; flex-direction: column; gap: 4px; text-align: center; color: var(--color-text-muted); font-size: 0.88rem; }
.routine-detail-empty strong { color: var(--color-text); font-size: 0.95rem; }
@media (prefers-reduced-motion: no-preference) {
    .card.routine-ex:target { animation: target-flash 1.4s ease-out; }
}
@media (max-width: 420px) {
    .routine-ex-plan { margin-left: 6px; gap: 6px; }
    .plan-field input { width: 48px; }
    .plan-field-reps input { width: 66px; }
}

/* ===== Fase 4: modo oscuro y accesibilidad ===== */
.home-quote { color: var(--color-brand-dark); font-style: italic; font-weight: 600; margin: 4px 0 20px; }

/* Ajustes de modo oscuro para los fondos de color "pastel" que en claro
son tintes suaves y en oscuro serían manchas brillantes: en oscuro pasan a
ser el mismo tono translúcido sobre la superficie, con el texto aclarado. */
:root { --icon-tile: #ececf7; }
:root[data-theme="dark"] { --icon-tile: #2a2545; }
:root[data-theme="dark"] .btn-outline { color: #aab6ff; border-color: #5560d6; }
:root[data-theme="dark"] .analysis-summary,
:root[data-theme="dark"] .analysis-proximos-pasos { background: #241f3f; }
:root[data-theme="dark"] .analysis-fortalezas { background: rgba(34, 201, 140, 0.12); }
:root[data-theme="dark"] .analysis-areas-mejora { background: rgba(255, 107, 107, 0.12); }
:root[data-theme="dark"] .workout-card .wc-date,
:root[data-theme="dark"] .calendar-day:not(.trained):not(.empty),
:root[data-theme="dark"] .exercise-result-thumb-fallback { background: var(--surface-3); }
:root[data-theme="dark"] .pill-success { background: rgba(34, 201, 140, 0.15); }
:root[data-theme="dark"] .flash { background: #2d2710; border-color: #6b5714; color: #f5d77a; }
:root[data-theme="dark"] .bottom-nav-profile-btn.active .nav-icon-wrap,
:root[data-theme="dark"] .bottom-nav-profile-btn.touch-pressed .nav-icon-wrap { background: var(--color-surface-active); }
:root[data-theme="dark"] .bottom-sheet-grabber { background: var(--border-strong); }
:root[data-theme="dark"] .effort-chip-empty { background: rgba(255, 107, 107, 0.12); color: #ff8a8a; }
:root[data-theme="dark"] .workout-actions-menu .menu-item-delete,
:root[data-theme="dark"] button.delete-tile { background: rgba(255, 107, 107, 0.12); }
:root[data-theme="dark"] .finish-warning,
:root[data-theme="dark"] .finish-hint { background: #2d2710; border-color: #5c4a12; color: #f2d27a; }
:root[data-theme="dark"] .finish-warning a { color: #f2d27a; }
:root[data-theme="dark"] .trend-up { background: rgba(34, 201, 140, 0.15); color: #5cf0b4; }
:root[data-theme="dark"] .trend-down { background: rgba(255, 107, 107, 0.15); color: #ff8a8a; }
:root[data-theme="dark"] .trend-stuck { background: rgba(240, 180, 0, 0.15); color: #f2c94c; }
:root[data-theme="dark"] .trend { background: var(--surface-3); }
:root[data-theme="dark"] .exercise-stats strong.up,
:root[data-theme="dark"] .onboarding-steps li.done strong { color: #5cf0b4; }
:root[data-theme="dark"] .exercise-stats strong.down { color: #ff8a8a; }
@media (hover: hover) {
    :root[data-theme="dark"] .btn-outline:hover,
    :root[data-theme="dark"] .add-exercise-tile:hover,
    :root[data-theme="dark"] .btn-google:hover { background: var(--color-surface-hover); }
    :root[data-theme="dark"] .btn-icon:hover,
    :root[data-theme="dark"] .btn-danger-outline:hover,
    :root[data-theme="dark"] .btn-nav.btn-nav-danger:hover,
    :root[data-theme="dark"] .workout-actions-menu .menu-item-delete:hover,
    :root[data-theme="dark"] button.delete-tile:hover { background: rgba(255, 107, 107, 0.2); }
    :root[data-theme="dark"] .set-check-btn:hover { background: rgba(34, 201, 140, 0.12); }
}

/* Zonas táctiles: iconos pequeños con un área de toque invisible de al
menos ~44 px, sin cambiar su tamaño ni la maquetación de la tabla. */
.btn-icon, .delete-set-btn, .drag-handle, .routine-pin-btn, .workout-rename-btn,
.sheet-close-btn, .pr-badge[role="button"] { position: relative; }
.btn-icon::after, .delete-set-btn::after, .drag-handle::after, .routine-pin-btn::after,
.sheet-close-btn::after, .pr-badge[role="button"]::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
}
:root[data-theme="dark"] button.rating-chip { --chip-text: var(--chip); }
:root[data-theme="dark"] button.rating-chip.selected { background: var(--chip); border-color: var(--chip); color: #12101f; }
:root[data-theme="dark"] .session-pr-badge { color: #5cf0b4 !important; }
:root[data-theme="dark"] .workout-card .wc-date { background: var(--surface-3); color: var(--color-text-soft); }
:root[data-theme="dark"] .rating-1, :root[data-theme="dark"] .rating-2 { --chip: #ff6b70; }
/* Campos sueltos fuera de .form-ui: mismo fondo y texto que el resto en ambos temas. */
.finish-form textarea, .duration-inputs input, .progress-search, .ai-request-form textarea,
.auth-form input[type="text"], .auth-form input[type="email"], .auth-form input[type="password"] {
    background-color: var(--surface-2);
    color: var(--color-text);
}
/* Análisis de IA en oscuro: los textos de cada tarjeta eran tonos oscuros pensados para fondo claro. */
:root[data-theme="dark"] .analysis-summary { color: var(--color-text); }
:root[data-theme="dark"] .analysis-fortalezas h3 { color: #5cf0b4; }
:root[data-theme="dark"] .analysis-fortalezas .analysis-placeholder { color: #9fe3c6; }
:root[data-theme="dark"] .analysis-areas-mejora h3 { color: #ff8a8a; }
:root[data-theme="dark"] .analysis-areas-mejora .analysis-placeholder { color: #f0b0b0; }
:root[data-theme="dark"] .analysis-proximos-pasos .analysis-placeholder { color: #b9aef0; }
/* Racha (index.html): días de esta semana frente al mínimo que la mantiene. */

/* ===== Resumen de entrenamiento en tarjetas (index.html) ===== */
.dash-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 0 18px; }
.dash-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 12px 12px 12px 13px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    color: inherit;
    text-decoration: none;
}
a.dash-tile { transition: transform 0.1s ease, border-color 0.15s ease; }
@media (hover: hover) { a.dash-tile:hover { border-color: var(--color-border-soft); } }
a.dash-tile:active { transform: scale(0.98); }
.dash-tile-head { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 700; color: var(--color-text-muted); }
.dash-tile-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; font-size: 0.85rem; flex-shrink: 0; }
.dash-tile-icon.is-brand { background: var(--color-surface-active); color: var(--color-brand); }
.dash-tile-value { font-size: 1.65rem; font-weight: 800; line-height: 1.1; color: var(--color-text); letter-spacing: -0.02em; }
.dash-tile-value small { font-size: 0.85rem; font-weight: 700; color: var(--color-text-muted); letter-spacing: 0; }
.dash-tile-value.up { color: var(--color-success-text); }
.dash-tile-value.down { color: var(--color-danger); }
.dash-tile-value.is-empty { color: var(--color-text-muted); }
.dash-tile-sub { font-size: 0.75rem; color: var(--color-text-muted); line-height: 1.35; }
.dash-tile-sub.ok { color: var(--color-success-text); font-weight: 700; }
.dash-tile-streak {
    background: linear-gradient(160deg, rgba(255, 138, 61, 0.14), rgba(255, 196, 77, 0.08)), var(--surface);
    border-color: rgba(255, 138, 61, 0.35);
}
.dash-spark { width: 100%; height: 26px; margin-top: 2px; overflow: visible; }
.dash-spark polyline { stroke: var(--color-brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.week-dots { display: flex; gap: 3px; margin: 4px 0 2px; }
.week-dot {
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--color-text-muted);
    background: var(--surface-3);
}
.week-dot.planned { box-shadow: inset 0 0 0 1.5px #ff9a4d; }
.week-dot.on { background: linear-gradient(135deg, #ff8a3d, #ff5f45); color: #fff; box-shadow: none; }
.week-dot.today { outline: 2px solid var(--color-text); outline-offset: 1px; }
:root[data-theme="dark"] .dash-tile-value.up, :root[data-theme="dark"] .dash-tile-sub.ok { color: #5cf0b4; }
:root[data-theme="dark"] .dash-tile-value.down { color: #ff8a8a; }
@media (min-width: 601px) {
    .dash-tiles { grid-template-columns: repeat(4, 1fr); }
}

/* Inicio: día de descanso / entreno de hoy hecho (index.html). */
.home-cta-calm {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px 18px 14px;
    border-radius: var(--radius-card);
    color: #fff;
}
/* Descanso: cielo nocturno (azul marino, estrellas y luna con brillo). */
.home-cta-calm.is-rest {
    background: radial-gradient(260px 160px at 12% 0%, rgba(124, 140, 255, 0.45), transparent 70%),
                linear-gradient(150deg, #1d2b64 0%, #121a45 55%, #0b1030 100%);
    box-shadow: 0 10px 26px rgba(18, 26, 69, 0.35);
}
.calm-sky {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Estrellas solo en la franja derecha, lejos del texto y de la pastilla. */
    background-image:
        radial-gradient(1.5px 1.5px at 84% 18%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 93% 34%, rgba(255, 255, 255, 0.8) 50%, transparent 51%),
        radial-gradient(2px 2px at 88% 62%, rgba(255, 255, 255, 0.9) 50%, transparent 51%),
        radial-gradient(1px 1px at 96% 80%, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
        radial-gradient(1px 1px at 80% 84%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 97% 12%, rgba(255, 255, 255, 0.7) 50%, transparent 51%);
}

.home-cta-calm.is-rest .calm-icon {
    position: relative;
    background: radial-gradient(circle at 50% 45%, rgba(255, 214, 102, 0.35), rgba(255, 255, 255, 0.08) 70%);
    box-shadow: 0 0 22px rgba(255, 214, 102, 0.35);
    font-size: 1.5rem;
}
/* Hecho: verde, a juego con "Terminar entreno". */
.home-cta-calm.is-done {
    background: linear-gradient(135deg, #22c98c, #129a69);
    box-shadow: 0 10px 26px rgba(34, 201, 140, 0.35);
}
.home-cta-calm.is-done .calm-icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
.home-cta-calm .home-cta-text { position: relative; gap: 2px; }
.home-cta-calm .home-cta-text small { opacity: 0.8; }
.home-cta-calm .home-cta-text strong { color: #fff; font-size: 1.2rem; }
.home-cta-calm .home-cta-text > span { color: rgba(255, 255, 255, 0.82); opacity: 1; font-size: 0.85rem; }
.home-cta-calm .home-cta-text > span.calm-next {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}
@media (prefers-reduced-motion: no-preference) {
    .home-cta-calm.is-rest .calm-icon { animation: moon-glow 4s ease-in-out infinite; }
    @keyframes moon-glow {
        50% { box-shadow: 0 0 30px rgba(255, 214, 102, 0.55); }
    }
}
.home-cta-hint { margin: 8px 2px 0; font-size: 0.8rem; color: var(--color-text-muted); }
.home-cta-hint a { color: var(--color-brand-dark); font-weight: 700; }

/* Configuración: días de entreno como fichas L M X J V S D. */
.day-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 44px)); gap: 6px; }
.day-chip { position: relative; cursor: pointer; }
.day-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.day-chip span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 40px;
    border-radius: 12px;
    border: 1.5px solid var(--color-border-soft);
    background: var(--surface-2);
    font-weight: 800;
    color: var(--color-text-muted);
    transition: background 0.15s ease, color 0.15s ease;
}
.day-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-chip input:focus-visible + span { outline: 3px solid rgba(var(--accent-rgb), 0.45); outline-offset: 2px; }

/* ===== Progreso: tarjeta de fuerza (progress.html) ===== */
.strength-card { scroll-margin-top: 16px; }
.strength-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.strength-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.strength-head p { margin: 2px 0 0; color: var(--color-text-muted); font-size: 0.8rem; }
.strength-pct { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.strength-pct strong { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: var(--color-text); }
.strength-pct span { font-size: 0.75rem; color: var(--color-text-muted); }
.strength-pct.up strong { color: var(--color-success-text); }
.strength-pct.down strong { color: var(--color-danger); }
.strength-chart { height: 180px; }
.strength-movers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.strength-movers > div { min-width: 0; }
.strength-movers h3 { margin: 0 0 6px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.strength-movers a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-subtle); color: var(--color-text); text-decoration: none; font-size: 0.85rem; }
.strength-movers a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strength-movers b { flex-shrink: 0; font-weight: 800; }
.strength-movers b.up { color: var(--color-success-text); }
.strength-movers b.down { color: var(--color-danger); }
.strength-how { margin-top: 12px; font-size: 0.82rem; color: var(--color-text-muted); }
.strength-how summary { cursor: pointer; font-weight: 700; color: var(--color-brand-dark); }
.strength-how p { margin: 8px 0 0; line-height: 1.5; }
:root[data-theme="dark"] .strength-pct.up strong, :root[data-theme="dark"] .strength-movers b.up { color: #5cf0b4; }
:root[data-theme="dark"] .strength-pct.down strong, :root[data-theme="dark"] .strength-movers b.down { color: #ff8a8a; }
@media (max-width: 420px) {
    .strength-movers { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Estándares de fuerza (progress.html) ===== */
.std-card { margin-top: 16px; scroll-margin-top: 16px; }
.std-global { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.std-global > span { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.std-missing { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--color-surface-active); font-size: 0.85rem; line-height: 1.45; }
.std-missing a { font-weight: 700; }
.std-list { display: flex; flex-direction: column; }
.std-row { padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.std-row:first-child { border-top: 0; padding-top: 4px; }
.std-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.std-row-head strong { font-size: 0.95rem; }
.std-sub { margin: 3px 0 0; font-size: 0.8rem; color: var(--color-text-muted); }
.std-next { margin: 4px 0 0; font-size: 0.78rem; color: var(--color-text-soft); }
.std-bar { height: 8px; margin-top: 8px; border-radius: 999px; background: var(--color-surface-active); overflow: hidden; }
.std-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--color-brand-soft), var(--color-brand)); }
.std-dots { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--border-subtle); font-size: 0.82rem; color: var(--color-text-muted); }
.std-dots strong { color: var(--color-text); }
.std-defs { margin: 8px 0 0; padding-left: 18px; line-height: 1.5; }
/* Insignia de nivel: colores sólidos con texto legible (AA) en claro y oscuro. */
.std-level { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; white-space: nowrap; }
.std-level.lvl--1 { background: var(--color-surface-active); color: var(--color-text-muted); }
.std-level.lvl-0 { background: #dff5e9; color: #0f6b47; }
.std-level.lvl-1 { background: #f6e3d3; color: #7a3f12; }
.std-level.lvl-2 { background: #e3e8f2; color: #34415a; }
.std-level.lvl-3 { background: #fbecc0; color: #6b4e00; }
.std-level.lvl-4 { background: #3d2b8a; color: #fff; }
:root[data-theme="dark"] .std-level.lvl-0 { background: #12382a; color: #8ff0c4; }
:root[data-theme="dark"] .std-level.lvl-1 { background: #3d2516; color: #f4c49c; }
:root[data-theme="dark"] .std-level.lvl-2 { background: #263043; color: #c9d4ea; }
:root[data-theme="dark"] .std-level.lvl-3 { background: #3d3110; color: #ffdd7a; }
:root[data-theme="dark"] .std-level.lvl-4 { background: #b9a6ff; color: #1b1238; }

/* Transición suave entre páginas (Chrome 126+; el resto simplemente cambia de página). */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.16s; }
    .bottom-nav { view-transition-name: bottom-nav; }
}

/* ===== Logros (achievements.html, aviso en index.html) ===== */
.achv-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: var(--radius-card);
    color: #fff;
    background: radial-gradient(420px 200px at 90% -30%, rgba(255, 196, 77, 0.45), transparent 70%),
                linear-gradient(150deg, #2a1670, #1c1247);
    box-shadow: 0 14px 34px rgba(28, 18, 71, 0.3);
}
.achv-summary strong { display: block; font-size: 1.35rem; font-weight: 800; }
.achv-summary span { color: rgba(255, 255, 255, 0.75); font-size: 0.85rem; }
.achv-summary-ring {
    --p: 0;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: conic-gradient(#ffc44d calc(var(--p) * 1%), rgba(255, 255, 255, 0.15) 0);
}
.achv-summary-ring span { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: #241a5a; color: #fff; font-weight: 800; font-size: 0.85rem; }
.achv-closest { display: grid; gap: 8px; }
.achv-mini { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-subtle); }
.achv-mini > div { flex: 1; min-width: 0; }
.achv-mini strong { font-size: 0.9rem; }
.achv-mini small { color: var(--color-text-muted); font-size: 0.75rem; }
.achv-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 22px -4px 4px; padding: 2px 4px 8px; scrollbar-width: none; }
.achv-tabs::-webkit-scrollbar { display: none; }
button.achv-tab {
    flex-shrink: 0;
    margin: 0;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--color-border-soft);
    background: var(--surface);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}
button.achv-tab small { color: var(--color-text-muted); font-weight: 600; margin-left: 2px; }
button.achv-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
button.achv-tab.active small { color: rgba(255, 255, 255, 0.8); }
.achv-count { color: var(--color-text-muted); font-weight: 600; font-size: 0.85rem; margin-left: 4px; }
.achv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.achv-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 12px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
}
.achv-card strong { font-size: 0.9rem; line-height: 1.25; }
.achv-card p { margin: 0; color: var(--color-text-muted); font-size: 0.76rem; line-height: 1.4; flex: 1; }
.achv-card small { color: var(--color-text-muted); font-size: 0.72rem; }
.achv-card.is-unlocked {
    border-color: rgba(255, 176, 31, 0.55);
    background: linear-gradient(160deg, rgba(255, 196, 77, 0.16), rgba(255, 196, 77, 0.03)), var(--surface);
}
.achv-card.is-secret { border-style: dashed; }
.achv-date { color: #a36400 !important; font-weight: 700; }
.achv-emoji { font-size: 1.9rem; line-height: 1.1; }
.achv-emoji.is-locked { filter: grayscale(1); opacity: 0.45; }
.achv-bar { height: 6px; margin: 4px 0 2px; border-radius: 999px; background: var(--color-surface-active); overflow: hidden; }
.achv-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffb01f, #ff7a3d); }
:root[data-theme="dark"] .achv-date { color: #ffc44d !important; }
@media (min-width: 601px) {
    .achv-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Aviso de logro nuevo en Inicio */
a.achv-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 16px;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(135deg, #ff9a3d, #ff5f6d);
    box-shadow: 0 10px 24px rgba(255, 95, 109, 0.35);
}
.achv-toast-emoji { font-size: 1.8rem; }
.achv-toast-text { flex: 1; display: flex; flex-direction: column; }
.achv-toast-text small { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.9; }
.achv-toast-text strong { font-size: 1rem; }
.achv-toast-cta { padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.22); font-weight: 800; font-size: 0.85rem; }
@media (prefers-reduced-motion: no-preference) {
    a.achv-toast { animation: achv-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
    @keyframes achv-pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Acceso a Logros dentro del resumen de Inicio */
a.dash-achv-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -6px 0 16px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
}
a.dash-achv-link span { display: inline-flex; align-items: center; gap: 6px; }
a.dash-achv-link span:first-child .icon { color: #e08a00; }
a.dash-achv-link span:last-child { color: var(--color-text-muted); font-weight: 600; }
a.dash-achv-link b { color: var(--color-text); }

/* ===== Hoy: datos de descanso y check-in (index.html) ===== */
.today-panel { margin: 12px 0 16px; display: flex; flex-direction: column; gap: 10px; }
.today-facts { padding: 12px 14px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border-subtle); }
.today-week { margin: 0; font-size: 0.9rem; }
.today-week b { font-size: 1.05rem; }
.today-week .ok { color: var(--color-success-text); font-weight: 700; }
.today-facts-title { margin: 10px 0 4px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.today-groups { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
.today-groups li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border-subtle); font-size: 0.85rem; }
.today-groups b { font-weight: 700; color: var(--color-text-soft); white-space: nowrap; }
.today-note { margin: 8px 0 0; font-size: 0.75rem; color: var(--color-text-muted); }
details.checkin { border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border-subtle); }
details.checkin > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; cursor: pointer; font-weight: 800; list-style: none; }
details.checkin > summary::-webkit-details-marker { display: none; }
details.checkin > summary small { color: var(--color-text-muted); font-weight: 600; font-size: 0.78rem; }
.checkin-form { padding: 0 14px 14px; }
.checkin-row { border: 0; margin: 0 0 10px; padding: 0; min-width: 0; }
.checkin-row legend { padding: 0; margin-bottom: 6px; font-size: 0.8rem; font-weight: 700; color: var(--color-text-soft); }
.checkin-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 5px; }
.checkin-chip { position: relative; display: flex; }
.checkin-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.checkin-chip span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.15; min-height: 44px; padding: 4px 4px; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--color-neutral-bg); font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.checkin-chip input:checked + span { background: var(--color-brand); border-color: var(--color-brand); color: #fff; }
.checkin-chip input:focus-visible + span { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.checkin-submit { width: 100%; margin-top: 4px; }
.checkin-help { margin: 8px 0 0; font-size: 0.75rem; color: var(--color-text-muted); text-align: center; }
.checkin-done { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border-subtle); }
.checkin-done-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--color-success-dark); color: #fff; font-weight: 800; flex-shrink: 0; }
.checkin-done-text { display: flex; flex-direction: column; font-size: 0.85rem; }
.checkin-done-text small { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.checkin-low { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--color-surface-active); font-size: 0.82rem; line-height: 1.45; }
:root[data-theme="dark"] .checkin-chip span { background: var(--color-surface-active); }
:root[data-theme="dark"] .checkin-chip input:checked + span { background: #5a3fd8; border-color: #b9a6ff; color: #fff; }

/* ===== Nivel (index.html, level.html, finish_workout.html) ===== */
a.dash-level-link { display: block; margin: -6px 0 16px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-subtle); color: var(--color-text); text-decoration: none; font-size: 0.88rem; }
.dash-level-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-level-next { display: inline-flex; align-items: center; gap: 4px; color: var(--color-text-muted); font-weight: 600; white-space: nowrap; font-size: 0.8rem; }
.dash-level-bar { display: block; height: 6px; margin-top: 8px; border-radius: 999px; background: var(--color-surface-active); overflow: hidden; }
.dash-level-bar i { display: block; height: 100%; border-radius: inherit; background: var(--color-brand); }
a.finish-xp { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0 0 16px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border-subtle); background: var(--surface); color: var(--color-text); text-decoration: none; font-size: 0.85rem; }
.finish-xp-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.finish-xp-main b { color: var(--color-brand-dark); }
.finish-xp-main span, .finish-xp-week { color: var(--color-text-muted); }
.finish-xp-week { font-weight: 700; white-space: nowrap; }
.finish-xp-note { flex-basis: 100%; color: var(--color-text-muted); font-size: 0.75rem; }
:root[data-theme="dark"] .finish-xp-main b { color: #b9a6ff; }
.level-hero-top { display: flex; align-items: center; gap: 14px; }
.level-hero-top strong { display: block; font-size: 1.3rem; }
.level-hero-top div > span { color: var(--color-text-muted); font-size: 0.85rem; }
.level-badge { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; background: var(--color-brand); color: #fff; font-size: 1.4rem; font-weight: 800; flex-shrink: 0; }
a.level-strength { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-subtle); color: var(--color-text); text-decoration: none; font-size: 0.88rem; font-weight: 600; }
.level-note { margin: 10px 0 0; font-size: 0.8rem; color: var(--color-text-muted); line-height: 1.45; }
.level-note a { color: var(--color-brand-dark); font-weight: 700; }
:root[data-theme="dark"] .level-note a { color: #b9a6ff; }
.level-section { margin-top: 16px; }
.level-section h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; font-size: 1.1rem; font-weight: 800; }
.level-version { font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--color-surface-active); color: var(--color-text-soft); }
.level-rules { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.level-rules th, .level-rules td { padding: 8px 6px; border-top: 1px solid var(--border-subtle); text-align: left; vertical-align: top; }
.level-rules th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); border-top: 0; }
.level-rules td:nth-child(2) { font-weight: 800; white-space: nowrap; }
.level-rules tr.is-current td { background: var(--color-surface-active); font-weight: 700; }
.level-notes { margin: 12px 0 0; padding-left: 18px; font-size: 0.8rem; color: var(--color-text-soft); line-height: 1.5; }
.level-weeks { list-style: none; margin: 0; padding: 0; }
.level-weeks li { padding: 9px 0; border-top: 1px solid var(--border-subtle); }
.level-weeks li:first-child { border-top: 0; padding-top: 0; }
.level-week-top { display: flex; justify-content: space-between; gap: 10px; font-size: 0.85rem; }
.level-week-top b { white-space: nowrap; }
.level-week-parts { margin-top: 2px; font-size: 0.75rem; color: var(--color-text-muted); }
.level-capped { color: var(--color-brand-dark); font-weight: 800; margin-left: 2px; }

/* ===== Rangos de fuerza (progress.html, index.html, level.html) ===== */
.rank-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; white-space: nowrap; }
.rank-none, .rank-hierro { background: #e6e6ea; color: #4a4a55; }
.rank-bronce { background: #f3dcc8; color: #7a3f12; }
.rank-plata { background: #e3e8f0; color: #3d4656; }
.rank-oro { background: #fbecc0; color: #6b4e00; }
.rank-platino { background: #d3f2ef; color: #0f5c57; }
.rank-diamante { background: #dce7ff; color: #1f3f8f; }
.rank-titan { background: #3d2b8a; color: #fff; }
.rank-esmeralda { background: #d2f5df; color: #0b5a2e; }
.rank-campeon { background: #f6d6e8; color: #7d1650; }
:root[data-theme="dark"] .rank-none, :root[data-theme="dark"] .rank-hierro { background: #2e2e36; color: #c9c9d4; }
:root[data-theme="dark"] .rank-bronce { background: #3d2516; color: #f4c49c; }
:root[data-theme="dark"] .rank-plata { background: #2a3240; color: #d0d8e6; }
:root[data-theme="dark"] .rank-oro { background: #3d3110; color: #ffdd7a; }
:root[data-theme="dark"] .rank-platino { background: #0f3a37; color: #8ce8df; }
:root[data-theme="dark"] .rank-diamante { background: #1b2a52; color: #a9c2ff; }
:root[data-theme="dark"] .rank-titan { background: #b9a6ff; color: #1b1238; }
:root[data-theme="dark"] .rank-esmeralda { background: #0d3a22; color: #86efac; }
:root[data-theme="dark"] .rank-campeon { background: #44122f; color: #f9a8d4; }
.std-note { margin: 0 0 10px; font-size: 0.78rem; color: var(--color-text-muted); }
.std-source { margin: 2px 0 0; font-size: 0.7rem; color: var(--color-text-muted); }
.std-sub .std-level { padding: 1px 7px; font-size: 0.7rem; }
.std-extra { font-size: 0.7rem; font-weight: 600; color: var(--color-text-muted); }
.std-defs .rank-badge { min-width: 76px; text-align: center; margin-right: 6px; }
.std-defs li { margin-bottom: 4px; }

/* ===== Volumen semanal por músculo (progress.html) ===== */
:root { --vol-base: #e4e1f0; --vol-none: #d4d0e6; --vol-low: #f4b740; --vol-ok: #22c98c; --vol-high: #e5484d; }
:root[data-theme="dark"] { --vol-base: #3a3550; --vol-none: #4a4466; }
.vol-card { margin-top: 16px; }
.vol-map .mm-row { display: flex; justify-content: center; gap: 12px; }
.vol-map .mm-figure { width: 42%; max-width: 150px; height: auto; }
.vol-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 10px 0 6px; font-size: 0.75rem; color: var(--color-text-muted); }
.vol-legend span { display: inline-flex; align-items: center; gap: 5px; }
.vol-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.vol-dot.none { background: var(--vol-none); }
.vol-dot.low { background: var(--vol-low); }
.vol-dot.ok { background: var(--vol-ok); }
.vol-dot.high { background: var(--vol-high); }
.vol-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.vol-list li { padding: 8px 0; border-top: 1px solid var(--border-subtle); min-width: 0; }
.vol-row-top { display: flex; justify-content: space-between; gap: 6px; font-size: 0.85rem; }
.vol-row-top b { white-space: nowrap; }
.vol-row-top b.vol-low { color: #8a5a00; }
.vol-row-top b.vol-ok { color: var(--color-success-text); }
.vol-row-top b.vol-high { color: #c62828; }
.vol-row-top b.vol-none { color: var(--color-text-muted); }
:root[data-theme="dark"] .vol-row-top b.vol-low { color: #ffd27a; }
:root[data-theme="dark"] .vol-row-top b.vol-ok { color: #5cf0b4; }
:root[data-theme="dark"] .vol-row-top b.vol-high { color: #ff8a8a; }
.vol-bar { position: relative; height: 6px; margin: 6px 0 4px; border-radius: 999px; background: var(--color-surface-active); overflow: hidden; }
.vol-band { position: absolute; left: 40%; width: 40%; top: 0; bottom: 0; background: rgba(34, 201, 140, 0.18); }
.vol-bar i { position: relative; display: block; height: 100%; border-radius: inherit; }
.vol-bar i.vol-low { background: var(--vol-low); }
.vol-bar i.vol-ok { background: var(--vol-ok); }
.vol-bar i.vol-high { background: var(--vol-high); }
.vol-bar i.vol-none { background: transparent; }
.vol-list small { font-size: 0.72rem; color: var(--color-text-muted); }
@media (max-width: 360px) { .vol-list { grid-template-columns: 1fr; } }
/* Desglose al tocar un músculo (lista o mapa): panel inferior. */
.vol-tap-hint { margin: 4px 0 0; font-size: 0.75rem; color: var(--color-text-muted); text-align: center; }
.vol-list li[data-vol-group] { cursor: pointer; border-radius: 6px; -webkit-tap-highlight-color: transparent; }
.vol-list li[data-vol-group]:active { background: var(--color-surface-hover); }
.vol-list li[data-vol-group]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vol-map .mm-figure path:not(.mm-neutral) { cursor: pointer; }
.vol-detail-sheet .bottom-sheet-body { padding: 0 16px 16px; }
.vol-detail-total { margin: 4px 0 10px; font-size: 0.9rem; }
.vol-detail-total b.vol-low { color: #8a5a00; }
.vol-detail-total b.vol-ok { color: var(--color-success-text); }
.vol-detail-total b.vol-high { color: #c62828; }
:root[data-theme="dark"] .vol-detail-total b.vol-low { color: #ffd27a; }
:root[data-theme="dark"] .vol-detail-total b.vol-ok { color: #5cf0b4; }
:root[data-theme="dark"] .vol-detail-total b.vol-high { color: #ff8a8a; }
.vol-detail-list { list-style: none; margin: 0; padding: 0; }
.vol-detail-list li { padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.vol-detail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.9rem; }
.vol-detail-head span { min-width: 0; }
.vol-detail-head small { margin-left: 6px; font-size: 0.72rem; color: var(--color-text-muted); }
.vol-detail-head b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.vol-detail-sets, .vol-detail-skip { margin: 4px 0 0; font-size: 0.78rem; color: var(--color-text-muted); }
.vol-detail-sets span { color: var(--color-text); font-weight: 600; }

/* ===== Colores de acento (ventaja por nivel, app/perks.py) =====
   Rellenos con texto blanco >= 4,5:1 en el color principal. */
:root[data-accent="azul"] {
    --accent: #2563eb; --accent-2: #0891b2; --accent-rgb: 37, 99, 235; --accent-light: #3b7bf0;
    --color-border-soft: #d6e3ff; --color-surface-hover: #f2f6ff; --color-surface-active: #e3ecff;
    --color-brand: #2563eb; --color-brand-dark: #1d4ed8; --color-brand-deep: #1e3a8a; --color-brand-soft: #3b5bdb;
}
:root[data-accent="verde"] {
    --accent: #0b7a54; --accent-2: #16a34a; --accent-rgb: 11, 122, 84; --accent-light: #10915f;
    --color-border-soft: #cfeee0; --color-surface-hover: #f1faf5; --color-surface-active: #e0f4ea;
    --color-brand: #0b7a54; --color-brand-dark: #096645; --color-brand-deep: #064e35; --color-brand-soft: #2f8f6d;
}
:root[data-accent="naranja"] {
    --accent: #c2410c; --accent-2: #ea580c; --accent-rgb: 194, 65, 12; --accent-light: #d4520f;
    --color-border-soft: #fbdcc8; --color-surface-hover: #fff6f0; --color-surface-active: #fde8da;
    --color-brand: #c2410c; --color-brand-dark: #9a3412; --color-brand-deep: #7c2d12; --color-brand-soft: #d0602a;
}
:root[data-theme="dark"][data-accent="azul"] {
    --color-brand: #7aa2ff; --color-brand-dark: #a9c2ff; --color-brand-deep: #d0dcff; --color-brand-soft: #8fa8e8;
    --color-border-soft: #2c3a5e; --color-surface-hover: #1d2438; --color-surface-active: #22304d;
}
:root[data-theme="dark"][data-accent="verde"] {
    --color-brand: #5cdb9a; --color-brand-dark: #8ff0c4; --color-brand-deep: #c6f7dd; --color-brand-soft: #7fcfa8;
    --color-border-soft: #234a3c; --color-surface-hover: #1a2a25; --color-surface-active: #1f3a30;
}
:root[data-theme="dark"][data-accent="naranja"] {
    --color-brand: #fb923c; --color-brand-dark: #fdba74; --color-brand-deep: #fed7aa; --color-brand-soft: #f0a26a;
    --color-border-soft: #553220; --color-surface-hover: #2a1f1a; --color-surface-active: #3a2a20;
}
.accent-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.accent-swatch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 10px; border-radius: 999px; border: 1.5px solid var(--border-subtle); background: var(--surface); color: var(--color-text); font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.accent-swatch i { width: 20px; height: 20px; border-radius: 50%; display: inline-block; }
.accent-swatch.selected { border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2); }
.accent-swatch:disabled { cursor: not-allowed; opacity: 0.55; }
.accent-swatch small { font-weight: 600; color: var(--color-text-muted); }
.share-designs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 4px 0 10px; }
.share-design { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border-subtle); background: var(--surface); color: var(--color-text); font-weight: 700; font-size: 0.82rem; cursor: pointer; }
.share-design.selected { border-color: var(--color-brand); color: var(--color-brand-dark); }
.perk-list { list-style: none; margin: 0; padding: 0; }
.perk-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border-subtle); font-size: 0.85rem; }
.perk-list li:first-child { border-top: 0; }
.perk-level { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--color-surface-active); color: var(--color-text-soft); font-weight: 800; flex-shrink: 0; font-size: 0.8rem; }
.perk-list li.is-unlocked .perk-level { background: var(--accent); color: #fff; }
.perk-list li.is-unlocked span:last-child::after { content: " ✓"; color: var(--color-success-text); font-weight: 800; }

/* Emblemas de rango (app/static/ranks/*.svg, tools/make_rank_emblems.py) */
.rank-emblem { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.rank-chip { display: inline-flex; align-items: center; gap: 4px; }
.std-global { gap: 2px; }
.std-defs li.rank-def { display: flex; align-items: center; gap: 6px; list-style: none; margin-left: -18px; }

/* ===== Músculos de tus ejercicios (exercise_muscles.html) ===== */
.alias-intro { margin: 0 0 14px; font-size: 0.88rem; line-height: 1.5; color: var(--color-text-soft); }
.alias-card { margin-bottom: 14px; }
.alias-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 1.05rem; font-weight: 800; }
.alias-card h2 span { font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: var(--color-surface-active); color: var(--color-text-soft); }
.alias-list { list-style: none; margin: 0; padding: 0; }
.alias-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.alias-list li:first-child { border-top: 0; }
.alias-name { display: flex; flex-direction: column; min-width: 0; }
.alias-name strong { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; }
.alias-name small { font-size: 0.75rem; color: var(--color-text-muted); }
.alias-list button { min-height: 40px; flex-shrink: 0; }
.alias-empty { margin: 0; color: var(--color-text-muted); }

.vol-personal { color: var(--color-brand-dark); }
.vol-personal-box { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--color-surface-active); font-size: 0.82rem; line-height: 1.45; }
.vol-personal-box ul { margin: 6px 0 0; padding-left: 18px; }
.vol-personal-box small { color: var(--color-text-muted); }
a.dash-muscle-caption { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; color: var(--color-text-muted); text-decoration: none; font-size: 0.72rem; }
a.dash-muscle-caption span { display: inline-flex; align-items: center; gap: 4px; }
a.dash-muscle-caption small { flex-basis: 100%; text-align: center; font-size: 0.72rem; }
.dash-muscle-caption .vol-dot { width: 8px; height: 8px; }

/* ===== Título de pestaña compacto (macro tab_title) ===== */
.tab-title { display: flex; align-items: center; gap: 9px; margin: 4px 0 14px; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.tab-title-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: #fff; flex-shrink: 0; box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3); }
.page-title { font-size: 1.3rem; margin: 4px 0 12px; }

/* Botón pequeño en línea (acciones dentro de un texto: nada de enlaces sueltos). */
a.btn-inline, button.btn-inline { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin: 6px 6px 0 0; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--color-brand); background: var(--surface); color: var(--color-brand-dark); font-weight: 700; font-size: 0.8rem; text-decoration: none; font-style: normal; cursor: pointer; vertical-align: middle; }
@media (hover: hover) { a.btn-inline:hover { background: var(--color-surface-active); } }
.std-actions { display: block; }

/* ===== Pestaña Rango ===== */
.rank-hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 18px 16px 20px; border-radius: var(--radius-card); background: var(--surface); overflow: hidden; }
.rank-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(260px 200px at 50% 30%, var(--rank-glow, rgba(var(--accent-rgb), 0.25)), transparent 70%); pointer-events: none; }
.rank-hero > * { position: relative; }
.rank-hero-emblem { position: relative; width: 190px; height: 190px; display: grid; place-items: center; }
.rank-hero-emblem.is-locked { filter: grayscale(1); opacity: 0.45; }
.rank-hero-glow { position: absolute; inset: 18px; border-radius: 50%; background: var(--rank-glow, rgba(var(--accent-rgb), 0.35)); filter: blur(26px); }
.rank-hero-emblem .rank-emblem { position: relative; width: 190px; height: 190px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.25)); }
.rank-hero-kicker { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); }
.rank-hero-name { font-size: 2rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; }
.rank-hero-bar { width: min(260px, 80%); height: 8px; margin-top: 6px; border-radius: 999px; background: var(--color-surface-active); overflow: hidden; }
.rank-hero-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-light), var(--accent-2)); }
.rank-hero-next { font-size: 0.82rem; font-weight: 700; color: var(--color-text-soft); }
.rank-hero-sub { font-size: 0.75rem; color: var(--color-text-muted); }
.tier-hierro { --rank-glow: rgba(120, 128, 140, 0.35); }
.tier-bronce { --rank-glow: rgba(229, 154, 92, 0.45); }
.tier-plata { --rank-glow: rgba(160, 175, 200, 0.5); }
.tier-oro { --rank-glow: rgba(255, 196, 0, 0.5); }
.tier-platino { --rank-glow: rgba(46, 220, 200, 0.45); }
.tier-diamante { --rank-glow: rgba(80, 130, 255, 0.5); }
.tier-esmeralda { --rank-glow: rgba(40, 210, 120, 0.5); }
.tier-campeon { --rank-glow: rgba(255, 70, 150, 0.5); }
.tier-titan { --rank-glow: rgba(150, 100, 255, 0.6); }
.rank-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 16px; }
a.rank-link { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-subtle); color: var(--color-text); text-decoration: none; min-width: 0; }
a.rank-link > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 0.82rem; }
a.rank-link small { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
.rank-link-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800; flex-shrink: 0; }
.rank-link-badge.is-trophy { background: #f5b301; }
.rank-link-badge.is-share { background: #22c98c; }
a.rank-link.is-wide { grid-column: 1 / -1; }
/* Mis tarjetas (/tarjetas) */
.card-gallery { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.gallery-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; text-align: left;
    border: 1px solid var(--border-subtle); background: var(--surface); color: var(--color-text); font-family: inherit; cursor: pointer; }
.gallery-visual { display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; }
.gallery-emoji { font-size: 1.9rem; border-radius: 12px; background: var(--surface-3); }
.gallery-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gallery-text strong { font-size: 0.98rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-text small { font-size: 0.8rem; color: var(--color-text-muted); }
.gallery-share { color: var(--accent); flex-shrink: 0; }
/* Botones con aspecto propio: sin el margen ni el degradado al pasar el ratón de los botones genéricos. */
.gallery-item, button.session-set, .session-menu-btn, .achv-share { margin: 0; box-shadow: none; }
.session-menu-btn { margin: -6px -6px -6px 0; }
@media (hover: hover) {
    .gallery-item:hover { background: var(--color-surface-hover); color: var(--color-text); box-shadow: none; }
    button.session-set:hover { background: var(--color-surface-hover); color: inherit; box-shadow: none; }
    button.session-set.best:hover { color: var(--color-brand-dark); }
    .session-menu-btn:hover { background: var(--surface-3); color: var(--color-text); box-shadow: none; }
    .achv-share:hover { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); box-shadow: none; }
}
.achv-share { display: inline-flex; align-self: flex-start; width: auto; align-items: center; gap: 5px; margin-top: 6px; padding: 4px 10px; border-radius: 999px;
    border: 1px solid rgba(var(--accent-rgb), 0.35); background: transparent; color: var(--accent); font: inherit; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
    .rank-hero-emblem .rank-emblem { animation: rank-float 4s ease-in-out infinite; }
    .rank-hero-glow { animation: rank-glow 2.8s ease-in-out infinite; }
    @keyframes rank-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
    @keyframes rank-glow { 0%, 100% { opacity: 0.6; transform: scale(0.92); } 50% { opacity: 1; transform: scale(1.05); } }
}

/* ===== Celebración de rango (Inicio) ===== */
.rank-celebration { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; background: rgba(10, 6, 30, 0.72); backdrop-filter: blur(6px); }
.rank-celebration.is-closing { opacity: 0; transition: opacity 0.25s; }
.rank-celebration-card { width: min(360px, 100%); padding: 22px 18px 18px; border-radius: 24px; text-align: center; color: #fff;
    background: radial-gradient(320px 240px at 50% 25%, var(--rank-glow, rgba(var(--accent-rgb), 0.5)), transparent 70%), linear-gradient(160deg, #1a1236, #0e0a22); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.rank-celebration-card small { display: block; margin-top: 4px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.8; }
.rank-celebration-card strong { display: block; font-size: 2.2rem; font-weight: 900; letter-spacing: -0.02em; }
.rank-celebration-card p { margin: 6px 0 16px; font-size: 0.88rem; opacity: 0.85; line-height: 1.45; }
.rank-celebration-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.rank-celebration-actions .rank-share-btn { flex-basis: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0;
    background: #fff; color: #1a1236; }
@media (hover: hover) { .rank-celebration-actions .rank-share-btn:hover { background: #f1edff; color: #1a1236; } }
.rank-celebration-actions .btn-outline { color: #fff; border-color: rgba(255, 255, 255, 0.5); background: transparent; }
.rank-celebration-emblem { position: relative; width: 200px; height: 200px; margin: 0 auto; display: grid; place-items: center; }
.rank-celebration-emblem .rank-emblem { position: relative; width: 190px; height: 190px; filter: drop-shadow(0 0 24px var(--rank-glow, rgba(255, 255, 255, 0.4))); }
.rank-celebration-rays { position: absolute; inset: -30px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.16) 0 8deg, transparent 8deg 22deg); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); }
.rank-spark { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #fff; opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
    .rank-celebration { animation: rank-fade 0.3s ease-out; }
    .rank-celebration-card { animation: rank-card-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
    .rank-celebration-emblem .rank-emblem { animation: rank-emblem-in 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.25) 0.1s both, rank-float 4s ease-in-out 1s infinite; }
    .rank-celebration-rays { animation: rank-rays 14s linear infinite; }
    .rank-spark { animation: rank-spark 1.1s ease-out var(--d) both; }
    @keyframes rank-fade { from { opacity: 0; } }
    @keyframes rank-card-in { from { transform: scale(0.85) translateY(20px); opacity: 0; } }
    @keyframes rank-emblem-in { 0% { transform: scale(0.1) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
    @keyframes rank-rays { to { transform: rotate(360deg); } }
    @keyframes rank-spark { 0% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(0.4); } 25% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-120px) scale(1); } }
}

/* Rango de series y repeticiones en la fila de la rutina (mín – máx). */
.plan-range { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.plan-range > span { font-size: 0.68rem; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.plan-range-inputs { display: flex; align-items: center; gap: 3px; }
.plan-range-inputs > span { color: var(--color-text-muted); font-weight: 700; }
.plan-range input { width: 40px; box-sizing: border-box; padding: 8px 2px; font-family: inherit; font-size: 16px; font-weight: 800; text-align: center; color: var(--color-brand-dark); border: 1.5px solid var(--color-border-soft); border-radius: 10px; background: var(--surface-2); transition: border-color 0.2s ease, background 0.2s ease; }
.plan-range input::placeholder { font-size: 0.7rem; font-weight: 600; color: var(--color-text-muted); }
.plan-range input:focus { outline: none; border-color: var(--color-brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
.plan-range.saved input { border-color: var(--color-success); background: rgba(34, 201, 140, 0.08); }
@media (max-width: 420px) { .plan-range input { width: 36px; } }

/* Vitrina de rangos (pestaña Rango) */
.rank-showcase { display: flex; gap: 6px; overflow-x: auto; margin: 12px -4px 0; padding: 4px 4px 8px; scroll-snap-type: x mandatory; }
.rank-showcase-item { position: relative; flex: 0 0 74px; display: flex; flex-direction: column; align-items: center; gap: 2px; scroll-snap-align: start; }
.rank-showcase-item small { font-size: 0.68rem; font-weight: 700; color: var(--color-text-soft); }
.rank-showcase-item.is-locked .rank-emblem { filter: grayscale(1) brightness(0.7); opacity: 0.45; }
.rank-showcase-item.is-locked small { color: var(--color-text-muted); }
.rank-showcase-item.is-current .rank-emblem { filter: drop-shadow(0 0 10px var(--rank-glow, rgba(var(--accent-rgb), 0.5))); }
.rank-showcase-item.is-current small { color: var(--color-text); font-weight: 800; }
.rank-lock { position: absolute; top: 22px; font-size: 1.1rem; }

/* Bienvenida breve con tu emblema (Inicio, una vez al día) */
.rank-splash { position: fixed; inset: 0; z-index: 2100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    background: radial-gradient(circle at 50% 45%, var(--rank-glow, rgba(var(--accent-rgb), 0.45)), rgba(10, 6, 30, 0.92) 60%); color: #fff; cursor: pointer; }
.rank-splash strong { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.02em; }
.rank-splash.is-closing { opacity: 0; transition: opacity 0.3s ease; }
@media (prefers-reduced-motion: no-preference) {
    .rank-splash { animation: rank-fade 0.25s ease-out; }
    .rank-splash .rank-emblem { animation: rank-emblem-in 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.25) both; }
    .rank-splash strong { animation: rank-card-in 0.5s ease-out 0.25s both; }
}

/* Aviso de XP tipo videojuego (Inicio, xp_fx.js) */
.xp-pop { position: fixed; z-index: 2050; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 70px); width: min(360px, calc(100% - 32px)); transform: translateX(-50%); cursor: pointer; }
.xp-pop-card { position: relative; overflow: hidden; padding: 14px 16px 16px; border-radius: 20px; color: #fff;
    background: radial-gradient(120% 140% at 0% 0%, rgba(var(--accent-rgb), 0.55), transparent 60%), linear-gradient(160deg, #1d1543, #120d2b);
    border: 1px solid rgba(255, 214, 102, 0.55); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 14px 40px rgba(10, 6, 30, 0.55), 0 0 28px rgba(255, 196, 64, 0.25); }
.xp-pop-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65%); transform: translateX(-120%); }
.xp-pop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.xp-pop-reason { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.xp-pop-gain { font-size: 2.3rem; line-height: 1; font-weight: 900; font-style: italic; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #fff6c8 0%, #ffd34d 45%, #ff9d1a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 2px 0 rgba(120, 50, 0, 0.9)) drop-shadow(0 0 12px rgba(255, 190, 60, 0.6)); }
.xp-pop-gain small { font-size: 1.1rem; margin-left: 2px; }
.xp-pop-parts { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 12px; }
.xp-pop-parts span { padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.14); font-size: 0.74rem; font-weight: 700; }
.xp-pop-parts b { color: #ffd34d; }
.xp-pop-level { display: flex; align-items: center; gap: 10px; }
.xp-pop-badge { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 13px; line-height: 1;
    background: linear-gradient(160deg, rgba(var(--accent-rgb), 1), rgba(var(--accent-rgb), 0.55)); border: 2px solid rgba(255, 214, 102, 0.8); box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.6); }
.xp-pop-badge small { position: absolute; top: 4px; font-size: 0.5rem; font-weight: 900; letter-spacing: 0.12em; opacity: 0.85; }
.xp-pop-badge b { margin-top: 8px; font-size: 1.15rem; font-weight: 900; }
.xp-pop-track { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.xp-pop-bar { position: relative; height: 12px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5); }
.xp-pop-bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, rgba(var(--accent-rgb), 1), #ffd34d); box-shadow: 0 0 10px rgba(255, 211, 77, 0.7); }
.xp-pop-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: xp-shine 1.2s linear infinite; }
.xp-pop-next { font-size: 0.7rem; font-weight: 700; color: rgba(255, 255, 255, 0.65); }
.xp-pop-up { margin-top: 12px; text-align: center; font-size: 1.7rem; font-weight: 900; font-style: italic; letter-spacing: 0.02em;
    color: #ffe27a; text-shadow: 0 2px 0 #7a3b00, 0 0 18px rgba(255, 200, 60, 0.85); }
.xp-pop-up[hidden] { display: none; }
.xp-pop.is-levelup .xp-pop-card { border-color: #ffd34d; box-shadow: 0 14px 40px rgba(10, 6, 30, 0.55), 0 0 40px rgba(255, 196, 64, 0.6); }
.xp-pop.is-closing { opacity: 0; transform: translate(-50%, -16px); transition: opacity 0.3s ease, transform 0.3s ease; }
@keyframes xp-shine { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@keyframes xp-pop-in { 0% { opacity: 0; transform: translateY(-24px) scale(0.85); } 60% { opacity: 1; transform: translateY(4px) scale(1.04); } 100% { transform: none; } }
@keyframes xp-sweep { to { transform: translateX(120%); } }
@keyframes xp-chip-in { from { opacity: 0; transform: translateY(6px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes xp-gain-punch { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes xp-level-in { 0% { opacity: 0; transform: scale(0.4) rotate(-6deg); } 60% { opacity: 1; transform: scale(1.15) rotate(2deg); } 100% { transform: none; } }
@keyframes xp-badge-flash { 0% { transform: scale(1); } 35% { transform: scale(1.3); box-shadow: 0 0 30px #ffd34d; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: no-preference) {
    .xp-pop-card { animation: xp-pop-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
    .xp-pop-card::after { animation: xp-sweep 0.9s ease-out 0.35s both; }
    .xp-pop-parts span { animation: xp-chip-in 0.3s ease-out both; }
    .xp-pop-gain.is-done { animation: xp-gain-punch 0.35s ease-out; }
    .xp-pop-up { animation: xp-level-in 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
    .xp-pop.is-levelup .xp-pop-badge { animation: xp-badge-flash 0.6s ease-out; }
}
@media (prefers-reduced-motion: reduce) { .xp-pop-bar i::after { animation: none; } }

/* Título de pestaña + rueda de ajustes en la esquina (antes, pestaña "Más") */
.tab-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.tab-title-row .tab-title { margin: 0; min-width: 0; }
.tab-gear { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; color: var(--color-text-soft);
    background: var(--surface); border: 1px solid var(--border-subtle); text-decoration: none; transition: color 0.15s ease, transform 0.3s ease; }
.tab-gear:hover, .tab-gear:focus-visible { color: var(--accent); }
.tab-gear:active { transform: rotate(45deg); }
.settings-list { display: flex; flex-direction: column; margin-top: 16px; padding: 4px 16px; }
.settings-list a { display: flex; align-items: center; gap: 12px; min-height: 52px; color: var(--color-text); font-weight: 600; text-decoration: none; }
.settings-list a + a { border-top: 1px solid var(--border-subtle); }
.settings-list a > span:nth-child(2) { flex: 1; }
.settings-list a > .icon:last-child { color: var(--color-text-muted); }
.settings-list-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--color-surface-active); color: var(--accent); flex-shrink: 0; }
.settings-list a.is-danger { color: var(--color-danger); }
.settings-list a.is-danger .settings-list-icon { background: rgba(229, 72, 77, 0.12); color: var(--color-danger); }
@media (hover: hover) { .settings-list a:hover > span:nth-child(2) { color: var(--accent); } .settings-list a.is-danger:hover > span:nth-child(2) { color: var(--color-danger); } }

/* Modo oscuro: tarjetas neutras y el color solo como acento. Mezclar el
   color del bloque o de la sección con el fondo oscuro daba tonos sucios
   (oliva, burdeos, verde negruzco). */
:root[data-theme="dark"] .routine-card,
:root[data-theme="dark"] .routine-block-details > summary {
    background: var(--surface);
    border-color: var(--border-subtle);
    box-shadow: inset 3px 0 0 var(--block-color, transparent);
}
:root[data-theme="dark"] .routine-block-details.block-neutral > summary,
:root[data-theme="dark"] .routine-card:not([style*="--block-color"]) { box-shadow: none; }
:root[data-theme="dark"] .routine-block-details > summary .icon { color: var(--color-text-soft); }
:root[data-theme="dark"] .routine-block-color-input { border-color: var(--surface); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.25); }
:root[data-theme="dark"] button.routine-start-btn:disabled { opacity: 1; background: var(--surface-3, var(--color-surface-active)); color: var(--color-text-muted); }
:root[data-theme="dark"] .analysis-summary,
:root[data-theme="dark"] .analysis-fortalezas,
:root[data-theme="dark"] .analysis-areas-mejora,
:root[data-theme="dark"] .analysis-proximos-pasos { background: var(--surface); border-color: var(--border-subtle); border-left-width: 3px; }
:root[data-theme="dark"] .analysis-summary { border-left-color: var(--accent); }
:root[data-theme="dark"] .analysis-fortalezas { border-left-color: #2fd99a; }
:root[data-theme="dark"] .analysis-areas-mejora { border-left-color: #ff7a7a; }
:root[data-theme="dark"] .analysis-proximos-pasos { border-left-color: var(--accent); }

/* Básicos personales (pestaña Rango y /rango/basicos) */
.pbasics { margin-top: 14px; }
.pbasics-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.pbasics-head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.pbasics-list { list-style: none; margin: 0; padding: 0; }
.pbasics-list li + li { border-top: 1px solid var(--border-subtle); }
.pbasics-list a { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: var(--color-text); text-decoration: none; }
.pbasics-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pbasics-main strong { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbasics-main small { font-size: 0.75rem; color: var(--color-text-muted); }
.pbasics-spark { width: 54px; height: 22px; flex-shrink: 0; }
.pbasics-spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pbasics-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.pbasics-side b { font-size: 0.9rem; font-weight: 800; }
.pbasics-side b.up { color: var(--color-success-text); }
.pbasics-side b.down { color: var(--color-danger); }
.pbasics-note { font-size: 0.68rem; color: var(--color-text-muted); }
.pbasics-stuck { font-size: 0.68rem; font-weight: 700; color: var(--color-warning-text, #b26a00); }
.pbasics-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--color-surface-active); color: var(--accent); font-size: 0.7rem; font-weight: 700; }
.pbasics-pick { list-style: none; margin: 0 0 12px; padding: 0; }
.pbasics-pick li + li { border-top: 1px solid var(--border-subtle); }
.pbasics-pick label { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.pbasics-pick-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pbasics-pick-name strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbasics-pick-name small { font-size: 0.74rem; color: var(--color-text-muted); }
.pbasics-tag.is-progress { color: var(--color-text-muted); }
.pbasics-pick input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.pbasics-pick input:disabled + .pbasics-pick-name strong { color: var(--color-text-muted); }
:root[data-theme="dark"] .pbasics-side b.up { color: #5cf0b4; }
:root[data-theme="dark"] .pbasics-side b.down { color: #ff8a8a; }

/* Historial: Inicio enseña los últimos entrenos; el resto en /historial */
.history-more { display: flex; justify-content: center; margin: 4px 0 18px; text-decoration: none; }
.history-count { font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); }
.history-pager { display: flex; justify-content: space-between; gap: 10px; margin: 12px 0 20px; }
.history-pager a { text-decoration: none; }

/* Tipo de serie también en la fila: franja lateral y número del color del
   tipo (calentamiento ámbar y atenuado, fallo rojo, dropset azul). */
tr[data-set-type="calentamiento"] { --set-type-color: #f59e0b; }
tr[data-set-type="fallo"] { --set-type-color: #dc2626; }
tr[data-set-type="dropset"] { --set-type-color: #2563eb; }
tr[data-set-type]:not([data-set-type="normal"]) > td.set-num { box-shadow: inset 4px 0 0 var(--set-type-color); color: var(--set-type-color); font-weight: 900; }
tr[data-set-type="calentamiento"] .cell-input { opacity: 0.75; }
:root[data-theme="dark"] tr[data-set-type="fallo"] { --set-type-color: #ff5a5a; }
:root[data-theme="dark"] tr[data-set-type="dropset"] { --set-type-color: #5b8dff; }

/* Ritmo de peso frente a la fase (peso corporal e Inicio) */
.pace-card h2 { margin: 0 0 10px; font-size: 1.05rem; font-weight: 800; }
.pace-phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.pace-phase { min-height: 40px; padding: 6px 4px; border-radius: 12px; border: 1.5px solid var(--border-subtle); background: var(--surface);
    color: var(--color-text-soft); font-weight: 700; font-size: 0.78rem; letter-spacing: -0.01em; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.pace-phase.is-active { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); color: var(--color-text); }
.pace-rate { display: flex; flex-direction: column; gap: 2px; margin: 0 0 6px; }
.pace-rate strong { font-size: 1.3rem; font-weight: 900; }
.pace-rate span { font-size: 0.78rem; color: var(--color-text-muted); }
.pace-verdict { margin: 0 0 6px; padding: 8px 10px; border-radius: 10px; font-size: 0.86rem; font-weight: 600; background: var(--color-surface-active); }
.pace-verdict.pace-ok { background: rgba(34, 201, 140, 0.14); color: var(--color-success-text); }
.pace-verdict.pace-fast, .pace-verdict.pace-wrong { background: rgba(229, 72, 77, 0.12); color: var(--color-danger); }
.pace-verdict.pace-slow { background: rgba(245, 158, 11, 0.14); color: #b26a00; }
.dash-tile-sub .pace-ok { color: var(--color-success-text); font-weight: 700; }
.dash-tile-sub .pace-fast, .dash-tile-sub .pace-wrong { color: var(--color-danger); font-weight: 700; }
.dash-tile-sub .pace-slow { color: #d08a00; font-weight: 700; }
:root[data-theme="dark"] .pace-verdict.pace-ok, :root[data-theme="dark"] .dash-tile-sub .pace-ok { color: #5cf0b4; }
:root[data-theme="dark"] .pace-verdict.pace-slow { color: #ffc561; }

/* Tipo de serie: la pastilla es un botón que abre un panel propio */
button.set-type-pill { border: 0; font-family: inherit; margin: 0; }
.set-type-options { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 calc(8px + env(safe-area-inset-bottom, 0px)); }
.set-type-option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 12px; border-radius: 14px;
    border: 1.5px solid var(--border-subtle); background: var(--surface); color: var(--color-text); text-align: left; cursor: pointer; font-family: inherit; }
.set-type-option .set-type-pill { min-width: 34px; height: 34px; padding: 0; font-size: 0.95rem; flex-shrink: 0; cursor: inherit; }
.set-type-option-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-type-option-text strong { font-size: 0.98rem; font-weight: 800; }
.set-type-option-text small { font-size: 0.78rem; color: var(--color-text-muted); line-height: 1.3; }
.set-type-option-check { color: var(--accent); opacity: 0; flex-shrink: 0; }
.set-type-option.selected { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }
.set-type-option.selected .set-type-option-check { opacity: 1; }
.set-type-option:active { transform: scale(0.98); }

/* Casilla Objetivo de Inicio: de qué emblema a cuál pasas */
.goal-ranks { display: flex; align-items: center; gap: 4px; margin: 2px 0 2px; }
.goal-arrow { font-weight: 800; color: var(--color-text-muted); font-size: 0.85rem; }

/* Amigos, rankings y tarjeta de atleta */
.ranking-card { margin-top: 14px; }
.ranking-card h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.05rem; font-weight: 800; }
.ranking-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 10px 0 8px; padding: 4px; border-radius: 12px; background: var(--color-surface-active); }
.ranking-tabs button { min-height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--color-text-soft); font-weight: 700; font-size: 0.82rem; font-family: inherit; cursor: pointer; }
.ranking-tabs button.is-active { background: var(--surface); color: var(--color-text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.ranking-basic { width: 100%; min-height: 40px; margin: 0 0 8px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--border-subtle); background: var(--surface); color: var(--color-text); font-family: inherit; font-size: 16px; }
.ranking-list { list-style: none; margin: 0; padding: 0; }
.ranking-list li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 6px; border-radius: 10px; }
.ranking-list li + li { border-top: 1px solid var(--border-subtle); }
.ranking-list li.is-me { background: rgba(var(--accent-rgb), 0.1); border-top-color: transparent; }
.ranking-pos { width: 22px; text-align: center; font-weight: 900; color: var(--color-text-muted); flex-shrink: 0; }
.ranking-list li:nth-child(1) .ranking-pos { color: #e0a92e; }
.ranking-list li:nth-child(2) .ranking-pos { color: #9aa3ad; }
.ranking-list li:nth-child(3) .ranking-pos { color: #c07a3e; }
.ranking-name { flex: 1; min-width: 0; color: var(--color-text); font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-name small { color: var(--color-text-muted); font-weight: 600; }
.ranking-value { font-size: 0.82rem; font-weight: 700; color: var(--color-text-soft); flex-shrink: 0; }
.ranking-empty { color: var(--color-text-muted); font-size: 0.86rem; }
.ranking-mycard { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-subtle); color: var(--accent); font-weight: 700; text-decoration: none; }
.friends-invite h2, .friends-h2 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.friends-count { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--color-surface-active); color: var(--color-text-soft); }
.friends-code { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 10px 0; padding: 12px; border-radius: 14px; background: var(--color-surface-active); }
.friends-code span { font-size: 0.75rem; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.friends-code strong { font-size: 1.6rem; font-weight: 900; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.friends-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.friends-actions .btn, .friends-actions .btn-outline { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; margin: 0; }
.friends-add { margin-top: 14px; }
.friends-add-row { display: flex; gap: 8px; }
.friends-add-row input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--border-subtle); background: var(--surface); color: var(--color-text); font-size: 16px; text-transform: uppercase; letter-spacing: 0.08em; }
.friends-list { list-style: none; margin: 0; padding: 0; }
.friends-list li { display: flex; align-items: center; gap: 8px; min-height: 52px; }
.friends-list li + li { border-top: 1px solid var(--border-subtle); }
.friends-list li > :first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--color-text); text-decoration: none; }
.friends-list form { margin: 0; }
.btn-small { min-height: 36px !important; padding: 0 12px !important; font-size: 0.82rem !important; margin: 0 !important; }
.friends-sub { margin: 12px 0 2px; font-size: 0.75rem; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.friends-privacy a { color: var(--accent); }
.friend-invite-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-top: 30px; }
.friend-invite-card h1 { margin: 0; font-size: 1.3rem; }
.friend-invite-card p { margin: 0; color: var(--color-text-soft); }
.friend-invite-card form { width: 100%; }
.friend-invite-card .btn, .friend-invite-card .btn-outline { width: 100%; display: flex; justify-content: center; text-decoration: none; }
.friend-invite-icon { font-size: 2.6rem; }
.athlete-card { position: relative; overflow: hidden; margin-top: 10px; }
.athlete-card h2 { margin: 16px 0 6px; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--color-text-muted); }
.ac-head { display: flex; align-items: center; gap: 14px; }
.ac-avatar { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 2rem; font-weight: 900; flex-shrink: 0; }
.ac-name { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.ac-name h1 { margin: 0; font-size: 1.5rem; font-weight: 900; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ac-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-top: 14px; }
.ac-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; background: var(--color-surface-active); }
.ac-stats strong { font-size: 1.15rem; font-weight: 900; }
.ac-stats small { font-size: 0.72rem; color: var(--color-text-muted); }
.ac-hidden { display: inline-block; font-size: 0.68rem !important; font-weight: 700; color: var(--color-text-muted); font-style: italic; }
.ac-lifts, .ac-badges { list-style: none; margin: 0; padding: 0; }
.ac-lifts li { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.ac-lifts li + li { border-top: 1px solid var(--border-subtle); }
.ac-lift-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ac-lift-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-lift-main small, .ac-lift-kg small { font-size: 0.72rem; color: var(--color-text-muted); }
.ac-lift-kg { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.ac-badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ac-badges li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--color-surface-active); font-size: 0.82rem; font-weight: 700; }
.ac-badge-emoji { font-size: 1.3rem; }
.ac-edit { display: flex; justify-content: center; margin: 12px 0 6px; text-decoration: none; }
.ac-form h2 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 800; }
.ac-max { font-size: 0.75rem; font-weight: 600; color: var(--color-text-muted); }
.ac-toggles { list-style: none; margin: 0; padding: 0; }
.ac-toggles li + li { border-top: 1px solid var(--border-subtle); }
.ac-toggles label { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.ac-toggles input { position: absolute; opacity: 0; pointer-events: none; }
.ac-switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong, #c9c3e6); flex-shrink: 0; transition: background 0.15s ease; }
.ac-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s ease; }
.ac-toggles input:checked + .ac-switch { background: var(--accent); }
.ac-toggles input:checked + .ac-switch::after { transform: translateX(18px); }
.ac-toggles input:focus-visible + .ac-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.ac-sensitive { font-size: 0.68rem; font-weight: 700; color: #b26a00; }

/* Aviso breve (autoguardado de formularios, base.html gyreToast). */
.gyre-toast {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    left: 50%;
    transform: translate(-50%, -8px);
    z-index: 2000;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--color-success-dark, #17a973);
    border: 1.5px solid currentColor;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.gyre-toast.is-error { color: var(--color-danger, #c62828); }
.gyre-toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Borrar cuenta y contacto */
.delete-account-form, .contact-form { display: flex; flex-direction: column; gap: 10px; }
.delete-account-form input[type="text"], .contact-form textarea { width: 100%; box-sizing: border-box; }
.contact-form textarea { resize: vertical; min-height: 140px; font: inherit; }
.form-error { color: var(--color-danger); font-weight: 600; margin: 0; }
.delete-account-form .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.settings-list a.is-danger-soft { color: var(--color-danger); }
.stats-messages { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.stats-messages li { border-top: 1px solid var(--color-border, rgba(127,127,127,.2)); padding-top: 10px; }
.stats-messages p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.demo-form { display: grid; gap: 10px; margin-top: 14px; }
.demo-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.demo-form .demo-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

/* Importar entrenos */
.import-help h2 { font-size: 1rem; margin: 0 0 4px; }
.import-help p { margin: 0 0 12px; color: var(--color-text-muted); font-size: 0.9rem; }
.import-form { display: flex; flex-direction: column; gap: 10px; }
.import-map { list-style: none; padding: 6px 16px; display: flex; flex-direction: column; }
.import-map li { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--color-border-soft); }
.import-map li:last-child { border-bottom: 0; }
.import-map-source { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.import-map-source small { color: var(--color-text-muted); }
.import-map input { width: 100%; box-sizing: border-box; padding: 9px 10px; font: inherit; font-size: 16px; border: 1.5px solid var(--color-border-soft); border-radius: 10px; background: var(--surface-2); color: var(--color-text); }
/* El botón siempre a mano (la lista puede ser muy larga). */
.import-actions { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 12px; margin-top: 12px; border-radius: var(--radius-card, 16px); background: var(--surface); box-shadow: 0 -6px 20px rgba(0,0,0,.12); }
@media (min-width: 601px) { .import-actions { bottom: 12px; } }
.import-skip { display: flex; gap: 8px; align-items: flex-start; font-size: 0.88rem; }
@media (max-width: 420px) { .import-map li { grid-template-columns: 1fr; gap: 4px; } }

/* Barra de arriba (ordenador): la rueda de ajustes, solo icono y al final. */
.top-nav-app .btn-nav-icon { margin-left: auto; padding: 8px 10px; }
.top-nav-app { flex-wrap: wrap; row-gap: 4px; }
/* En ordenador la rueda ya está en la barra de arriba. */
@media (min-width: 601px) { body:has(.top-nav-app) .tab-gear { display: none; } }

/* Selector de nombre al importar */
.import-map-target { display: flex; gap: 6px; align-items: center; min-width: 0; }
.import-map-target input { flex: 1; min-width: 0; }
.import-map input.is-own { border-color: var(--color-success-dark, #17a973); }
.import-pick { flex-shrink: 0; margin: 0; }
.import-picker { height: 85vh; }
.import-picker-search { padding: 4px 16px 8px; }
.import-picker-search input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; font-size: 16px; border: 1.5px solid var(--color-border-soft); border-radius: 12px; background: var(--surface-2); color: var(--color-text); }
.import-picker-body { overflow-y: auto; padding: 0 16px 16px; }
.import-picker-body h4 { margin: 14px 0 6px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); }
.import-picker-body ul { list-style: none; margin: 0; padding: 0; }
.import-picker-body li button { display: flex; justify-content: space-between; gap: 10px; width: 100%; margin: 0; padding: 11px 10px; text-align: left; background: transparent; color: var(--color-text); border-radius: 10px; font-weight: 600; box-shadow: none; }
.import-picker-body li button small { color: var(--color-text-muted); font-weight: 500; white-space: nowrap; }
@media (hover: hover) { .import-picker-body li button:hover { background: var(--color-surface-hover); color: var(--color-text); } }
.import-picker-skip { width: 100%; margin: 4px 0 0; background: transparent; color: var(--color-danger); border: 1.5px dashed var(--color-border-soft); box-shadow: none; }
.import-picker-empty { color: var(--color-text-muted); font-size: 0.88rem; margin: 6px 0; }
.import-cat-row { align-items: center; }
.import-cat-thumb { width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.import-cat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.import-cat-text strong { overflow-wrap: anywhere; }
.import-cat-text small { color: var(--color-text-muted); font-weight: 500; }
.import-cat-sets { white-space: nowrap; }
.import-cat-row.has-sets .import-cat-sets { color: var(--color-success-dark, #17a973); font-weight: 700; }

/* Importar: cada fila es un botón con el ejercicio elegido (sin texto libre). */
.import-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 0; padding: 9px 12px; text-align: left; background: var(--surface-2); color: var(--color-text); border: 1.5px solid var(--color-border-soft); border-radius: 10px; box-shadow: none; font-weight: 700; }
.import-choice .import-choice-state { font-weight: 500; font-size: 0.78rem; color: var(--color-text-muted); }
.import-choice.is-own { border-color: var(--color-success-dark, #17a973); }
.import-choice.is-own .import-choice-state { color: var(--color-success-dark, #17a973); }
.import-choice.is-empty { border-style: dashed; border-color: var(--color-danger); color: var(--color-danger); }
.import-choice.is-empty .import-choice-state { color: var(--color-danger); }
@media (hover: hover) { .import-choice:hover { background: var(--color-surface-hover); color: var(--color-text); } }
.import-pending { margin: 0; color: var(--color-danger); font-weight: 600; font-size: 0.88rem; }

/* Chips de músculos en los buscadores del catálogo */
.muscle-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 16px 10px; scrollbar-width: none; flex-shrink: 0; }
.muscle-chips::-webkit-scrollbar { display: none; }
.muscle-chip { flex-shrink: 0; margin: 0; padding: 6px 12px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; background: var(--surface-2); color: var(--color-text-soft); border: 1.5px solid var(--color-border-soft); box-shadow: none; }
.muscle-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (hover: hover) { .muscle-chip:not(.active):hover { background: var(--color-surface-hover); color: var(--color-text); } }

/* Acentos de los niveles 30, 40 y 50 */
:root[data-accent="rojo"] {
    --accent: #c81e1e; --accent-2: #e11d48; --accent-rgb: 200, 30, 30; --accent-light: #dc2f2f;
    --color-border-soft: #f9d4d4; --color-surface-hover: #fff4f4; --color-surface-active: #fde3e3;
    --color-brand: #c81e1e; --color-brand-dark: #a31616; --color-brand-deep: #7f1010; --color-brand-soft: #d24848;
}
:root[data-accent="turquesa"] {
    --accent: #0f766e; --accent-2: #0891b2; --accent-rgb: 15, 118, 110; --accent-light: #138a80;
    --color-border-soft: #c9ecea; --color-surface-hover: #f0faf9; --color-surface-active: #dcf3f1;
    --color-brand: #0f766e; --color-brand-dark: #0b5f58; --color-brand-deep: #084a44; --color-brand-soft: #2f8f87;
}
:root[data-accent="dorado"] {
    --accent: #9a6a00; --accent-2: #c2410c; --accent-rgb: 154, 106, 0; --accent-light: #b07c06;
    --color-border-soft: #f3e2b8; --color-surface-hover: #fffaf0; --color-surface-active: #fbefd2;
    --color-brand: #9a6a00; --color-brand-dark: #7c5500; --color-brand-deep: #5c3f00; --color-brand-soft: #b08a2e;
}
:root[data-theme="dark"][data-accent="rojo"] {
    --color-brand: #f87171; --color-brand-dark: #fca5a5; --color-brand-deep: #fecaca; --color-brand-soft: #ef8a8a;
    --color-border-soft: #5a2424; --color-surface-hover: #2a1a1a; --color-surface-active: #3a2020;
}
:root[data-theme="dark"][data-accent="turquesa"] {
    --color-brand: #2dd4bf; --color-brand-dark: #5eead4; --color-brand-deep: #99f6e4; --color-brand-soft: #5cc7bb;
    --color-border-soft: #1f4a46; --color-surface-hover: #172826; --color-surface-active: #1c3532;
}
:root[data-theme="dark"][data-accent="dorado"] {
    --color-brand: #facc15; --color-brand-dark: #fde047; --color-brand-deep: #fef08a; --color-brand-soft: #e7c14a;
    --color-border-soft: #4d4019; --color-surface-hover: #29251a; --color-surface-active: #3a321f;
}

/* ===== Respuesta inmediata al tocar (cobertura mala, servidor despertando) ===== */
.nav-progress-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 3000;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
}
.nav-progress-bar::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 40%;
    background: var(--accent);
    border-radius: 3px;
    animation: nav-progress-slide 1.1s ease-in-out infinite;
}
html.is-navigating .nav-progress-bar { opacity: 1; transition: opacity 0.15s ease 0.12s; }
@keyframes nav-progress-slide { from { left: -40%; } to { left: 100%; } }
@keyframes gyre-spin { to { transform: rotate(360deg); } }
.is-pending { pointer-events: none; }
a.is-pending, button.is-pending, input.is-pending { opacity: 0.75; }
button.is-pending::after, input[type="submit"].is-pending::after, .active-toast.is-pending::after {
    content: "";
    display: inline-block;
    width: 0.85em; height: 0.85em;
    margin-left: 8px;
    vertical-align: -0.1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: gyre-spin 0.7s linear infinite;
}

/* Cambios de series pendientes de guardar (sin conexión) */
.sync-status {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2001;
    max-width: calc(100vw - 32px);
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-soft);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
}
.sync-status.is-login { color: var(--color-danger, #c62828); border-color: currentColor; }
.sync-status a { color: inherit; }

/* Repeticiones por encima del aviso de Configuración */
.cell-input.cell-input-warn {
    border-color: var(--color-danger, #e53935) !important;
    background: rgba(229, 57, 53, 0.1);
    color: var(--color-danger, #c62828);
}

/* Notas generales al empezar el entreno: una línea, se abre al tocar */
.workout-general-notes {
    margin: 0 0 12px;
    border-radius: 12px;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border-soft);
    font-size: 0.85rem;
}
.workout-general-notes summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    list-style: none;
    color: var(--color-text-muted);
    min-width: 0;
}
.workout-general-notes summary::-webkit-details-marker { display: none; }
.wgn-label { font-weight: 700; color: var(--color-brand-dark); flex-shrink: 0; }
.wgn-preview { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workout-general-notes[open] .wgn-preview { display: none; }
.wgn-body { padding: 0 12px 10px; white-space: pre-line; overflow-wrap: anywhere; }

/* Gráfica de 1RM: periodo */
.nowrap { white-space: nowrap; }
.chart-range { display: flex; gap: 6px; margin: 0 0 8px; }
.chart-range[hidden] { display: none; }
.chart-range button {
    margin: 0;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border-soft);
    background: transparent;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: none;
}
.chart-range button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== Probar sin cuenta ===== */
.lp-try-form { display: contents; }
.lp-try-form button.lp-btn { font: inherit; font-weight: 700; margin: 0; cursor: pointer; border: 0; }
.lp-alt-cta { margin: 14px 0 0; color: rgba(255, 255, 255, 0.72); font-size: 0.9rem; }
.lp-alt-cta a { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.lp-alt-cta-center { text-align: center; }
@media (max-width: 600px) { .lp-hero-copy .lp-alt-cta { text-align: center; } }
.guest-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin: 0 auto 12px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    color: var(--color-text);
    font-size: 0.85rem;
    text-decoration: none;
    text-align: center;
}
.guest-bar strong { color: var(--color-brand-dark); }

/* ===== Biseries (app/supersets.py) =====
   Las tarjetas de un grupo van pegadas, con una banda de color a la
   izquierda y la etiqueta "Biserie A · 1/2". */
.exercise-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ss-link-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 10px; border-radius: 999px; border: 1px dashed var(--color-border-soft);
    background: none; color: var(--color-text-muted); font: inherit; font-size: 0.8rem; cursor: pointer;
}
.ss-link-btn.is-linked { border-style: solid; border-color: rgba(var(--accent-rgb), 0.45); color: var(--color-brand-deep); }
@media (hover: hover) { .ss-link-btn:hover { background: var(--color-surface-hover); } }
/* El último de la lista no tiene "siguiente" con el que unirse. */
#workoutExercisesList > .card:last-child .ss-link-btn,
.routine-ex-list > .routine-ex:last-child .ss-link-btn { display: none; }
.routine-ex .ss-link-btn { margin: 10px 0 0 34px; }
.card.ss-member { border-left: 4px solid var(--accent); }
.card.ss-member:not(.ss-last) { margin-bottom: 4px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; }
.card.ss-member:not(.ss-first) { border-top-left-radius: 4px; border-top-right-radius: 4px; }
.ss-tag {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; margin: 0 0 6px;
    padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; font-family: inherit;
    background: rgba(var(--accent-rgb), 0.12); color: var(--color-brand-deep); border: 0; cursor: pointer;
}
.ss-timer-how { margin: 0 0 4px; font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.4; }
.ss-tag-times { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; opacity: 0.85; }
.ss-timer-body { padding: 4px 16px 16px; display: grid; gap: 14px; }
.ss-timer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ss-timer-row small { display: block; font-size: 0.75rem; color: var(--color-text-muted); margin-top: 2px; }
.ss-stepper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ss-stepper button {
    width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--color-border-soft);
    background: var(--surface); color: var(--color-brand-deep); font-size: 1.2rem; font-weight: 700; cursor: pointer;
}
.ss-stepper output { min-width: 52px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.routine-ex .ss-tag { margin-left: 34px; }
/* Admin: nombres del catálogo (texto a la izquierda, no cifras). */
.catalog-names { margin: 12px 0; }
.catalog-names th, .catalog-names td { text-align: left; vertical-align: top; }
.catalog-names td small { color: var(--color-text-muted); }
/* Rankings de amigos mientras llegan (/rango/amigos). */
.ranking-loading { display: grid; gap: 10px; padding: 8px 0 4px; }
.skeleton-line { display: block; height: 34px; border-radius: 10px; background: var(--color-surface-active); animation: skeleton-pulse 1.2s ease-in-out infinite; }
.skeleton-line:nth-child(2) { width: 88%; }
.skeleton-line:nth-child(3) { width: 72%; }
@keyframes skeleton-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line { animation: none; } }
.level-streak-tiers, .level-streak-now { display: block; margin-top: 3px; font-size: 0.75rem; color: var(--color-text-muted); }
.level-streak-now { color: var(--color-brand-deep); font-weight: 700; }
/* Admin: errores del servidor (/landing/stats). */
.server-error { border-top: 1px solid var(--border-subtle); padding: 8px 0; }
.server-error summary { cursor: pointer; font-size: 0.85rem; }
.server-error small { color: var(--color-text-muted); word-break: break-word; }
.server-error pre { max-height: 320px; overflow: auto; font-size: 0.7rem; white-space: pre-wrap; word-break: break-word; background: var(--color-surface-hover); padding: 8px; border-radius: 8px; }
/* Solo admin: servidor frente a red en cada página (base.html). */
.timing-badge {
    position: fixed; left: 8px; top: calc(8px + env(safe-area-inset-top)); z-index: 1003;
    padding: 3px 8px; border-radius: 999px; font-size: 0.68rem; font-variant-numeric: tabular-nums;
    background: rgba(20, 12, 40, 0.72); color: #fff; pointer-events: auto; cursor: pointer;
    white-space: pre-line; max-width: calc(100vw - 16px);
}

/* Pulsación "pop" (base.html): al apoyar el dedo se encoge y al soltar
   rebota hinchándose un poco. Va por JS porque :active casi no se ve con un
   toque rápido en el móvil. */
@media (prefers-reduced-motion: no-preference) {
    .tap-down { transform: scale(0.94) !important; transition: transform 0.08s ease !important; }
    .tap-pop { animation: tap-pop 0.28s cubic-bezier(0.3, 1.6, 0.5, 1) !important; }
}
@keyframes tap-pop {
    0% { transform: scale(0.94); }
    55% { transform: scale(1.06); }
    100% { transform: scale(1); }
}
