/* ==========================================================================
   Workout Tracker Style — GAINZ
   Theme: Sleek Dark Mode, Glassmorphism, Neon Green & Cyan Accent
   ========================================================================== */

:root {
    /* Background — muito escuro, quase preto com leve azul */
    --bg-color: #01030c;
    --bg-gradient: linear-gradient(160deg, #01030c 0%, #030718 50%, #040920 100%);

    /* Cards — azul-índigo bem opaco, visivelmente mais claro que o fundo */
    --card-bg: rgba(24, 34, 78, 0.97);
    --card-border: rgba(255, 255, 255, 0.10);
    --card-border-top: rgba(255, 255, 255, 0.22); /* borda superior mais clara = luz vindo de cima */
    --card-border-focus: rgba(0, 240, 255, 0.5);

    /*
     * Sombra 3D para dark mode:
     * Não usamos sombra preta (invisível no escuro).
     * Usamos: highlight interno no topo + glow colorido externo + sombra fina preta.
     * Resultado: parece que o card está elevado com luz acima.
     */
    --card-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),   /* highlight borda superior = fonte de luz */
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),          /* sombra borda inferior = profundidade */
        0 2px 8px rgba(0, 0, 0, 0.8),               /* sombra de contato */
        0 12px 32px rgba(0, 0, 0, 0.6),             /* sombra difusa de elevação */
        0 0 30px rgba(6, 80, 200, 0.10);            /* glow azul ambiente — visível no escuro */

    --card-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 0.20),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.8),
        0 16px 40px rgba(0, 0, 0, 0.65),
        0 0 40px rgba(6, 100, 220, 0.16);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    /* Neon Palettes */
    --neon-green: #22c55e;
    --neon-green-glow: rgba(34, 197, 94, 0.35);
    --neon-cyan: #00f0ff;
    --neon-cyan-glow: rgba(0, 240, 255, 0.35);
    --neon-purple: #a855f7;
    --neon-purple-glow: rgba(168, 85, 247, 0.25);

    --accent: var(--neon-cyan);
    --accent-glow: var(--neon-cyan-glow);

    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.25);
    --warning: #f59e0b;

    /* Typography & Layout */
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius-lg: 20px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: all 0.15s ease;

    /* Legacy (usado em timer-card, etc.) */
    --shadow-deep: var(--card-shadow);
}

body.light-theme {
    --bg-color: #f1f5f9;
    --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.80);
    --card-border: rgba(15, 23, 42, 0.10);
    --card-border-top: rgba(255, 255, 255, 0.95);
    --card-border-focus: rgba(6, 182, 212, 0.4);

    /* Light mode: sombra escura clássica funciona bem em fundo claro */
    --card-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),    /* borda superior branca = reflexo */
        0 1px 3px rgba(15, 23, 42, 0.08),
        0 8px 24px rgba(15, 23, 42, 0.12),
        0 20px 40px rgba(15, 23, 42, 0.10);

    --card-shadow-hover:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 1px 3px rgba(15, 23, 42, 0.10),
        0 12px 32px rgba(15, 23, 42, 0.16),
        0 24px 48px rgba(15, 23, 42, 0.12);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --neon-green: #166534;
    --neon-green-glow: rgba(22, 101, 52, 0.15);
    --neon-cyan: #0891b2;
    --neon-cyan-glow: rgba(8, 145, 178, 0.15);
    --neon-purple: #7e22ce;
    --neon-purple-glow: rgba(126, 34, 206, 0.1);

    --accent: var(--neon-cyan);
    --accent-glow: var(--neon-cyan-glow);

    --danger: #ef4444;
    --shadow-deep: var(--card-shadow);
}

/* Base Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove click overlay on mobile */
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: var(--font-family);
    background: var(--bg-color);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
}

/* App Container */
.app-container {
    max-width: 480px; /* Locked to max mobile width for responsive feel */
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 15px 15px calc(96px + env(safe-area-inset-bottom)) 15px;
    position: relative;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5px 20px 5px;
}

.header-logo {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.header-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(to right, #00f0ff, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.neon-glow {
    font-size: 1.4rem;
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 5px var(--neon-cyan));
}

.user-weight-pill {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 6px 12px;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.user-weight-pill input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 45px;
    font-family: inherit;
    font-weight: 600;
    text-align: right;
}

/* Remove spin buttons */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Main content */
.app-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tab-view {
    display: none;
}

