/* GymApp — design tokens
   Paleta "Volt": fondo carbón oscuro + acento verde lima de alta energía.
   Evita el azul corporativo de Aura a propósito; busca sensación de
   gimnasio/rendimiento, no de app de oficina. Contraste alto para uso
   con luz de gimnasio o pantalla al aire libre. */

:root {
    --color-bg: #0e1013;
    --color-surface: #171a20;
    --color-surface-alt: #1f232b;
    --color-border: #2a2f38;

    --color-text: #f2f3f0;
    --color-text-muted: #9aa0ab;

    --color-accent: #c6ff3d;
    --color-accent-contrast: #0e1013;
    --color-danger: #ff6b6b;
    --color-danger-bg: rgba(255, 107, 107, 0.12);

    /* Categóricos para diferenciar tarjetas de ejercicio por tipo (no
       "rainbow": 3 tonos fijos, el verde de acento queda reservado para
       estado/actividad, nunca se reusa aquí). */
    --color-cat-fuerza: #7c94ab;
    --color-cat-cardio: #ff9d5c;
    --color-cat-core: #b18aff;

    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --radius-md: 14px;
    --radius-lg: 22px;

    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 48px;

    /* Curvas de easing con más "punch" que las de CSS por defecto —
       las nativas (ease-out, ease-in-out) se sienten planas. */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

.screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-4) var(--space-3);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-bottom: var(--space-5);
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-accent);
    box-shadow: 0 0 16px var(--color-accent);
}

.brand-name {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 var(--space-1);
    letter-spacing: -0.01em;
}

.auth-subtitle {
    color: var(--color-text-muted);
    font-size: 15px;
    margin: 0 0 var(--space-4);
}

.field {
    margin-bottom: var(--space-3);
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.field input {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-family: inherit;
    font-size: 17px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.field input::placeholder {
    color: #565d69;
}

.field input:focus {
    border-color: var(--color-accent);
    background: var(--color-surface-alt);
}

.btn-primary {
    width: 100%;
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.01em;
    border: none;
    border-radius: var(--radius-md);
    padding: 17px 18px;
    cursor: pointer;
    margin-top: var(--space-1);
    transition: transform 0.1s ease, filter 0.15s ease;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

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

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-secondary:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.alert {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.dashboard {
    text-align: center;
}

.dashboard-welcome {
    font-size: 34px;
    font-weight: 800;
    margin: 0 0 var(--space-2);
    letter-spacing: -0.01em;
}

.dashboard-sub {
    color: var(--color-text-muted);
    font-size: 15px;
    margin: 0 0 var(--space-5);
}

@media (min-width: 480px) {
    .auth-title {
        font-size: 34px;
    }
}

/* ---- Shell de las pantallas internas (topbar + contenido) ---- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: rgba(14, 16, 19, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
}

.brand--compact {
    margin-bottom: 0;
    text-decoration: none;
}

.topbar-salir {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    color: var(--color-text-muted);
    text-decoration: none;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.topbar-salir svg {
    display: block;
}

.topbar-salir:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* ---- Barra de navegación inferior fija (tipo app) ---- */

.bottombar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    background: rgba(14, 16, 19, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottombar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 2px 10px;
    text-decoration: none;
    color: var(--color-text-muted);
    min-width: 0;
}

.bottombar-icon {
    display: flex;
    line-height: 1;
    opacity: 0.85;
}

.bottombar-icon svg {
    display: block;
}

.bottombar-label {
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bottombar-item--active {
    color: var(--color-accent);
}

.bottombar-item--active .bottombar-icon {
    opacity: 1;
}

.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-3);
    padding-bottom: calc(var(--space-3) + 72px);
}

.page-header {
    margin-bottom: var(--space-4);
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-1);
}

.page-subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
    margin: 0;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
}

.card + .card {
    margin-top: var(--space-2);
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 var(--space-2);
}

.form-grid {
    display: grid;
    gap: var(--space-2);
}

.field select {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-family: inherit;
    font-size: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    outline: none;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position: calc(100% - 22px) center, calc(100% - 17px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.field select:focus {
    border-color: var(--color-accent);
    background-color: var(--color-surface-alt);
}

.field-hint {
    display: block;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 6px;
}

.timer-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.timer-row input {
    flex: 1;
    min-width: 0;
}

.timer-btn {
    flex-shrink: 0;
    width: auto;
    padding: 0 14px;
    font-size: 13px;
    white-space: nowrap;
}

.btn-primary--sm {
    width: auto;
    display: inline-block;
    padding: 12px 20px;
    font-size: 14px;
}

.list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.section-label {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin: var(--space-4) 0 var(--space-1);
}

.section-label:first-child {
    margin-top: 0;
}

.exercise-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2);
}

.exercise-row--inactive {
    opacity: 0.5;
}

.exercise-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.exercise-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exercise-name:hover {
    color: var(--color-accent);
}

.exercise-equipo {
    font-size: 13px;
    color: var(--color-text-muted);
}

.exercise-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-shrink: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

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

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

.empty-state {
    color: var(--color-text-muted);
    font-size: 14px;
    text-align: center;
    padding: var(--space-4) 0;
}

.back-link {
    display: inline-block;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.back-link:hover {
    color: var(--color-text);
}

/* ---- Planes semanales ---- */

.plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    text-decoration: none;
    color: var(--color-text);
}

.plan-row-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.plan-row-name {
    font-size: 16px;
    font-weight: 700;
}

.plan-row-meta {
    font-size: 13px;
    color: var(--color-text-muted);
}

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    flex-shrink: 0;
}

