@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;700&display=swap');

/* ========================================================= */
/* DEFINIÇÃO DE TEMAS GLOBAIS DO SITE                        */
/* ========================================================= */
[data-theme="blue"] {
    --primary: #00e5ff;
    --primary-dim: rgba(0, 229, 255, 0.2);
    --primary-bg: rgba(0, 229, 255, 0.05);
}
[data-theme="red"] {
    --primary: #ff3333;
    --primary-dim: rgba(255, 51, 51, 0.2);
    --primary-bg: rgba(255, 51, 51, 0.05);
}

:root {
    --bg-dark: #0a0c10;
    --panel-bg: #161b22;
    --text-main: #c9d1d9;
    --accent: #30363d;
    --success: #2ea043;
    --warning: #d29922;
    --danger: #f85149;
    --purple: #8957e5;
}

body { 
    font-family: 'Rajdhani', sans-serif; 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    margin: 0; 
    padding: 15px; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    overflow-x: hidden; 
}
* { box-sizing: border-box; }

/* FEEDBACK VISUAL PARA TEXTOS EDITÁVEIS */
[contenteditable="true"]:hover {
    outline: 1px dashed var(--primary);
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    cursor: text;
}
[contenteditable="true"]:focus {
    outline: 1px solid var(--primary);
    background: rgba(0,0,0,0.3);
}