.tab-view.active {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeSlideIn 0.2s ease;
}

.bottom-nav {
    position: fixed;
    left: max(12px, calc((100vw - 480px) / 2 + 12px));
    right: max(12px, calc((100vw - 480px) / 2 + 12px));
    bottom: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) 8px;
    background: rgba(8, 13, 34, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-bottom: none;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.bottom-nav-btn {
    min-width: 0;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    transition: var(--transition-fast);
}

.bottom-nav-btn i {
    font-size: 1rem;
}

.bottom-nav-btn.active {
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.10);
    border-color: rgba(0, 240, 255, 0.20);
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.12);
}

body.light-theme .bottom-nav {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.12);
}

body.light-theme .bottom-nav-btn.active {
    background: rgba(8, 145, 178, 0.08);
    border-color: rgba(8, 145, 178, 0.18);
}

body.light-theme .workout-exercise-item {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .workout-exercise-item.active {
    background: rgba(8, 145, 178, 0.08);
    border-color: rgba(8, 145, 178, 0.22);
}

body.light-theme .workout-exercise-order {
    background: rgba(15, 23, 42, 0.05);
}

/* Glass Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    /* Borda superior mais clara simula luz acima — o segredo do efeito 3D no dark mode */
    border-top-color: var(--card-border-top);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: var(--transition-smooth);
}

.card:hover {
    border-color: var(--card-border);
    border-top-color: var(--card-border-top);
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-1px);
}

.selector-section {
    position: relative;
    z-index: 10; /* Eleva a seção do seletor para que o autocomplete fique por cima das outras telas */
}

.workout-session-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.workout-session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.workout-session-header > div {
    min-width: 0;
}

.session-eyebrow {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

#workout-session-title {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-progress-pill {
    flex: 0 0 auto;
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 999px;
    background: rgba(0, 240, 255, 0.08);
    color: var(--neon-cyan);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 4px 10px;
}

.workout-exercise-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workout-exercise-item {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: var(--transition-fast);
}

.workout-exercise-item:active {
    transform: scale(0.99);
}

.workout-exercise-item.active {
    border-color: rgba(0, 240, 255, 0.35);
    background: rgba(0, 240, 255, 0.10);
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.10);
}

.workout-exercise-order {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
}

.workout-exercise-main {
    min-width: 0;
}

.workout-exercise-main strong,
.workout-exercise-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workout-exercise-main strong {
    font-size: 0.94rem;
}

.workout-exercise-main small {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.session-free-btn {
    align-self: flex-start;
}

/* Grid helper */
.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Inputs Groups */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0; /* Permite que o container e os elementos filhos encolham no grid */
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.input-group select,
.input-group input[type="text"],
.input-group input[type="number"] {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition-fast);
    width: 100%;
    min-width: 0; /* Garante que o select/input encolha se o grid encolher */
    box-sizing: border-box;
}

select option {
    background-color: #0f132a;
    color: var(--text-primary);
}

.input-group select:focus,
.input-group input[type="text"]:focus,
.input-group input[type="number"]:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

#exercise-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

body.light-theme #exercise-select {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

#exercise-select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.exercise-group {
    margin-top: 5px;
}

/* Autocomplete wrapper */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-wrapper input {
    width: 100%;
    padding-right: 40px; /* Space for the clear button */
}

.hidden-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
}

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

.suggestions-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #0f132a;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition-fast);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.suggestion-item .suggestion-muscle {
    font-size: 0.75rem;
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-cyan);
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--border-radius-md);
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-smooth);
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #0284c7 100%);
    color: #fff;
    box-shadow: 0 4px 15px var(--neon-cyan-glow);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 5px var(--neon-cyan-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger-sm {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-danger-sm:hover {
    background: var(--danger);
    color: white;
}

.btn-block {
    display: flex;
}

/* Title row inside sections */
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 12px;
}

.section-title-row h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.logging-title-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.details-info-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(168, 85, 247, 0.24);
    border-radius: 999px;
    background: rgba(168, 85, 247, 0.10);
    color: var(--neon-purple);
    cursor: pointer;
    transition: var(--transition-fast);
}

.details-info-btn:active {
    transform: scale(0.96);
}