.badge--muted {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.inline-form {
    display: inline;
}

.day-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
}

.day-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.day-card-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-exercise-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px var(--space-2);
    margin-bottom: 8px;
}

.plan-exercise-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.plan-exercise-name {
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-exercise-target {
    font-size: 13px;
    color: var(--color-accent);
    font-weight: 700;
}

.plan-exercise-notas {
    font-size: 12px;
    color: var(--color-text-muted);
}

.add-exercise-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-1);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
}

.add-exercise-form .field {
    margin-bottom: 0;
}

.add-exercise-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-1);
}

@media (min-width: 480px) {
    .day-card-title {
        font-size: 20px;
    }
}

/* ---- Registro en vivo estilo Hevy: pantalla dedicada, sin el chrome
   normal de la app (topbar/bottombar), con su propio header fijo. ---- */

body.we-body {
    padding-bottom: 0;
}

.we-header {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 14px var(--space-3);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.we-header-back {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    flex-shrink: 0;
}

.we-header-title {
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.we-header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: transform 140ms var(--ease-out), color 140ms ease;
}

.we-header-icon-btn:active {
    transform: scale(0.9);
    color: var(--color-text);
}

.we-header-finish {
    flex-shrink: 0;
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 13px;
    padding: 9px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 140ms var(--ease-out);
}

.we-header-finish:active {
    transform: scale(0.95);
}

.we-stats {
    position: sticky;
    top: 62px;
    z-index: 14;
    display: flex;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) var(--space-2);
}

.we-stat {
    flex: 1;
    text-align: center;
}

.we-stat-value {
    display: block;
    font-size: 17px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

.we-stat-label {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.we-container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-2) 100px;
}

/* Pantalla aislada de reordenar (entrenamiento_reordenar.php): filas de
   solo texto + dos flechas, sin gestos táctiles de ningún tipo. */
.we-reordenar-lista {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.we-reordenar-fila {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
}

.we-reordenar-nombre {
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.we-reordenar-flechas {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.we-reordenar-flecha {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    cursor: pointer;
    transition: transform 140ms var(--ease-out), opacity 140ms ease;
}

.we-reordenar-flecha:active {
    transform: scale(0.92);
}

.we-reordenar-flecha:disabled {
    opacity: 0.3;
    cursor: default;
}

.we-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top-width: 4px;
    border-top-color: var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.we-card--fuerza {
    border-top-color: var(--color-cat-fuerza);
}

.we-card--cardio {
    border-top-color: var(--color-cat-cardio);
}

.we-card--core {
    border-top-color: var(--color-cat-core);
}

/* El ejercicio "activo" (el primero sin terminar) se resalta con el verde
   de acento — el mismo color de los botones y el checkmark completado. */
.we-card--activa {
    border-top-color: var(--color-accent);
    box-shadow: 0 0 0 1px rgba(198, 255, 61, 0.12), 0 6px 24px rgba(198, 255, 61, 0.08);
}

.we-card-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--color-cat-fuerza);
}

.we-card-dot--fuerza {
    background: var(--color-cat-fuerza);
}

.we-card-dot--cardio {
    background: var(--color-cat-cardio);
}

.we-card-dot--core {
    background: var(--color-cat-core);
}

.we-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 4px 4px 0;
}

.we-card-title-group {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.we-card-title {
    font-size: 16.5px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Área táctil real de 44x44 (accesibilidad), aunque el ícono ▶ visual
   quede chico en el centro — se logra con márgenes negativos para que
   no empuje el layout de alrededor. */
.we-card-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -11px -10px -11px -3px;
    border-radius: 999px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13px;
    flex-shrink: 0;
}

.we-card-link:hover,
.we-card-link:active {
    color: var(--color-accent);
    background: var(--color-surface-alt);
}

.we-objetivo {
    padding: 2px 4px 0;
    font-size: 12.5px;
    color: var(--color-text-muted);
}

/* Menú "⋮" nativo (details/summary), sin JS */
.we-menu {
    position: relative;
    flex-shrink: 0;
}

.we-menu summary {
    list-style: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 18px;
    border-radius: var(--radius-md);
}

.we-menu summary::-webkit-details-marker {
    display: none;
}

.we-menu[open] summary {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.we-menu-panel {
    position: absolute;
    right: 0;
    top: 36px;
    z-index: 5;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 190px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.we-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--color-text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 10px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
}

.we-menu-item:hover {
    background: var(--color-surface);
}

.we-menu-item--danger {
    color: var(--color-danger);
}

.we-note-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--color-border);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 13.5px;
    font-style: italic;
    padding: 8px 4px;
    margin: 4px 0 2px;
}