/* CLASSES UTILITÁRIAS */
.w-100 { width: 100% !important; }
.mb-6 { margin-bottom: 6px !important; }
.mb-10 { margin-bottom: 10px !important; }
.mt-6 { margin-top: 6px !important; }
.mt-10 { margin-top: 10px !important; }
.bg-primary { background: var(--primary) !important; }
.bg-success { background: var(--success) !important; }
.bg-warning { background: var(--warning) !important; }
.text-dark { color: #000 !important; }
.text-white { color: #fff !important; }
.bold-text { font-weight: bold !important; }
.flex-gap { display: flex; gap: 6px; }
.flex-1 { flex: 1; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }

/* ========================================================= */
/* TOP BAR & FILTROS INTELIGENTES                            */
/* ========================================================= */
.top-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: var(--panel-bg); 
    padding: 10px 20px; 
    border-radius: 8px; 
    border: 1px solid var(--accent); 
    margin-bottom: 15px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); 
    flex-wrap: wrap; 
    gap: 15px;
}
.brand-logo { display: flex; align-items: center; gap: 10px; font-family: 'Orbitron', sans-serif; font-size: 1.2em; font-weight: 700; letter-spacing: 1px; color: #fff; }
.brand-logo span { color: var(--primary); }
.logo-icon { width: 30px; height: 30px; background: linear-gradient(135deg, var(--primary), #0055ff); border-radius: 50%; box-shadow: 0 0 10px var(--primary-dim); }

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.control-select { background: var(--bg-dark); color: #fff; border: 1px solid var(--accent); padding: 6px; border-radius: 4px; font-weight: bold; width: auto; min-width: 150px; }
.outline-primary { border-color: var(--primary); color: var(--primary); }
.dashed-warning { background: rgba(0,229,255,0.1); border: 1px dashed var(--warning); color: var(--text-main); }
.warning-border { border-color: var(--warning); color: var(--warning); }

/* BOTÕES */
button { font-family: 'Rajdhani', sans-serif; font-weight: 700; cursor: pointer; transition: all 0.2s ease; border-radius: 4px; padding: 8px 16px; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.5px; }
.btn-primary { background: var(--primary); color: #000; border: none; box-shadow: 0 0 10px var(--primary-dim); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 15px var(--primary); }
.btn-outline { background: transparent; border: 1px solid var(--text-main); color: var(--text-main); }
.btn-outline:hover { background: var(--accent); }
.btn-pdf { background: #e63946; color: #fff; border: none; box-shadow: 0 0 10px rgba(230,57,70,0.3); }
.btn-green { background: var(--success); color: #fff; border: none; }
.btn-png { background: var(--purple); color: #fff; border: none; }
.theme-toggle { background: #222; border: 1px solid #444; color: #fff; }

.nav-tabs-container { display: flex; gap: 10px; margin-bottom: 15px; justify-content: center; flex-wrap: wrap; }
.btn-tab { background: var(--panel-bg); color: var(--text-main); border: 1px solid var(--accent); padding: 10px 20px; font-size: 1em; border-radius: 6px; flex: 1; min-width: 200px; text-align: center; }
.btn-tab:hover { background: var(--accent); }
.btn-tab.active { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); box-shadow: 0 0 10px var(--primary-dim); }

/* ========================================================= */
/* LAYOUT PRINCIPAL E FORMULÁRIOS                            */
/* ========================================================= */
.main-container { display: grid; grid-template-columns: 380px 1fr; gap: 15px; align-items: start; }
.col-left { display: flex; flex-direction: column; gap: 15px; }
.panel { background: var(--panel-bg); border: 1px solid var(--accent); border-radius: 8px; padding: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.panel h2 { margin: 0 0 15px 0; font-family: 'Orbitron', sans-serif; font-size: 1.1em; color: var(--primary); border-bottom: 1px solid var(--accent); padding-bottom: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
input, select { background: var(--bg-dark); border: 1px solid var(--accent); color: var(--text-main); padding: 8px; border-radius: 4px; font-family: 'Rajdhani', sans-serif; font-size: 0.9em; width: 100%; transition: border-color 0.2s; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 5px var(--primary-dim); }
.section-title { font-weight: bold; margin: 10px 0 5px 0; color: #fff; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.5px; }

.toggle-switch { position: relative; display: inline-block; width: 34px; height: 18px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--accent); border-radius: 18px; transition: .4s; }
.toggle-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: #8b949e; border-radius: 50%; transition: .4s; }
input:checked + .toggle-slider { background-color: var(--primary); }
input:checked + .toggle-slider:before { transform: translateX(16px); background-color: #000; }

.label-tiny { color: var(--warning); font-size: 0.85em; font-weight: bold; display: block; margin-bottom: 2px; }
.spacer-dashed { border-top: 1px dashed var(--accent); margin: 2px 0; }
.msg-status { text-align: center; font-size: 0.8em; margin-top: 6px; color: var(--success); font-weight: bold; height: 14px; }

.instrucoes-texto { font-size: 0.8em; color: #8b949e; margin-bottom: 10px; line-height: 1.2; }
.alerta-edicao { text-align: center; font-size: 0.75em; color: var(--warning); margin: 6px 0; }

/* ========================================================= */
/* CAIXAS DE RELATÓRIO E AVALIAÇÃO FÍSICA                    */
/* ========================================================= */
.export-box { background: var(--panel-bg); border: 1px solid var(--accent); border-radius: 8px; padding: 30px; box-shadow: 0 8px 30px rgba(0,0,0,0.5); margin-bottom: 20px; position: relative; overflow: hidden; width: 100%; box-sizing: border-box; }
.header-relatorio { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid var(--primary); padding-bottom: 10px; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.header-relatorio h2 { margin: 0; font-family: 'Orbitron', sans-serif; font-size: 2em; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; }
.info-data { text-align: right; font-size: 0.9em; color: #8b949e; }

.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 20px; }
.metric-card { background: var(--primary-bg); border: 1px solid var(--primary-dim); border-radius: 6px; padding: 10px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.metric-card .label { font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.5px; color: #8b949e; margin-bottom: 5px; }
.metric-card .value { font-size: 1.6em; font-family: 'Orbitron', sans-serif; font-weight: 700; color: #fff; }
.metric-card small { font-size: 0.5em; color: var(--primary); margin-left: 2px; }
.metric-card .delta { font-size: 0.7em; margin-top: 2px; font-weight: bold; }
.tmb-card { background: rgba(210, 153, 34, 0.05); border-color: rgba(210, 153, 34, 0.3); }
.tmb-card .value, .tmb-card small { color: var(--warning); }
.tmb-card .sub-label { font-size: 0.7em; color: #8b949e; margin-top: 4px; border-top: 1px dashed rgba(210, 153, 34, 0.3); padding-top: 4px; }

/* CAIXAS DE ALERTA DINÂMICAS */
.danger-alert { border-color: var(--danger) !important; background: rgba(248, 81, 73, 0.1) !important; }
.danger-alert .value { color: var(--danger) !important; }
.warning-alert { border-color: var(--warning) !important; background: rgba(210, 153, 34, 0.1) !important; }
.warning-alert .value { color: var(--warning) !important; }

.diagnosis-container { border: 1px solid var(--accent); border-radius: 6px; overflow: hidden; margin-bottom: 20px; }
.diag-header-bar { background: var(--accent); padding: 8px 15px; font-weight: bold; font-family: 'Orbitron', sans-serif; font-size: 0.9em; text-transform: uppercase; letter-spacing: 1px; }
.diag-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; padding: 15px; }
.diag-col h4 { margin: 0 0 10px 0; font-size: 0.85em; text-transform: uppercase; color: #8b949e; border-bottom: 1px solid var(--accent); padding-bottom: 5px; }
.diag-col p { margin: 0; font-size: 0.85em; line-height: 1.4; color: #c9d1d9; }
.title-corp { color: #00e5ff !important; }
.title-nutri { color: #2ea043 !important; }
.title-treino { color: #e63946 !important; }
.btn-tiny-edit { background: transparent; border: none; cursor: pointer; padding: 0; font-size: 1.1em; }

.visual-area { display: flex; gap: 20px; flex-wrap: wrap; }
.chart-wrapper { flex: 1; min-width: 300px; height: 320px; border: 1px solid var(--accent); border-radius: 6px; padding: 10px; background: rgba(0,0,0,0.2); position: relative; display: flex; justify-content: center; align-items: center; }
.measures-wrapper { width: 300px; max-width: 100%; border: 1px solid var(--accent); border-radius: 6px; padding: 15px; background: var(--bg-dark); }
.medidas-title { margin: 0 0 8px 0; color: var(--primary); text-transform: uppercase; text-align: center; font-family: 'Orbitron', sans-serif; font-size: 0.85em; border-bottom: 1px solid var(--accent); padding-bottom: 4px; }
.measure-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--accent); font-size: 0.85em; }
.measure-row:last-child { border-bottom: none; }
.measure-row span:first-child { color: #8b949e; }
.measure-row span:last-child { font-family: 'Orbitron', sans-serif; font-weight: bold; color: #fff; }

.export-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--accent); flex-wrap: wrap; gap: 10px; }
.logo-text { font-family: 'Orbitron', sans-serif; font-weight: 900; color: #30363d; font-size: 1.5em; text-transform: uppercase; letter-spacing: 2px; }

/* ESTILOS EXTRAS DO PLANO ALIMENTAR */
.border-success { border-bottom: 2px solid var(--success) !important; border-color: var(--success) !important; }
.text-success { color: var(--success) !important; }
.plano-objetivo { color: #c9d1d9; font-weight: bold; font-size: 1.1em; text-transform: uppercase; margin-top: 5px; }
.tag-semana { font-size: 0.8em; background: #000; color: var(--success); padding: 2px 8px; border-radius: 4px; font-weight: bold; }
.pad-15 { padding: 12px 15px; }
.grid-2-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }
.meta-diaria { font-size: 1.2em; color: var(--success); font-family: 'Orbitron', sans-serif; font-weight: bold; }
.label-macro { color: #8b949e; font-size: 0.8em; text-transform: uppercase; }
.val-macro { color: #fff; font-size: 1.1em; }
.refeicoes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; }
.recomendacoes-box { margin-top: 15px; background: rgba(210, 153, 34, 0.05); border-color: var(--warning); }
.trans-bg { background: transparent !important; }
.lista-rec { margin: 0; padding-left: 20px; color: #c9d1d9; font-size: 0.9em; line-height: 1.5; }

/* ========================================================= */
/* DIETA E TREINO: BUILDER E TABELAS                         */
/* ========================================================= */
.builder-container { margin-top: 15px; display: flex; flex-direction: column; gap: 10px; max-height: 500px; overflow-y: auto; padding-right: 5px; }

.card-refeicao { border: 1px solid var(--accent); border-radius: 6px; background: rgba(0,0,0,0.2); overflow: hidden; display: flex; flex-direction: column; }
.card-ref-header { background: var(--accent); padding: 6px 10px; font-weight: bold; font-size: 0.85em; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.card-ref-body { padding: 10px; font-size: 0.85em; color: #c9d1d9; line-height: 1.4; flex-grow: 1; }

.treino-dia-card { border: 1px solid var(--accent); background: rgba(0,0,0,0.3); border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.treino-dia-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.treino-dia-header input { font-weight: bold; color: var(--primary); background: transparent; border: none; border-bottom: 1px solid var(--accent); padding: 2px; width: 70%; }

.exercicio-linha { 
    display: grid; 
    grid-template-columns: 3fr 1fr 1fr 2.5fr 35px 30px; 
    gap: 5px; 
    margin-bottom: 5px; 
    align-items: center; 
}

/* Scroll nas tabelas do gerador final */
.table-responsive { width: 100%; overflow-x: auto; margin-bottom: 15px; border-radius: 4px; border: 1px solid #333; -webkit-overflow-scrolling: touch; }
.tb-treino { width: 100%; border-collapse: collapse; font-size: 0.85em; min-width: 600px; }
.tb-treino th, .tb-treino td { padding: 8px; border: 1px solid; text-align: left; vertical-align: top; }
.dia-title { font-family: 'Orbitron', sans-serif; font-size: 1.2em; font-weight: bold; padding: 8px; margin-top: 15px; margin-bottom: 5px; text-transform: uppercase; }

/* Botões do Builder de Exercícios */
.exercicio-linha input { 
    min-width: 0 !important; 
    width: 100% !important;
    font-size: 0.75em !important; 
    padding: 6px !important; 
    background: rgba(255,255,255,0.05) !important; 
    border: 1px solid rgba(255,255,255,0.1) !important; 
    border-radius: 4px !important;
    color: #fff !important;
    height: 30px;
}
.btn-video-add {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    border-radius: 4px;
    padding: 0;
    width: 35px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    cursor: pointer;
    transition: 0.2s;
}
.btn-video-add:hover { border-color: var(--primary); color: var(--primary); background: rgba(0, 229, 255, 0.1); }
.btn-video-add.has-gif { background: rgba(46,160,67,0.2); border-color: var(--success); color: var(--success); }

.btn-del-ex { 
    background: var(--danger) !important; 
    color: #fff !important; 
    border: none !important; 
    border-radius: 4px !important; 
    cursor: pointer; 
    padding: 0 !important; 
    width: 30px; 
    height: 30px;
    font-weight: bold;
    font-size: 14px !important; 
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================================= */
/* TEMAS DE IMPRESSÃO (PDF)                                  */
/* ========================================================= */
.tema-site-dark { background-color: #0a0c10 !important; color: #c9d1d9 !important; }
.tema-site-dark .header-relatorio { border-bottom: 2px solid #00e5ff !important; }
.tema-site-dark .metric-card { background: rgba(0, 229, 255, 0.05) !important; border: 1px solid rgba(0, 229, 255, 0.2) !important; }
.tema-site-dark .diag-header-bar { background: #30363d !important; color: #fff !important; }
.tema-site-dark .tb-treino th { background: var(--primary) !important; color: #000 !important; border-color: #444 !important; }
.tema-site-dark .tb-treino td { border-color: #333 !important; background: var(--bg-dark) !important; color: #c9d1d9 !important; }
.tema-site-dark .dia-title { background: #161b22 !important; color: var(--primary) !important; border-left: 4px solid var(--primary) !important; }
.tema-site-dark .export-footer .logo-text { color: #888 !important; }

.tema-dark-gold { background-color: #151515 !important; color: #eaeaea !important; }
.tema-dark-gold .header-relatorio { border-bottom: 2px solid #d4af37 !important; }
.tema-dark-gold .dia-title { background: #222 !important; color: #d4af37 !important; border-left: 4px solid #d4af37 !important; }
.tema-dark-gold .tb-treino th { background: #d4af37 !important; color: #000 !important; border-color: #444 !important; }
.tema-dark-gold .tb-treino td { border-color: #333 !important; background: #1a1a1a !important; color: #eaeaea !important; }
.tema-dark-gold .export-footer .logo-text { color: #444 !important; }

.tema-supreme-red { background-color: #0a0a0a !important; color: #fff !important; }
.tema-supreme-red .header-relatorio { border-bottom: 2px solid #e63946 !important; }
.tema-supreme-red .dia-title { background: #1a0808 !important; color: #e63946 !important; border-bottom: 1px solid #e63946 !important; }
.tema-supreme-red .tb-treino th { background: #e63946 !important; color: #fff !important; border-color: #333 !important; text-transform: uppercase !important;}
.tema-supreme-red .tb-treino td { border-color: #333 !important; background: #111 !important; color: #fff !important; }
.tema-supreme-red .export-footer .logo-text { color: #222 !important; }

.tema-clean-blue { background-color: #ffffff !important; color: #212529 !important; }
.tema-clean-blue .header-relatorio { border-bottom: 2px solid #0077b6 !important; }
.tema-clean-blue .dia-title { background: #e9ecef !important; color: #023e8a !important; border-radius: 4px !important; }
.tema-clean-blue .tb-treino th { background: #0077b6 !important; color: #fff !important; border-color: #dee2e6 !important; }
.tema-clean-blue .tb-treino td { border-color: #dee2e6 !important; background: #fff !important; color: #333 !important; }
.tema-clean-blue .export-footer .logo-text { color: #dee2e6 !important; }

/* ========================================================= */
/* MODAIS E OVERLAYS (IMPRESSÃO E GIFS)                      */
/* ========================================================= */
.loading-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 10000; justify-content: center; align-items: center; flex-direction: column; }
.spinner { width: 50px; height: 50px; border: 5px solid var(--primary); border-top: 5px solid transparent; border-radius: 50%; animation: spin 1s linear infinite; }
.loading-overlay h3 { color: #fff; margin-top: 20px; font-family: 'Orbitron', sans-serif; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background: rgba(0,0,0,0.85); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 20px; 
}

.modal-window { 
    background: var(--bg-dark); 
    border-radius: 8px; 
    overflow: hidden; 
    border: 1px solid var(--accent); 
    box-shadow: 0 10px 40px rgba(0,0,0,0.7); 
}

/* Modais de Impressão */
.print-modal {
    width: 100%; 
    max-width: 1200px; 
    height: 90vh; 
    display: flex; 
    flex-direction: row; 
}
.modal-sidebar { width: 300px; background: #111; padding: 20px; border-right: 1px solid #333; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; flex-shrink: 0; }
.modal-body-scroll { flex: 1; padding: 20px; background: #222; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; }
.modal-body-scroll::-webkit-scrollbar, .modal-sidebar::-webkit-scrollbar { width: 10px; }
.modal-body-scroll::-webkit-scrollbar-thumb, .modal-sidebar::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 5px; }

/* Modal de Pesquisa de GIFs */
.gif-modal {
    width: 100%;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--primary);
}
.modal-header { padding: 15px; background: #0a0c10; border-bottom: 1px solid #30363d; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; color: var(--primary); font-family: 'Orbitron', sans-serif; font-size: 1.2em; }
.btn-close { background: transparent; border: none; color: #fff; font-size: 1.5em; cursor: pointer; padding: 0; }
.btn-close:hover { color: var(--danger); }

.modal-search-area {
    padding: 15px;
    background: #111;
    border-bottom: 1px solid #333;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.search-box { flex: 1; min-width: 200px; }
.search-box label { color: #fff; font-weight: bold; font-size: 0.85em; display: block; margin-bottom: 5px; }
.search-box select, .search-box input {
    width: 100%;
    padding: 10px;
    background: #222;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-weight: bold;
    font-size: 1em;
}
.search-box input::placeholder { color: #555; }

.gif-grid {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    background: #1a1a1a;
}
.gif-card {
    background: #2a2a2a;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 5px;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
}
.gif-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0, 229, 255, 0.2); }
.gif-card img, .gif-card video { width: 100%; height: 120px; object-fit: cover; border-radius: 4px; margin-bottom: 5px; background: #000; }
.gif-card span { font-size: 0.75em; font-weight: bold; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; padding: 2px; }

/* ========================================================= */
/* COMPORTAMENTO PARA TABLETS / DESKTOPS PEQUENOS            */
/* ========================================================= */
@media (max-width: 1000px) {
    .main-container { grid-template-columns: 1fr; }
    .col-left { order: 2; } 
    .controls { flex-direction: column; width: 100%; align-items: stretch; }
    .controls > * { width: 100% !important; margin: 2px 0; }
    .desktop-only { display: none; }
    .print-modal { flex-direction: column; height: 95vh; }
    .modal-sidebar { width: 100%; height: auto; max-height: 40vh; border-right: none; border-bottom: 1px solid #333; }
    .modal-body-scroll { height: 50vh; }
}

/* ========================================================= */
/* MODO APP NATIVO (MÓVEL) - SAFARI / CHROME                 */
/* ========================================================= */
@media (max-width: 800px) {
    /* 1. ESPAÇO NO FUNDO PARA O MENU NÃO COBRIR O TEXTO */
    body { padding: 10px 10px 100px 10px !important; }

    /* 2. TOP BAR FIXA (Estilo cabeçalho de banco) */
    .top-bar { 
        position: sticky; top: 0; z-index: 1000; 
        background: rgba(10, 12, 16, 0.95) !important;
        backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        padding: 10px; border-radius: 0 0 15px 15px; margin: -10px -10px 15px -10px;
    }
    
    /* 3. ORGANIZA OS FILTROS DO TOPO (2 colunas em vez de uma linha reta enorme) */
    .controls { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
    .controls > * { width: 100% !important; margin: 0 !important; font-size: 0.8em !important; padding: 10px 5px !important;}
    .theme-toggle, .desktop-only { display: none !important; } /* Oculta tralha inútil no mobile */
    .brand-logo { justify-content: center; margin-bottom: 5px; font-size: 1.1em; width: 100%; }

    /* 4. MÁGICA: MENU INFERIOR FIXO (Estilo Instagram/Spotify) */
    .nav-tabs-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: rgba(22, 27, 34, 0.98) !important;
        backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        z-index: 9999 !important;
        margin: 0 !important;
        padding: 10px 5px 25px 5px !important; /* Os 25px em baixo são vitais para o risco branco do iPhone não atrapalhar */
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-around !important;
        border-top: 1px solid var(--accent) !important;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.8) !important;
    }
    
    /* Botões do menu de baixo */
    .btn-tab { 
        background: transparent !important; border: none !important; box-shadow: none !important;
        min-width: 0 !important; flex: 1 !important; 
        font-size: 0.65em !important; color: #8b949e !important; padding: 5px !important;
        display: flex; flex-direction: column; align-items: center; gap: 4px; transition: 0.3s;
    }
    .btn-tab.active { color: var(--primary) !important; font-weight: bold; font-size: 0.7em !important; transform: scale(1.05); }

    /* 5. ELIMINA AS BORDAS DOS PAINÉIS (Fluidez) */
    .panel { border: none !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; margin-bottom: 20px !important;}
    .export-box { border-radius: 12px !important; margin: 0 -5px 15px -5px !important; padding: 15px !important; border-left: none !important; border-right: none !important; }

    /* 6. MÁGICA: "ESTICAR PARA O LADO" (Força a grelha de 2 colunas para os inputs) */
    .form-grid, .box-dobras { 
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* Força que fique Idade ao lado de Sexo, Peso ao lado de Altura */
        gap: 10px !important; 
    }
    
    /* Faz o nome e botões grandes ocuparem a linha inteira */
    #nome, .full-width, .w-100, .btn-primary, .btn-pdf, .btn-green { grid-column: span 2 !important; }

    /* 7. RELATÓRIOS E COMPONENTES */
    .header-relatorio { flex-direction: column; align-items: flex-start; }
    .metrics-grid { grid-template-columns: 1fr 1fr !important; } /* Quadros de % e Peso 2x2 */
    .visual-area { height: auto; flex-direction: column; }
    .measures-wrapper { width: 100% !important; }
    
    /* Construtor de treino compacto */
    .exercicio-linha { grid-template-columns: 1fr 1fr !important; grid-template-rows: auto auto auto !important; background: rgba(0,0,0,0.2) !important; padding: 10px !important; border-radius: 8px !important; border: 1px solid var(--accent) !important; margin-bottom: 10px !important;}
    .exercicio-linha input:nth-child(1) { grid-column: span 2 !important; font-weight: bold; font-size: 1.1em !important; background: transparent !important; border: none !important; border-bottom: 1px solid var(--accent) !important;} 
    .exercicio-linha input:nth-child(4) { grid-column: span 2 !important; } 
}