.section-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.ref-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.set-counter-pill {
    background: rgba(168, 85, 247, 0.15);
    color: var(--neon-purple);
    border: 1px solid rgba(168, 85, 247, 0.25);
    padding: 3px 10px;
    border-radius: var(--border-radius-lg);
    font-size: 0.8rem;
    font-weight: 700;
}

/* Reference card contents */
.ref-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.empty-state {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    padding: 10px 0;
    font-style: italic;
}

.ref-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    border-left: 3px solid var(--neon-green);
}

.ref-row.warm-up {
    border-left-color: var(--text-muted);
}
.ref-row.drop-set {
    border-left-color: var(--neon-purple);
}
.ref-row.failure {
    border-left-color: var(--danger);
}

.ref-set-num {
    font-weight: 600;
    color: var(--text-secondary);
}

.ref-values {
    font-weight: 700;
    color: var(--text-primary);
}

.ref-type-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Logging card disabled state */
.disabled-state {
    opacity: 0.45;
    pointer-events: none;
}

/* Segmented Control / Tabs */
.tabs-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-md);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 2px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Incremental Input Grid */
.log-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.input-control-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    text-align: center;
}

.incremental-input {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

/* Mobile Friendly Large Button target sizes */
.btn-increment {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-primary);
    width: 48px;
    height: 48px; /* Touch target size */
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-increment:active {
    background: rgba(255, 255, 255, 0.12);
}

.incremental-input input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: inherit;
    width: 100%;
}

/* Quick Incremental Buttons helpers */
.quick-helpers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 4px;
}

.btn-helper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 0;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-fast);
}

.btn-helper:active {
    background: rgba(0, 240, 255, 0.1);
    color: var(--neon-cyan);
}

.input-context-kpi {
    min-height: 18px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}

/* Optional details */
.optional-details {
    margin-bottom: 20px;
}

.optional-details summary {
    font-size: 0.85rem;
    color: var(--neon-cyan);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px;
}

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

.optional-details summary::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    transition: var(--transition-fast);
}

.optional-details[open] summary::after {
    transform: rotate(180deg);
}

.details-content {
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    margin-top: 8px;
}

/* Today's History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.history-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.history-table td {
    padding: 12px 10px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    vertical-align: middle;
    white-space: nowrap;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr {
    transition: transform 0.18s ease, background 0.18s ease;
}

.history-table tr.swipe-ready {
    will-change: transform;
}

.history-table tr.swipe-copy {
    background: rgba(34, 197, 94, 0.12);
}

.history-table tr.swipe-delete {
    background: rgba(239, 68, 68, 0.12);
}

.history-today-section,
.evolution-section {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.075);
    border-top-color: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.26);
}

.history-today-section:hover,
.evolution-section:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 8px 22px rgba(0, 0, 0, 0.28);
    transform: none;
}

.compact-history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.compact-history-item {
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 10px 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    transition: transform 0.18s ease, background 0.18s ease;
}

.compact-history-item.swipe-ready {
    will-change: transform;
}

.compact-history-item.swipe-copy {
    background: rgba(34, 197, 94, 0.12);
}

.compact-history-item.swipe-delete {
    background: rgba(239, 68, 68, 0.12);
}

.compact-set-num {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.compact-set-values {
    min-width: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-set-rpe {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.compact-history-item .btn-danger-sm {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.type-indicator {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    display: inline-block;
}

.type-indicator.working {
    background: rgba(34, 197, 94, 0.1);
    color: var(--neon-green);
}
.type-indicator.warm {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}
.type-indicator.drop {
    background: rgba(168, 85, 247, 0.1);
    color: var(--neon-purple);
}
.type-indicator.failure {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge {
    background: rgba(6, 182, 212, 0.15);
    color: var(--neon-cyan);
    padding: 3px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    margin-top: 10px;
}

/* Timer Overlay */
.timer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: var(--transition-smooth);
}

.timer-card {
    background: #0f132a;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 30px 20px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 15px 40px rgba(0, 240, 255, 0.1);
    text-align: center;
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.timer-card h3 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.timer-clock {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--neon-cyan);
    font-variant-numeric: tabular-nums;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px var(--neon-cyan-glow));
}

.timer-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 25px;
}

.timer-progress-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, var(--neon-cyan), var(--neon-green));
    transition: width 1s linear;
}

.timer-controls {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 15px;
}

.timer-controls .btn {
    padding: 10px;
}

