/* ==========================================
   KETO TRACKER v18 - ESTILOS PROFESIONALES
   Paleta: Beige, Taupe, Verde Oscuro, Verde Azulado
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paleta Principal */
    --primary: #4F6D6B;
    --primary-dark: #2A3F38;
    --primary-light: #628990;
    --secondary: #B1A08E;
    --success: #4F6D6B;
    --success-dark: #2A3F38;
    --text-dark: #2A3F38;
    --text-light: #7A7A7A;
    
    /* Fondos */
    --bg-main: #E0D8D5;
    --bg-card: #ffffff;
    --bg-input: #F5F1EF;
    
    /* Bordes */
    --border: #D1C9C4;
    --border-light: #E8E2DF;
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(42, 63, 56, 0.08);
    --shadow-md: 0 4px 16px rgba(42, 63, 56, 0.12);
    --shadow-lg: 0 8px 32px rgba(42, 63, 56, 0.16);
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #4F6D6B 0%, #628990 100%);
    --gradient-header: linear-gradient(180deg, #4F6D6B 0%, #628990 100%);
    --gradient-success: linear-gradient(135deg, #4F6D6B 0%, #2A3F38 100%);
    
    /* Espaciado */
    --nav-height: 70px;
    --header-height: 140px;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: var(--nav-height);
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   VISTAS
   ========================================== */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: block;
}

/* ==========================================
   HEADER PRINCIPAL (Inicio)
   ========================================== */
.main-header {
    background: var(--gradient-header);
    padding: 20px;
    padding-top: 50px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-meta {
    font-size: 14px;
    opacity: 0.9;
}

.week-badge {
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 10px 16px;
    text-align: center;
}

.week-label {
    display: block;
    font-size: 11px;
    opacity: 0.9;
}

.week-number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

/* ==========================================
   HEADER VISTAS
   ========================================== */
.view-header {
    background: var(--gradient-header);
    padding: 20px;
    padding-top: 50px;
    color: white;
    min-height: 120px;
}

.view-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.view-header h1 {
    font-size: 22px;
    font-weight: 700;
}

.view-header p {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.btn-header {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================
   CONTENIDO PRINCIPAL
   ========================================== */
.main-content {
    padding: 20px;
    padding-bottom: 100px;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

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

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.card-header .meta {
    font-size: 13px;
    color: var(--text-light);
}

/* Card title con icono */
.card-title-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title-with-icon .card-icon {
    font-size: 22px;
}

.card-title-with-icon h2 {
    font-size: 18px;
    font-weight: 700;
}

/* Fasting card home especial */
.fasting-card-home {
    padding: 24px;
}

.fasting-card-home .card-header {
    margin-bottom: 0;
}

/* Botón fasting mejorado */
.btn-fasting {
    font-size: 17px;
    padding: 18px 32px;
    border-radius: 14px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(79, 109, 107, 0.3);
}

.btn-fasting .btn-icon {
    font-size: 20px;
}

/* ==========================================
   HIDRATACIÓN
   ========================================== */
.hydration-card {
    border: 2px solid var(--primary);
}

.hydration-circle {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 20px auto;
}

.hydration-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.hydration-bg {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 10;
}

.hydration-fill {
    fill: none;
    stroke: #4A90D9;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transition: stroke-dashoffset 0.5s ease;
}

.hydration-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.hydration-count {
    display: block;
    font-size: 42px;
    font-weight: 700;
    color: #4A90D9;
    line-height: 1;
}

.hydration-unit {
    display: block;
    font-size: 14px;
    color: var(--text-light);
}

.hydration-remaining {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.btn-water {
    width: 100%;
    margin-top: 16px;
}

/* Water Reminders Toggle */
.water-reminders {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.reminder-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: 12px;
    transition: all 0.2s;
}

.reminder-toggle:hover {
    background: var(--border-light);
}

.reminder-toggle input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    position: relative;
    transition: all 0.3s;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '🔕';
    position: absolute;
    font-size: 12px;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.reminder-toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.reminder-toggle input:checked + .toggle-slider::before {
    content: '🔔';
    left: 6px;
    right: auto;
}

.reminder-toggle input:checked + .toggle-slider::after {
    left: 24px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
}

.reminder-info {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
    padding-left: 14px;
}

/* Meals Progress Badge */
.meals-progress {
    background: var(--bg-input);
    color: var(--text-light);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.meals-progress.complete {
    background: rgba(102, 127, 105, 0.15);
    color: var(--success);
}

/* ==========================================
   MENÚ DEL DÍA - MEJORADO
   ========================================== */
.meals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-input);
    border-radius: 14px;
    border-left: 4px solid var(--primary);
    transition: all 0.3s;
    cursor: pointer;
}

.meal-item.completed {
    background: rgba(102, 127, 105, 0.08);
    border-left-color: var(--success);
}

.meal-item.completed .meal-name,
.meal-item.completed .meal-desc {
    text-decoration: line-through;
    opacity: 0.6;
}

.meal-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.meal-item.completed .meal-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.meal-checkbox-icon {
    font-size: 12px;
    opacity: 0;
}

.meal-item.completed .meal-checkbox-icon {
    opacity: 1;
}

.meal-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.meal-content {
    flex: 1;
    min-width: 0;
}

.meal-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.meal-desc {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meal-time-box {
    text-align: right;
    flex-shrink: 0;
}

.meal-time {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.meal-item.completed .meal-time {
    color: var(--success);
}

.meal-done-time {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ==========================================
   AYUNO MINI (Inicio) - MEJORADO
   ========================================== */
.fasting-mini {
    text-align: center;
    padding: 10px 0;
}

.fasting-timer-mini {
    font-size: 52px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    margin: 20px 0 8px 0;
}

.fasting-subtitle {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.fasting-meta-mini {
    background: var(--bg-input);
    padding: 16px 24px;
    border-radius: 14px;
    font-size: 16px;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-weight: 500;
}

.status-badge {
    background: rgba(74, 144, 217, 0.12);
    color: #4A90D9;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(102, 127, 105, 0.15);
    color: var(--success);
}

#start-fast-mini-btn {
    font-size: 17px;
    padding: 18px 32px;
    border-radius: 14px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ==========================================
   ELECTROLITOS
   ========================================== */
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.checkbox-item input {
    display: none;
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-item input:checked + .checkbox-custom {
    background: var(--success);
    border-color: var(--success);
}

.checkbox-item input:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 14px;
}

.checkbox-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkbox-icon {
    font-size: 24px;
}

.checkbox-content p {
    font-size: 13px;
    color: var(--text-light);
}

/* ==========================================
   AYUNO - VISTA COMPLETA
   ========================================== */
.fasting-main-card {
    border: 2px solid var(--primary);
    text-align: center;
}

.fasting-window-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(102, 127, 105, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.fasting-window-indicator.fasting-active {
    background: rgba(207, 92, 63, 0.1);
}

.window-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
}

.fasting-window-indicator.fasting-active .window-dot {
    background: var(--primary);
}

.window-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.fasting-timer-large {
    font-size: 56px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
}

.fasting-timer-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.fasting-progress-bar {
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.fasting-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
}

.fasting-progress-text {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.fasting-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.fasting-controls button {
    flex: 1;
}

.fasting-last-meal {
    font-size: 13px;
    color: var(--text-light);
}

/* ==========================================
   PROTOCOLO SEMANAL
   ========================================== */
.protocol-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.protocol-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-input);
    border-radius: 12px;
}

.protocol-item.today {
    background: rgba(207, 92, 63, 0.1);
    border: 2px solid var(--primary);
}

.protocol-item.completed {
    background: rgba(102, 127, 105, 0.1);
}

.protocol-day {
    font-weight: 600;
    font-size: 15px;
}

.protocol-hours {
    font-weight: 600;
    color: var(--primary);
}

.protocol-item.completed .protocol-hours {
    color: var(--success);
}

/* ==========================================
   HISTORIAL
   ========================================== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: 12px;
    border-left: 4px solid var(--success);
}

.history-date {
    font-size: 14px;
    color: var(--text-light);
}

.history-duration {
    font-weight: 600;
    color: var(--success);
}

.history-times {
    font-size: 13px;
    color: var(--text-light);
}

/* ==========================================
   TABS SEMANAS
   ========================================== */
.week-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.week-tab {
    flex: 1;
    min-width: fit-content;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.week-tab.active {
    background: var(--gradient-primary);
    border-color: var(--primary);
    color: white;
}

/* ==========================================
   MENÚ SEMANAL
   ========================================== */
#week-info-card {
    background: var(--gradient-primary);
    color: white;
}

#week-info-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

#week-info-card p {
    font-size: 14px;
    opacity: 0.9;
}

/* ==========================================
   MENÚ SEMANAL - MEJORADO
   ========================================== */
.day-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all 0.3s;
}

.day-card.current-day {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(207, 92, 63, 0.15);
}

.day-card.day-complete {
    border-color: var(--success);
    background: rgba(102, 127, 105, 0.03);
}

.day-card.past-day:not(.day-complete) {
    opacity: 0.7;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.day-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.day-check {
    width: 22px;
    height: 22px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.day-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.day-number {
    font-size: 13px;
    color: var(--text-light);
}

.day-progress-badge {
    background: var(--bg-input);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
}

.day-card.day-complete .day-progress-badge {
    background: rgba(102, 127, 105, 0.15);
    color: var(--success);
}

.day-meals {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.day-meal {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.day-meal:hover {
    background: var(--bg-input);
}

.day-meal.done {
    opacity: 0.6;
}

.day-meal.done .day-meal-desc {
    text-decoration: line-through;
}

.day-meal-check {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-light);
}

.day-meal.done .day-meal-check {
    color: var(--success);
    font-weight: 700;
}

.day-meal-emoji {
    font-size: 18px;
}

.day-meal-time {
    font-weight: 600;
    color: var(--primary);
    min-width: 50px;
}

.day-meal.done .day-meal-time {
    color: var(--success);
}

.day-meal-desc {
    color: var(--text-dark);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================
   COMPRAS
   ========================================== */
.shopping-header {
    background: var(--gradient-primary);
    color: white;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.shopping-header h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.shopping-budget {
    font-size: 14px;
    opacity: 0.9;
}

.shopping-category {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.category-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary);
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.shopping-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--success);
}

.shopping-item label {
    font-size: 14px;
    cursor: pointer;
}

/* ==========================================
   PROGRESO - STATS
   ========================================== */
.stats-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-hero-card {
    padding: 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-hero-card.blue {
    background: rgba(74, 144, 217, 0.1);
    border: 2px solid rgba(74, 144, 217, 0.3);
}

.stat-hero-card.green {
    background: rgba(102, 127, 105, 0.1);
    border: 2px solid rgba(102, 127, 105, 0.3);
}

.stat-hero-icon {
    font-size: 32px;
}

.stat-hero-label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.stat-hero-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.stat-hero-card.blue .stat-hero-value {
    color: #4A90D9;
}

.stat-hero-card.green .stat-hero-value {
    color: var(--success);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    background: var(--bg-input);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

/* ==========================================
   GRÁFICAS
   ========================================== */
.chart-container {
    position: relative;
    height: 200px;
}

.chart-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ==========================================
   REGISTROS
   ========================================== */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: 12px;
}

.record-date {
    font-size: 14px;
    color: var(--text-light);
}

.record-values {
    text-align: right;
}

.record-weight {
    font-weight: 600;
    font-size: 16px;
}

.record-waist {
    font-size: 13px;
    color: var(--text-light);
}

.record-delete {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

/* ==========================================
   AJUSTES
   ========================================== */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    color: var(--text-light);
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--bg-input);
    color: var(--text-dark);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

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

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.info-item span:first-child {
    color: var(--text-light);
}

.settings-note {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}

/* Day Selector */
.day-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.day-selector input {
    width: 80px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    padding: 12px;
}

.btn-day-nav {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dark);
}

.btn-day-nav:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-day-nav:active {
    transform: scale(0.95);
}

.day-selector-info {
    font-size: 14px;
    color: var(--primary);
    margin-top: 8px;
    font-weight: 500;
}

/* ==========================================
   BOTONES
   ========================================== */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-dark);
    border: 2px solid var(--border);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-large {
    padding: 16px 24px;
}

.btn-danger {
    background: rgba(207, 92, 63, 0.1);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}

/* ==========================================
   MODAL
   ========================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-content h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    flex: 1;
}

/* ==========================================
   NAVEGACIÓN
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 4px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    border-radius: 12px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 22px;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
}

/* ==========================================
   ESTADOS VACÍOS
   ========================================== */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 14px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 380px) {
    .nav-item {
        padding: 8px 8px;
    }
    
    .nav-icon {
        font-size: 20px;
    }
    
    .nav-label {
        font-size: 9px;
    }
    
    .stats-hero {
        grid-template-columns: 1fr;
    }
    
    .fasting-timer-large {
        font-size: 44px;
    }
}

@media (min-width: 768px) {
    .main-content {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
}

/* Botón editar hora ayuno */
.btn-edit-time {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 8px;
    margin-left: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-edit-time:hover {
    background: var(--bg-input);
}

/* ==========================================
   v20 · LOGIN OVERLAY
   ========================================== */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--gradient-header);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 32px 24px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.login-sub {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
}

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

.login-form input[type="password"] {
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--bg-input);
    color: var(--text-dark);
    text-align: center;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-error {
    color: #B44;
    font-size: 13px;
    min-height: 18px;
}

/* ==========================================
   v20 · SYNC DOT
   ========================================== */
.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    margin-left: 6px;
    align-self: center;
    transition: background 0.3s;
}

.sync-dot.syncing {
    background: #F5C948;
    animation: pulse 1s infinite;
}

.sync-dot.ok {
    background: #78D67C;
}

.sync-dot.err {
    background: #E56B6B;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ==========================================
   v19 · SELECTOR DE PERFIL
   ========================================== */
.profile-switcher {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    z-index: 200;
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
}

.profile-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.profile-btn.active {
    background: rgba(255,255,255,0.95);
    color: var(--primary-dark);
}

/* ==========================================
   v19 · ALIMENTOS
   ========================================== */
.food-category {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.food-category:last-child {
    border-bottom: none;
}

.food-category-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.food-category.forbidden .food-category-title {
    color: #B44;
}

.food-list {
    list-style: none;
    padding-left: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.food-list li {
    font-size: 14px;
    color: var(--text-dark);
    padding-left: 12px;
    position: relative;
    line-height: 1.5;
}

.food-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-light);
}

.food-category.forbidden .food-list li::before {
    content: '×';
    color: #B44;
    font-weight: 700;
}

/* ==========================================
   v19 · RESCATE
   ========================================== */
.rescue-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rescue-list li {
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    border-left: 3px solid var(--primary-light);
}

.subst-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subst-row {
    display: grid;
    grid-template-columns: 1fr 24px 1.4fr;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 10px;
    font-size: 14px;
}

.subst-from {
    font-weight: 600;
    color: var(--text-dark);
}

.subst-arrow {
    color: var(--primary-light);
    text-align: center;
    font-weight: 700;
}

.subst-to {
    color: var(--text-dark);
}

.rescue-quote {
    text-align: center;
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.rescue-quote p {
    font-size: 15px;
    line-height: 1.6;
    font-style: italic;
}

/* ==========================================
   v19 · ENTRENO
   ========================================== */
.training-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.training-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-input);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.training-item.rest {
    border-left-color: var(--border);
    opacity: 0.7;
}

.training-item.today {
    background: rgba(79, 109, 107, 0.1);
    border-left-color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

.training-icon {
    font-size: 24px;
    text-align: center;
}

.training-day {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-dark);
}

.training-type {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.training-detail {
    font-size: 13px;
    color: var(--primary);
    text-align: right;
    font-weight: 500;
}

.training-item.rest .training-detail {
    color: var(--text-light);
}

/* ==========================================
   v19 · NAV con 9 items — scroll horizontal
   ========================================== */
.bottom-nav {
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    flex: 0 0 auto;
    min-width: 62px;
    padding: 8px 6px;
}

@media (max-width: 380px) {
    .nav-item {
        min-width: 56px;
        padding: 8px 4px;
    }
    .nav-icon {
        font-size: 18px;
    }
    .nav-label {
        font-size: 9px;
    }
}

/* ==========================================
   v21 · DETALLE DE COMIDA (modal)
   ========================================== */
.btn-day-detail {
    margin-top: 10px;
    background: var(--bg-input);
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.btn-day-detail:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.detail-modal-content {
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
}

#detail-modal-body h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--primary-dark);
}

.detail-meal {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-meal:last-child {
    border-bottom: none;
}

.detail-meal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.detail-meal-emoji {
    font-size: 26px;
}

.detail-meal-title {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-meal-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.detail-meal-note {
    background: rgba(245, 201, 72, 0.15);
    color: #7A5B00;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
}

.detail-ingredients {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 8px;
}

.detail-ingredients li {
    font-size: 14px;
    color: var(--text-dark);
    padding-left: 14px;
    position: relative;
    line-height: 1.5;
}

.detail-ingredients li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
}

.detail-prep {
    background: var(--bg-input);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-dark);
    margin-top: 10px;
    line-height: 1.5;
}

.detail-alt {
    background: rgba(79, 109, 107, 0.06);
    border: 1px dashed var(--primary-light);
    padding: 12px;
    border-radius: 12px;
    margin-top: 12px;
}

.detail-alt-head {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.detail-alt-note {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-style: italic;
}

/* ==========================================
   v21 · RESCATE ampliado (bebidas / bloques)
   ========================================== */
.rescue-context {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.5;
    font-style: italic;
}

.beb-block {
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.beb-block.ok {
    background: rgba(102, 127, 105, 0.1);
    border-left: 3px solid var(--success);
}

.beb-block.meh {
    background: rgba(245, 201, 72, 0.12);
    border-left: 3px solid #F5C948;
}

.beb-block.no {
    background: rgba(229, 107, 107, 0.1);
    border-left: 3px solid #E56B6B;
}

.subst-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0 8px 0;
}


/* ==========================================
   v23 · MENÚ FASE DE ORDEN
   ========================================== */
.today-note {
    font-size: 12px;
    color: var(--text-light);
    margin: -8px 0 12px;
}

.main-content > .today-note {
    margin: 0 0 12px;
}

.meal-item.flex {
    border-left-color: #F5C948;
}

.meal-item .meal-checkbox {
    cursor: pointer;
}

.day-meal.flex .day-meal-desc {
    font-style: italic;
}

.day-activity {
    margin-top: 8px;
    padding: 8px 10px 0;
    border-top: 1px dashed var(--border-light);
    font-size: 13px;
    color: var(--text-light);
}

.day-activity.done {
    color: var(--success);
    font-weight: 600;
}

.activity-check {
    background: var(--bg-card);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.activity-check.done {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.training-item.activity-done {
    background: rgba(102, 127, 105, 0.1);
}

/* ==========================================
   v25 · HORA EDITABLE Y DESMARCAR
   ========================================== */
.detail-time-group {
    margin: 14px 0 12px;
}

.detail-time-group input[type="time"] {
    font-size: 18px;
    font-weight: 600;
}

.btn-link {
    display: block;
    width: 100%;
    margin-top: 12px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}