.we-note-input:focus {
    outline: none;
    color: var(--color-text);
    border-bottom-color: var(--color-accent);
}

.we-rest-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 10px;
    font-size: 12.5px;
    color: var(--color-text-muted);
}

.we-rest-row input {
    width: 52px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-family: inherit;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    padding: 4px 6px;
    border-radius: 6px;
    text-align: center;
}

.we-table-head,
.we-row {
    display: grid;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
}

.we-row--peso_reps,
.we-table-head.we-table-head--peso_reps {
    grid-template-columns: 26px 1fr 58px 52px 44px;
}

.we-row--tiempo,
.we-table-head.we-table-head--tiempo {
    grid-template-columns: 26px 1fr 116px 44px;
}

.we-timer-cell {
    display: flex;
    align-items: stretch;
    gap: 4px;
}

.we-timer-cell input {
    flex: 1;
    min-width: 0;
}

.we-timer-btn {
    flex-shrink: 0;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    transition: transform 140ms var(--ease-out), background 140ms ease, border-color 140ms ease;
}

.we-timer-btn:active {
    transform: scale(0.92);
}

.we-timer-btn svg {
    display: block;
}

.we-timer-btn--activo {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-accent-contrast);
}

.we-table-head {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}

.we-table-head span {
    text-align: center;
}

.we-table-head span:first-child {
    text-align: left;
}

.we-row {
    border-radius: 10px;
}

.we-row--completada {
    background: rgba(198, 255, 61, 0.07);
}

.we-cell-num {
    font-size: 13px;
    font-weight: 800;
    color: var(--color-text-muted);
    text-align: center;
}

.we-cell-anterior {
    font-size: 12.5px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.we-row input {
    width: 100%;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    padding: 10px 2px;
    border-radius: 8px;
    min-width: 0;
}

.we-row input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.we-row--completada input {
    border-color: rgba(198, 255, 61, 0.4);
}

.we-check {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1.5px solid var(--color-border);
    background: var(--color-surface-alt);
    color: transparent;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    justify-self: center;
    transition: transform 140ms var(--ease-out), background 140ms ease, border-color 140ms ease;
}

.we-check:active {
    transform: scale(0.9);
}

.we-check--activo {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-accent-contrast);
}

.we-add-set {
    display: block;
    width: 100%;
    margin-top: var(--space-1);
    background: transparent;
    border: 1.5px dashed var(--color-border);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 140ms var(--ease-out), color 140ms ease, border-color 140ms ease;
}

.we-add-set:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.we-add-set:active {
    transform: scale(0.98);
}