/* Animations */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Light Theme Component Overrides */
body.light-theme .theme-toggle-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .suggestions-list {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body.light-theme .suggestion-item {
    border-bottom-color: rgba(15, 23, 42, 0.04);
}

body.light-theme .suggestion-item:hover {
    background: rgba(15, 23, 42, 0.04);
}

body.light-theme .timer-card {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

body.light-theme .timer-clock {
    color: var(--neon-cyan);
}

body.light-theme .quick-helpers .btn-helper {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.05);
}

body.light-theme .tabs-group {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.05);
}

body.light-theme .tab-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
}

body.light-theme .incremental-input {
    background: rgba(15, 23, 42, 0.02);
}

body.light-theme .btn-increment {
    background: rgba(15, 23, 42, 0.04);
}

body.light-theme select option {
    background-color: #ffffff;
    color: var(--text-primary);
}

/* ==========================================================================
   Select + Action Button (lado a lado)
   ========================================================================== */

.select-with-action {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.select-with-action select {
    flex: 1;
    min-width: 0;
}

/* Botão ícone circular (engrenagem / sliders) */
.btn-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-top-color: var(--card-border-top);
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    transform: rotate(15deg);
}

/* ==========================================================================
   Modal Genérico
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: flex-end; /* Bottom sheet em mobile */
    justify-content: center;
    padding: 0;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-top-color: var(--card-border-top);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px 20px 40px;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--neon-cyan);
}

.modal-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 12px calc(16px + env(safe-area-inset-bottom)) 12px;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bottom-sheet-overlay.open {
    display: flex;
}

.bottom-sheet-overlay .details-section {
    width: min(100%, 456px);
    max-height: 72vh;
    overflow-y: auto;
    padding-top: 10px;
    border-radius: 18px 18px 14px 14px;
    animation: bottomSheetIn 0.2s ease;
}

.bottom-sheet-handle {
    width: 42px;
    height: 4px;
    margin: 0 auto 12px auto;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
}

.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bottom-sheet-header h3 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
}

@keyframes bottomSheetIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Formulário de criação de treino (dentro do modal)
   ========================================================================== */

.treino-create-form {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.treino-form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-create-treino {
    width: auto;
    padding: 12px 20px;
    align-self: flex-end;
    flex-shrink: 0;
    margin-top: 4px;
}

/* ==========================================================================
   Lista de treinos no modal
   ========================================================================== */

.treinos-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.treino-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 12px 14px;
    transition: var(--transition-fast);
}

.treino-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.treino-item-info {
    flex: 1;
    min-width: 0;
}

.treino-item-nome {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.treino-item-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.treino-item-actions {
    display: flex;
    align-items: center;
    align-self: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Botão editar inline */
.treino-item.editing .treino-item-info {
    display: none;
}

.treino-edit-form {
    display: none;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.treino-item.editing .treino-edit-form {
    display: flex;
}

.treino-edit-form input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border-focus);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-icon-sm.edit-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.btn-icon-sm.delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-icon-sm.save-btn:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--neon-green);
    color: var(--neon-green);
}

.btn-icon-sm.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* ==========================================================================
   Light Theme Overrides — Modal e Componentes Novos
   ========================================================================== */

body.light-theme .btn-icon {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.10);
}

body.light-theme .btn-icon:hover {
    background: rgba(8, 145, 178, 0.08);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

body.light-theme .modal-card {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.10);
    box-shadow: var(--card-shadow);
}

