        :root{--bg:#0f1115;--card:#1f2229;--primary:#3b82f6;--success:#10b981;--warning:#f59e0b;--text:#f3f4f6;--danger:#ef4444;--border:#374151;--input-bg:#14161a;--text-muted:#9ca3af;--table-header:#2a2d35;--table-row-text:#ffffff; --tab-active:#4f46e5;}
        [data-theme="light"]{--bg:#f3f4f6;--card:#ffffff;--text:#1f2937;--border:#e5e7eb;--input-bg:#f9fafb;--text-muted:#6b7280;--table-header:#f3f4f6;--table-row-text:#111827; --tab-active:#4f46e5;}
        html,body{overscroll-behavior-y:contain;font-family:sans-serif;background:var(--bg);color:var(--text);margin:0;padding:10px;padding-top:calc(10px + env(safe-area-inset-top));padding-bottom:calc(80px + env(safe-area-inset-bottom));padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);transition:0.2s}
        .card{background:var(--card);padding:12px;margin-bottom:12px;border-radius:12px;border:1px solid var(--border);position:relative;overflow:hidden;width:100%;box-sizing:border-box}
        .auth-container{max-width:380px;margin:60px auto;padding:20px}
        .auth-title{text-align:center;color:var(--primary);margin-bottom:20px;font-weight:800;font-size:1.6em}
        input,select,textarea{background:var(--input-bg);color:var(--text);padding:10px;border-radius:8px;border:1px solid var(--border);width:100%;box-sizing:border-box;font-size:14px;margin-bottom:8px}
        button{background:var(--primary);color:white;padding:11px;border:none;border-radius:8px;width:100%;font-size:13px;font-weight:bold;cursor:pointer;margin-bottom:5px;transition:0.1s}
        button:active{transform:scale(0.96)}
        .btn-success{background:var(--success)} .btn-warning{background:var(--warning)} .btn-danger{background:var(--danger)}

        /* CALENDÁRIO 100% */
        .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 12px; width: 100%; box-sizing: border-box; }
        .cal-day { text-align: center; font-size: 10px; padding: 8px 2px; background: var(--input-bg); border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; }
        .cal-day.active { background: var(--tab-active); color: white; font-weight: bold; border-color: var(--tab-active); }

        /* ABAS E BOTÕES INLINE */
        .btn-tab { background: var(--table-header); color: var(--text-muted); border: 1px solid var(--border); padding: 6px 12px; border-radius: 8px; font-weight: bold; font-size: 12px; cursor: pointer; white-space: nowrap; }
        .btn-tab.active { background: var(--tab-active); color: white; border-color: var(--tab-active); }
        .btn-tab-dia { font-size: 9px; min-width: 35px; width: auto; padding: 5px; background: var(--input-bg); color: var(--text-muted); border: 1px solid var(--border); border-radius: 4px; }
        .btn-tab-dia.active { background: var(--tab-active); color: white; border-color: var(--tab-active); font-weight: bold; }

        /* TRAVA ANTI-CLIQUE */
        .lock-container{display:flex;justify-content:space-between;align-items:center;background:var(--input-bg);border-radius:8px;padding:8px 12px;margin-top:8px;border:1px dashed var(--border)}
        .btn-lock-safety{width:auto;font-size:11px;padding:6px 16px;border-radius:6px;text-transform:uppercase;font-weight:bold;margin:0}
        .btn-lock-safety.locked{background:var(--danger);color:white} 
        .btn-lock-safety.unlocked{background:var(--success);color:white}

        /* V12: Caixa de observações melhorada */
        textarea.obs-input { background:var(--input-bg); color:var(--text); padding:10px; border-radius:8px; border:1px solid var(--border); width:100%; box-sizing:border-box; font-size:13px; margin-bottom:8px; resize:vertical; min-height:44px; white-space:pre-wrap; word-wrap:break-word; overflow-wrap:break-word; line-height:1.4; }

        /* GESTÃO */
        .gestao-view { border: 2px dashed var(--primary); background: var(--input-bg); padding: 15px; border-radius: 8px; margin-top: 10px; }
        .gestao-tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; width: 100%; }
        .gestao-tab-btn { background: var(--table-header); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; font-size: 11px; border-radius: 6px; white-space: nowrap; cursor: pointer; font-weight: bold; width: auto;}
        .gestao-tab-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
        .btn-plano { background: var(--table-header); border: 1px solid var(--border); color: var(--text-muted); font-size: 11px; margin-bottom: 6px; width: 100%; text-align: center; font-weight: bold;}
        .btn-plano.active { background: #1e3a8a; border: 2px solid var(--primary); color: white; box-shadow: 0 0 10px rgba(59,130,246,0.3); }
        .item-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; font-size: 12px; }
        .progress-container { background: var(--border); height: 8px; border-radius: 4px; margin: 10px 0; overflow: hidden; width: 100%; }
        .progress-bar { background: var(--success); height: 100%; transition: width 0.3s; }
        .banner-aluno { background: var(--danger); color: white; padding: 10px; border-radius: 8px; margin-bottom: 10px; font-size: 12px; font-weight: bold; text-align: center; display: flex; justify-content: space-between; align-items: center; }

        /* EVOLUÇÃO DESIGN (V7) */
        .grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin-bottom: 15px; }
        .form-group { display: flex; flex-direction: column; gap: 4px; }
        .form-group label { font-size: 10px; color: var(--text-muted); font-weight: bold; text-transform: uppercase; }
        .form-group input { margin-bottom: 0; padding: 8px; font-size: 13px; }
        .section-title-ev { font-size: 11px; color: var(--primary); font-weight: bold; margin: 15px 0 8px 0; border-bottom: 1px solid var(--border); padding-bottom: 4px; text-transform: uppercase; }

        /* TREINO DESIGN */
        .ex-name-display { font-size: 1.5em; font-weight: 900; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; display: inline-block;}
        .header-exercise{display:flex; align-items:center; gap:8px; padding-right:35px; margin-bottom:4px; min-height:24px; flex-wrap:wrap}
        .ordem-badge{font-size:13px; font-weight:900; color:#fff; background:linear-gradient(135deg,#1e3a8a,#3b82f6); border-radius:6px; padding:2px 8px; min-width:28px; text-align:center; box-shadow:0 0 8px rgba(59,130,246,0.4);}
        .ordem-edit{cursor:pointer; border:1px dashed rgba(255,255,255,0.5);}
        .ordem-controls{display:inline-flex; gap:4px; margin-left:auto;}
        .btn-ordem{width:26px; height:26px; padding:0; margin:0; background:var(--input-bg); border:1px solid var(--border); color:var(--text); border-radius:6px; font-size:11px; display:inline-flex; align-items:center; justify-content:center; cursor:pointer;}
        .btn-ordem:disabled{opacity:0.3; cursor:not-allowed;}
        .category-tag { font-size: 16px; background: var(--input-bg); padding: 5px 12px; border-radius: 6px; color: var(--text); font-weight:bold; }
        .grid-row-biset-head { display: grid; grid-template-columns: 0.4fr 5fr; padding: 7px 4px; background: rgba(59,130,246,0.10); border-bottom: 1px solid var(--border); border-top: 2px solid var(--primary); align-items: center; }
        .grid-row-biset-head.done { opacity: 0.55; }
        .grid-row-sub { background: rgba(255,255,255,0.02); }
        .btn-inline-edit { background:transparent; color:var(--warning); padding:0; width:auto; border:none; font-size:16px; margin-left:5px; cursor:pointer;}
        .ex-color-picker { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; border:2px solid rgba(255,255,255,0.5); cursor:pointer; margin-left:4px; overflow:hidden; flex-shrink:0; vertical-align:middle; }
        .ex-color-picker input[type=color] { opacity:0; width:100%; height:100%; border:none; padding:0; margin:0; cursor:pointer; }
        .btn-inline-del { background:transparent; color:var(--danger); padding:0; width:auto; border:none; font-size:16px; margin:0; cursor:pointer;}
        
        /* BOTÕES DESABILITADOS (TRAVA FECHADA) */
        .btn-blocked { opacity: 0.25; cursor: not-allowed !important; pointer-events: none; }

        .grid-table { width: 100%; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); margin-top: 8px; }
        .grid-header-6 { display: grid; grid-template-columns: 0.4fr 1.4fr 0.5fr 0.6fr 0.6fr 0.4fr 0.4fr; background: var(--table-header); padding: 5px; font-size: 9px; font-weight: bold; color: var(--primary); text-align: center; }
        .grid-row-6 { display: grid; grid-template-columns: 0.4fr 1.4fr 0.5fr 0.6fr 0.6fr 0.4fr 0.4fr; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: 12px; text-align: center; align-items: center; transition: 0.2s; }
        .btn-check { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; margin: 0 auto; transition: 0.2s;}
        .btn-check.active { background: var(--success); border-color: var(--success); color: white; font-size: 11px; }
        
        .set-type-container { display: flex; gap: 6px; margin-bottom: 10px; }
        .btn-set-type { background: var(--input-bg); border: 1px solid var(--border); color: var(--text-muted); padding: 8px; font-size: 11px; border-radius: 6px; flex: 1; text-align: center; font-weight: bold;}
        .btn-set-type.active-normal { background: var(--success); color: white; border-color: var(--success); }
        .btn-set-type.active-biset { background: var(--primary); color: white; border-color: var(--primary); }
        .btn-set-type.active-triset { background: var(--warning); color: white; border-color: var(--warning); }
        
        .rest-timer-container { display: flex; align-items: center; gap: 8px; background: var(--input-bg); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; flex-wrap: wrap; }
        .rest-timer-display { font-family: monospace; font-size: 30px; font-weight: bold; color: var(--text-muted); min-width: 78px; letter-spacing: 1px; }
        .rest-timer-display.running { color: var(--success); }
        .rest-timer-display.countdown { color: var(--warning); }
        .rest-timer-label { font-size: 11px; color: var(--text-muted); font-weight: bold; }

        /* GRÁFICO CONTAINER */
        .chart-container { position: relative; height: 160px; width: 100%; margin-top: 10px; margin-bottom: 5px; }

        /* BOTÃO EVOLUÇÃO */
        .btn-evolucao { 
            background: linear-gradient(135deg, #1e3a8a, #3b82f6); 
            color: white; 
            font-size: 11px; 
            padding: 7px 14px; 
            border-radius: 8px; 
            width: 100%; 
            font-weight: bold; 
            margin-top: 8px;
            border: 1px solid rgba(59,130,246,0.4);
            letter-spacing: 0.5px;
        }

        /* PAINEL GRÁFICO */
        .evolucao-panel {
            display: none;
            background: var(--input-bg);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 12px;
            margin-top: 8px;
        }
        .evolucao-panel.visible { display: block; }
        .evolucao-title {
            font-size: 11px;
            color: var(--text-muted);
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 6px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .evolucao-no-data {
            text-align: center;
            color: var(--text-muted);
            font-size: 12px;
            padding: 20px 0;
        }

        .modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.85);display:flex;align-items:center;justify-content:center;z-index:2000;padding:15px}
        .modal-content{background:var(--card);border:1px solid var(--border);border-radius:16px;width:100%;max-width:420px;max-height:85vh;display:flex;flex-direction:column;overflow:hidden}
        .modal-header{padding:15px;border-bottom:1px solid var(--border);font-weight:bold;color:var(--primary);font-size:1.1em;text-align:center}
        .modal-body{padding:20px;overflow-y:auto;font-size:14px;line-height:1.5;color:var(--text)}

        .video-input-wrapper { display: flex; align-items: center; gap: 6px; background: var(--input-bg); border-radius: 6px; padding: 4px 8px; border: 1px solid var(--border); margin-bottom: 8px; }
        .video-input-wrapper input { background: transparent; border: none; padding: 4px; margin: 0; flex: 1; font-size: 11px; color: var(--text); }
        .video-input-wrapper input:focus { outline: none; }
        .video-icon { font-size: 14px; font-weight: bold; color: #ef4444; background: rgba(239,68,68,0.15); border-radius: 4px; padding: 2px 5px; flex-shrink: 0; letter-spacing: 0; }
        .btn-video-trigger { background: linear-gradient(135deg, #dc2626, #ef4444); color: white; font-size: 11px; padding: 6px 12px; border-radius: 8px; width: 100%; font-weight: bold; margin-bottom: 6px; border: none; cursor: pointer; }
        .video-modal-iframe-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000; }
        .video-modal-iframe-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

        /* SENHA GERADA */
        .senha-gerada-box { background: rgba(16,185,129,0.08); border: 1px solid var(--success); border-radius: 8px; padding: 10px; margin-top: 8px; font-size: 12px; }
        .senha-valor { font-family: monospace; font-size: 18px; font-weight: bold; color: var(--success); letter-spacing: 2px; text-align: center; padding: 8px; background: var(--input-bg); border-radius: 6px; margin: 6px 0; }