/* Banner de descanso: fijo abajo, aparece solo mientras corre */
.we-rest-banner {
    position: fixed;
    left: var(--space-2);
    right: var(--space-2);
    bottom: 16px;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    border-radius: var(--radius-lg);
    padding: 12px var(--space-2) 12px var(--space-3);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.we-rest-banner-label {
    font-size: 13px;
    font-weight: 700;
}

.we-rest-banner-time {
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.we-rest-banner-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.we-rest-btn {
    background: rgba(14, 16, 19, 0.15);
    border: none;
    color: var(--color-accent-contrast);
    font-family: inherit;
    font-weight: 800;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
}

.we-add-exercise-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
}

/* ---- Swipe para eliminar (tarjeta entera y fila individual) ---- */

.we-swipe-wrap {
    position: relative;
    margin-bottom: var(--space-3);
}

/* Filas que tienen SUS PROPIOS controles pegados al borde derecho
   (.exercise-actions: editar/YouTube/desactivar) — al deslizar la fila,
   esos controles se mueven CON ella y pueden terminar ocupando el mismo
   lugar que el botón "Eliminar"/"Desactivar" revelado, bloqueándolo.
   overflow:hidden recorta cualquier cosa de la fila que quede fuera del
   wrap. No se aplica al wrap genérico (.we-swipe-wrap a secas) porque el
   de las tarjetas de ejercicio SÍ necesita que su menú "⋮" pueda
   desbordar. */
.we-swipe-wrap--recorta {
    overflow: hidden;
}

/* Dentro de .list el espaciado ya lo da el gap del flex — el margen propio
   del wrap duplicaría el espacio entre filas. */
.list > .we-swipe-wrap {
    margin-bottom: 0;
}

.we-swipe-wrap .we-card,
.we-swipe-wrap .plan-row,
.we-swipe-wrap .exercise-row,
.we-swipe-wrap .plan-exercise-row {
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    background-color: var(--color-surface);
}

/* .exercise-row--inactive normalmente se atenúa con opacity, pero eso
   volvería semitransparente TODA la fila (dejando ver el botón de abajo) —
   dentro de un swipe-wrap, mejor sin atenuar (ya se distingue por el
   ícono/etiqueta "Reactivar"). */
.we-swipe-wrap .exercise-row--inactive {
    opacity: 1;
}

/* .plan-exercise-row usa margin-bottom (no está dentro de un .list con
   flex-gap) — ese margen pasa al wrap para no duplicar el espaciado. */
.day-card > .we-swipe-wrap {
    margin-bottom: 8px;
}

/* touch-action no se puede cambiar a mitad de un touch ya iniciado (el
   navegador ya decidió cómo manejarlo desde el touchstart) — "pan-y"
   (dejar que el navegador scrollee nativo) suena razonable para elementos
   que SOLO tienen swipe horizontal, pero en la práctica Chrome/Safari
   cancela el touch (pointercancel) apenas 2 eventos después de arrancar,
   INCLUSO en un swipe puramente horizontal sin ninguna componente
   vertical — reconfirmado dos veces con Playwright + CDP real. Por eso
   todos los elementos con swipe usan "none" desde siempre, y el scroll
   vertical se emula a mano en swipe_delete.js — con inercia/momentum al
   soltar el dedo, para que se sienta igual que el scroll nativo. */
.we-swipe-wrap .we-card,
.we-swipe-wrap .plan-row,
.we-swipe-wrap .exercise-row,
.we-swipe-wrap .plan-exercise-row {
    touch-action: none;
}

/* iOS Safari muestra su propio menú de "Copiar/Seleccionar" al mantener
   presionado, lo que compite con nuestro gesto de long-press — se
   desactiva en el cascarón de la tarjeta, pero se restaura en los campos
   de texto reales (nota, peso, reps) para no romper la edición normal. */
.we-swipe-wrap,
.we-swipe-wrap .we-card,
.we-swipe-wrap .plan-row,
.we-swipe-wrap .exercise-row,
.we-swipe-wrap .plan-exercise-row {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.we-swipe-wrap input,
.we-swipe-wrap textarea,
.we-swipe-wrap select {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

.we-swipe-delete {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--color-danger);
    color: #1a0a0a;
    font-family: inherit;
    font-weight: 800;
    font-size: 13px;
    border: none;
    border-radius: var(--radius-lg);
    z-index: 1;
    cursor: pointer;
}

/* Swipe para eliminar UNA sola serie (fila) — mismo patrón que el swipe
   de tarjeta entera, a escala de fila. */
.we-row-swipe-wrap {
    position: relative;
}

.we-row-swipe-wrap .we-row {
    position: relative;
    z-index: 2;
    background-color: var(--color-surface);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.we-row-swipe-wrap .we-row input {
    -webkit-user-select: text;
    user-select: text;
}

.we-row-swipe-wrap .we-row--completada {
    /* Mismo verde que --color-accent al 7% mezclado sobre --color-surface,
       pero SÓLIDO — si quedara translúcido dejaría ver el botón rojo de
       abajo incluso con la fila cerrada. */
    background-color: rgb(35, 42, 34);
}

.we-row-swipe-delete {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-danger);
    color: #1a0a0a;
    font-family: inherit;
    font-weight: 800;
    font-size: 12px;
    border: none;
    border-radius: 10px;
    z-index: 1;
    cursor: pointer;
}

/* Insignia de "completo" en el header de la tarjeta */
.we-card-badge-completo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    font-size: 10px;
    font-weight: 800;
    flex-shrink: 0;
}

.we-card--completada {
    opacity: 0.8;
    transition: opacity 0.4s ease;
}

/* Animación (no instantánea) al terminar todas las series de un ejercicio */
@keyframes we-completado-pulso {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(198, 255, 61, 0.35);
    }
    30% {
        transform: scale(1.018);
        box-shadow: 0 0 0 7px rgba(198, 255, 61, 0.16);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(198, 255, 61, 0);
    }
}

.we-card--recien-completada {
    animation: we-completado-pulso 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
    .we-card--recien-completada {
        animation: none;
    }
}

/* ---- Overlay de carga (generar feedback con IA) ---- */

.we-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: rgba(14, 16, 19, 0.9);
    backdrop-filter: blur(4px);
    text-align: center;
    padding: var(--space-3);
}

.we-loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    animation: we-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .we-loading-spinner {
        animation: none;
        border-top-color: var(--color-accent);
    }
}

.we-loading-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-muted);
}