body.light-theme .treino-create-form {
    background: rgba(15, 23, 42, 0.02);
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .treino-item {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .treino-item:hover {
    background: rgba(15, 23, 42, 0.05);
}

body.light-theme .btn-icon-sm {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
    color: var(--text-secondary);
}

body.light-theme .treino-edit-form input {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(8, 145, 178, 0.4);
    color: var(--text-primary);
}

.exercise-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.exercise-header-row label {
    margin-bottom: 0 !important;
}

.sub-toggle-btn {
    background: transparent;
    border: none;
    color: var(--neon-cyan);
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.sub-toggle-btn:hover {
    background: rgba(0, 240, 255, 0.08);
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

body.light-theme .sub-toggle-btn {
    color: var(--accent);
}

body.light-theme .sub-toggle-btn:hover {
    background: rgba(14, 165, 233, 0.08);
}

.exercise-actions-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-btn {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-btn:hover {
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
}

.voice-btn.recording {
    color: #ef4444;
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.ai-glow {
    box-shadow: 0 0 12px var(--neon-cyan) !important;
    border-color: var(--neon-cyan) !important;
    transition: all 0.3s ease;
}

body.light-theme .voice-btn:hover {
    color: var(--accent);
    background: rgba(14, 165, 233, 0.08);
}

body.light-theme .ai-glow {
    box-shadow: 0 0 12px var(--accent) !important;
    border-color: var(--accent) !important;
}

.autofill-glow {
    box-shadow: 0 0 12px var(--neon-green-glow) !important;
    border-color: var(--neon-green) !important;
    transition: all 0.3s ease;
}

body.light-theme .autofill-glow {
    box-shadow: 0 0 12px var(--neon-green-glow) !important;
    border-color: var(--neon-green) !important;
}

/* ==========================================================================
   Painel de Substituições de Exercícios
   ========================================================================== */

.substitution-panel {
    margin-top: 12px;
    background: rgba(0, 240, 255, 0.04);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    animation: fadeSlideIn 0.25s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.substitution-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0, 240, 255, 0.06);
    border-bottom: 1px solid rgba(0, 240, 255, 0.10);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.substitution-header i.fa-shuffle {
    color: var(--neon-cyan);
    font-size: 0.9rem;
}

.substitution-header span {
    flex: 1;
}

.substitution-header strong {
    color: var(--neon-cyan);
}

.sub-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.sub-close-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.substitution-groups {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
}

.sub-equipment-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sub-equipment-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Cores por tipo de equipamento */
.sub-equipment-label[data-eq="calistenia"] { color: #22c55e; }
.sub-equipment-label[data-eq="halteres"]   { color: #a78bfa; }
.sub-equipment-label[data-eq="barra"]      { color: #fb923c; }
.sub-equipment-label[data-eq="cabo"]       { color: #38bdf8; }
.sub-equipment-label[data-eq="máquina"]    { color: #94a3b8; }
.sub-equipment-label[data-eq="peso_livre"] { color: #fbbf24; }

.sub-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sub-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.sub-chip:hover {
    background: rgba(0, 240, 255, 0.10);
    border-color: var(--neon-cyan);
    color: var(--text-primary);
    transform: scale(1.03);
}

.sub-chip .sub-chip-level {
    font-size: 0.65rem;
    opacity: 0.6;
}

/* ==========================================================================
   Light Theme — Painel de Substituições
   ========================================================================== */

body.light-theme .substitution-panel {
    background: rgba(8, 145, 178, 0.04);
    border-color: rgba(8, 145, 178, 0.15);
}

body.light-theme .substitution-header {
    background: rgba(8, 145, 178, 0.06);
    border-bottom-color: rgba(8, 145, 178, 0.10);
}

body.light-theme .sub-equipment-label {
    border-bottom-color: rgba(15, 23, 42, 0.06);
}

body.light-theme .sub-chip {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
    color: var(--text-secondary);
}

body.light-theme .sub-chip:hover {
    background: rgba(8, 145, 178, 0.08);
    border-color: var(--neon-cyan);
    color: var(--text-primary);
}

/* Priorização de Exercícios no Autocomplete */
.template-star {
    color: var(--neon-cyan);
    margin-right: 6px;
    filter: drop-shadow(0 0 3px rgba(0, 240, 255, 0.4));
}

.suggestion-item.template-priority {
    border-left: 2px solid var(--neon-cyan);
    background: rgba(0, 240, 255, 0.02);
}

.suggestion-item.template-priority:hover {
    background: rgba(0, 240, 255, 0.06);
}

/* Responsividade para telas muito pequenas (iPhone 7, SE, etc.) */
@media (max-width: 380px) {
    .app-container {
        padding: 10px 10px calc(92px + env(safe-area-inset-bottom)) 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    .grid-2-cols {
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .select-with-action {
        gap: 4px;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
    }
    
    .input-group select,
    .input-group input[type="text"],
    .input-group input[type="number"] {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
    
    .input-group label {
        font-size: 0.78rem;
        letter-spacing: 0.5px;
    }
    
    .app-header {
        padding: 5px 2px 15px 2px;
    }
    
    .header-logo h1 {
        font-size: 1.5rem;
    }
}

/* Layout do Exercício dentro do Modal de Gerenciamento */
.treino-item-wrapper {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.treino-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 0;
    padding: 12px 14px;
}

.treino-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.treino-ex-panel {
    padding: 14px 14px 120px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.treino-ex-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.treino-ex-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-sm);
    gap: 12px;
}

.treino-ex-ordem {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 16px;
}

.treino-ex-nome {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
}

.treino-ex-grupo {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.treino-ex-row .delete-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.treino-ex-row .delete-btn:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.treino-ex-add-form {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.ex-search-wrapper {
    position: relative;
    flex: 1;
}

.ex-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition-fast);
}

.ex-search-input:focus {
    border-color: var(--neon-cyan) !important;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.ex-selected-grupo {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition-fast);
    max-width: 110px;
    cursor: pointer;
    box-sizing: border-box;
}

body.light-theme .ex-selected-grupo {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--text-primary);
}

.ex-selected-grupo:focus {
    border-color: var(--neon-cyan) !important;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

@media (max-width: 480px) {
    .treino-ex-add-form {
        flex-wrap: wrap;
    }
    .ex-search-wrapper {
        flex: 1 1 100%;
    }
    .ex-selected-grupo {
        flex: 1 1 auto;
        max-width: 48%;
    }
    .treino-ex-add-form button[type="submit"] {
        flex: 1 1 auto;
    }
}

.ex-search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #0b0f19;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.ex-search-suggestions .suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition-fast);
}

.ex-search-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.ex-search-suggestions .suggestion-item:hover {
    background: rgba(0, 240, 255, 0.08);
    color: var(--neon-cyan);
}

/* Estilos para o Cabeçalho de Grupo de Inputs (Alinhamento do Gerenciador de Treinos) */
.input-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    width: 100%;
}

.input-group-header label {
    margin-bottom: 0 !important;
}

.btn-text-link {
    background: transparent;
    border: none;
    color: var(--neon-cyan);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.btn-text-link:hover {
    color: var(--text-primary);
    background: rgba(0, 240, 255, 0.08);
}

/* Container de Chips de Grupo Muscular (Filtro Horizontal) */
.muscle-group-chips-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 2px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    width: 100%;
}

.muscle-group-chips-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.muscle-chip {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.muscle-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.muscle-chip.active {
    background: rgba(0, 240, 255, 0.10);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

/* Ajustes no Light Theme para novos estilos */
body.light-theme .btn-text-link {
    color: var(--accent);
}

body.light-theme .btn-text-link:hover {
    background: rgba(8, 145, 178, 0.08);
    color: var(--text-primary);
}

body.light-theme .muscle-chip {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
    color: var(--text-secondary);
}

body.light-theme .muscle-chip:hover {
    background: rgba(8, 145, 178, 0.06);
    color: var(--text-primary);
}

body.light-theme .muscle-chip.active {
    background: rgba(8, 145, 178, 0.08);
    border-color: var(--neon-cyan);
    color: var(--text-primary);
}

/* Ajustes no Light Theme para o Editor de Templates */
body.light-theme .treino-item-wrapper {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

body.light-theme .treino-item {
    border-bottom-color: rgba(15, 23, 42, 0.05);
}

body.light-theme .treino-ex-panel {
    background: rgba(8, 145, 178, 0.015);
    border-top-color: rgba(15, 23, 42, 0.05);
}

body.light-theme .treino-ex-row {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.02);
}

body.light-theme .treino-ex-row .treino-ex-ordem {
    color: var(--text-muted);
}

body.light-theme .treino-ex-row .treino-ex-nome {
    color: #0f172a;
}

body.light-theme .treino-ex-grupo {
    background: rgba(15, 23, 42, 0.04);
    color: var(--text-secondary);
}

body.light-theme .ex-search-input {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
    color: #0f172a;
}

body.light-theme .ex-search-input:focus {
    border-color: var(--accent) !important;
}

body.light-theme .ex-search-suggestions {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
}

body.light-theme .ex-search-suggestions .suggestion-item {
    border-bottom-color: rgba(15, 23, 42, 0.04);
    color: #334155;
}

body.light-theme .ex-search-suggestions .suggestion-item:hover {
    background: rgba(8, 145, 178, 0.06);
    color: #0891b2;
}

/* Details Section styles */
.details-section {
    transition: var(--transition-smooth);
}

.details-summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    user-select: none;
}

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

.details-summary::after {
    content: '\f078'; /* fa-chevron-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

details[open] .details-summary::after {
    transform: rotate(180deg);
}

.details-content {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--card-border);
    padding-top: 15px;
}

.details-content textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition-smooth);
}

.details-content textarea:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.2);
    outline: none;
}

/* Light Theme overrides for Details Section */
body.light-theme .details-content textarea {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, 0.15);
    color: #0f172a;
}

body.light-theme .details-content textarea:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
}

.details-text-display {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--neon-purple);
    border-radius: var(--border-radius-sm);
    margin: 0;
    white-space: pre-wrap;
}

body.light-theme .details-text-display {
    color: #475569;
    background: rgba(15, 23, 42, 0.02);
}

.offline-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

body.light-theme .offline-indicator {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.4);
    color: #b45309;
}

.offline-sync-btn {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    margin-left: 6px;
    padding: 0;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
}

.offline-sync-btn:hover:not(:disabled) {
    opacity: 0.8;
    transform: scale(1.1);
}

.offline-sync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.offline-sync-btn.syncing i {
    animation: spin 1.2s linear infinite;
}

/* Unified Exercise Selection - Back to Template Button */
.search-options-row {
    margin-top: 8px;
    display: flex;
    justify-content: flex-start;
}

.back-to-template-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-smooth);
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
}

.back-to-template-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    text-decoration: underline;
}

body.light-theme .back-to-template-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.set-types-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

body.light-theme .set-types-legend {
    border-top-color: rgba(15, 23, 42, 0.06);
}

body.light-theme .type-indicator.warm {
    background: rgba(15, 23, 42, 0.05);
    color: #475569;
}

body.light-theme .history-today-section,
body.light-theme .evolution-section {
    background: rgba(255, 255, 255, 0.74);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

body.light-theme .compact-history-item {
    background: rgba(15, 23, 42, 0.025);
    border-color: rgba(15, 23, 42, 0.07);
}

body.light-theme .bottom-sheet-overlay {
    background: rgba(15, 23, 42, 0.28);
}

body.light-theme .bottom-sheet-handle {
    background: rgba(15, 23, 42, 0.18);
}

/* Voice transcript correction */
.voice-transcript-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid rgba(0, 240, 255, 0.14);
    border-radius: var(--border-radius-md);
    background: rgba(0, 240, 255, 0.04);
}

.voice-transcript-panel label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--neon-cyan);
}

.voice-transcript-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.voice-transcript-row input {
    min-width: 0;
}

.voice-transcript-row .btn {
    width: auto;
    min-height: 44px;
    padding: 10px 14px;
}

.voice-btn.recording::after {
    content: '';
    position: absolute;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 50%;
    animation: voiceWave 1.2s infinite;
}

@keyframes voiceWave {
    from { transform: scale(0.75); opacity: 0.9; }
    to { transform: scale(1.55); opacity: 0; }
}

/* Progress KPIs */
.progress-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 6px 0 12px 0;
}

.progress-kpi {
    min-width: 0;
    padding: 10px 8px;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.035);
}

.progress-kpi-label {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.progress-kpi strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sticky rest timer */
.timer-overlay {
    top: auto;
    align-items: flex-end;
    justify-content: center;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
    padding: 0 12px calc(86px + env(safe-area-inset-bottom)) 12px;
}

.timer-card {
    pointer-events: auto;
    max-width: 456px;
    padding: 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "title clock controls"
        "bar bar bar";
    align-items: center;
    gap: 8px 12px;
    text-align: left;
    border-radius: 14px;
    animation: fadeSlideIn 0.2s ease;
}

.timer-card h3 {
    grid-area: title;
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.1;
}

.timer-clock {
    grid-area: clock;
    margin: 0;
    font-size: 2rem;
    text-align: center;
}

.timer-progress-bar {
    grid-area: bar;
    margin: 0;
}

.timer-controls {
    grid-area: controls;
    display: flex;
    gap: 8px;
}

.timer-controls .btn {
    width: auto;
    min-height: 42px;
    padding: 8px 12px;
    white-space: nowrap;
}

@media (max-width: 380px) {
    .progress-kpis {
        grid-template-columns: 1fr;
    }

    .compact-history-item {
        grid-template-columns: auto auto 1fr auto;
    }

    .compact-set-rpe {
        display: none;
    }

    .timer-card {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "clock controls"
            "bar bar";
    }

    .timer-card h3 {
        display: none;
    }
}
