:root {
    /* Paleta luminosa estilo neobanco moderno (Modo Claro Premium) */
    --bg-app: #f4f6f9;               /* Fondo general gris claro muy limpio */
    --surface: #ffffff;              /* Tarjetas en blanco puro */
    --surface-hover: #f8fafc;        /* Hover sutil */
    --border-color: #e2e8f0;         /* Bordes limpios y definidos */
    
    --primary: #0284c7;              /* Azul celeste/corporativo brillante para acentos */
    --primary-hover: #0369a1;        
    --accent-teal: #0d9488;          /* Verde azulado para elementos de éxito o tarjetas */
    
    --text-main: #0f172a;            /* Texto oscuro principal de alta nitidez */
    --text-muted: #64748b;           /* Texto secundario gris pizarra */
    --text-light: #ffffff;           
    
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    /* Radios modernos y limpios */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -2px rgba(15, 23, 42, 0.03);
    --shadow-float: 0 20px 30px -10px rgba(15, 23, 42, 0.12);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Soporte adaptativo para modo oscuro opcional */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-app: #090d16;
        --surface: #111827;
        --surface-hover: #1f2937;
        --border-color: rgba(255, 255, 255, 0.08);
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
    }
}

/* ==========================================================================
   RESET GLOBAL Y FIJACIÓN DE PANTALLA
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

p, span, input, textarea, h1, h2, h3, h4, h5, h6, code {
    user-select: text;
}

html, body {
    width: 100%;
    height: 100%;
/*  overflow: hidden;*/
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overscroll-behavior-y: none;
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overscroll-behavior-y: none;
}

/* ==========================================================================
   NAVEGACIÓN SUPERIOR (HEADER FIJO)
   ========================================================================== */
.nav-lite {
    height: calc(60px + var(--safe-top));
    padding-top: var(--safe-top);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; 
}

.nav-container {
    width: 100%;
    height: 100%;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-lite .brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.icon-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.1rem;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--primary);
}

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-desktop a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-desktop a.active,
.nav-desktop a:hover {
    color: var(--text-main);
}

/* ==========================================================================
   ADAPTACIÓN RESPONSIVE (VIEWPORT & BOTTOM NAV)
   ========================================================================== */
@media (max-width: 767px) {
    .nav-desktop {
        display: none;
    }

    .app-viewport {
        position: absolute;
        top: calc(60px + var(--safe-top));
        bottom: calc(65px + var(--safe-bottom));
        left: 0;
        right: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: none;
        padding-bottom: 1.5rem;
    }

    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: calc(65px + var(--safe-bottom));
        padding-bottom: var(--safe-bottom);
        background: var(--surface);
        border-top: 1px solid var(--border-color);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.65rem;
        font-weight: 500;
        width: 20%;
        background: none;
        border: none;
        gap: 4px;
        transition: var(--transition);
    }

    .nav-icon {
        font-size: 1.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-item.active {
        color: var(--primary);
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }

    .app-viewport {
        position: absolute;
        top: calc(60px + var(--safe-top));
        bottom: 0;
        left: 0;
        right: 0;
        overflow-y: auto;
    }
}

/* ==========================================================================
   MENÚ DESLIZANTE "MÁS" (BOTTOM SHEET)
   ========================================================================== */
.more-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
    flex-direction: column;
    backdrop-filter: blur(4px);
}

.more-menu-sheet {
    background: var(--surface);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-float);
    padding-bottom: calc(1.5rem + var(--safe-bottom));
}

.more-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.more-menu-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.more-menu-links a {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.more-menu-links a:active {
    background-color: var(--surface-hover);
}

.more-menu-links a svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-muted);
}

.more-menu-links a:hover svg {
    stroke: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* ==========================================================================
   CONTENEDORES Y GRID
   ========================================================================== */
.container, .container-fluid {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

.container-fluid {
    max-width: 100%;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
    width: calc(100% + 1rem);
    box-sizing: border-box;
}

.row > [class*="col-"] {
    box-sizing: border-box;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
    flex-shrink: 0;
    width: 100%;
}

.col-12 { flex: 0 0 100%; width: 100%; }
.col-8  { flex: 0 0 66.666667%; width: 66.666667%; }
.col-6  { flex: 0 0 50%; width: 50%; }
.col-4  { flex: 0 0 33.333333%; width: 33.333333%; }
.col-3  { flex: 0 0 25%; width: 25%; }

@media (min-width: 768px) {
    .col-md-8  { flex: 0 0 66.666667%; width: 66.666667%; }
    .col-md-6  { flex: 0 0 50%; width: 50%; }
    .col-md-4  { flex: 0 0 33.333333%; width: 33.333333%; }
    .col-md-3  { flex: 0 0 25%; width: 25%; }
}

/* ==========================================================================
   TARJETAS Y COMPONENTES UI (LIMPIOS Y LUMINOSOS)
   ========================================================================== */
.card, .card-lite {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
    
}

.card:hover, .card-lite:hover {
    border-color: #cbd5e1;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

/* Tarjeta principal con gradiente fluido elegante o acento corporativo */
.card-lite.energy-card {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.3);
}

.card-lite.energy-card h2, 
.card-lite.energy-card h3,
.card-lite.energy-card p {
    color: #ffffff;
}

.card-lite h2, .card-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Alineación numérica tabular crítica para finanzas exactas */
.card-lite .metric-value, .metric-number {
    font-size: 1.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: inherit;
    margin: 0.35rem 0;
    letter-spacing: -0.03em;
}

.card-lite p {
    color: var(--text-muted);
    font-size: 0.85rem;
}


.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}


/* ==========================================================================
   FORMULARIOS E INPUTS (Diseño Nativo y Minimalista)
   ========================================================================== */
.input-group {
    margin-bottom: 1rem;
}

.input-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.input-lite, .textarea-lite {
    width: 100%;
    height: 46px; 
    padding: 0 12px;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); 
    font-size: 16px; /* Evita zoom automático en iOS */
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea-lite {
    height: auto;
    padding: 12px;
}

.input-lite:focus, .textarea-lite:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.input-lite::placeholder, .textarea-lite::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

input[type="date"] {
  max-width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  padding: 8px 12px;
}

/* ==========================================================================
   BOTONES TÁCTILES MODERNOS
   ========================================================================== */
.btn {
    border: none; 
    color: #ffffff; 
    padding: 0 20px; 
    height: 46px; 
    cursor: pointer; 
    border-radius: var(--radius-sm); 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600; 
    text-decoration: none;
    background-color: var(--text-muted);
    width: 100%; 
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

@media (min-width: 768px) {
    .btn {
        width: auto;
    }
}

.btn:active {
    transform: scale(0.96); 
    opacity: 0.85; 
}

.primary { background-color: var(--primary); color: #ffffff; font-weight: 700; } 
.primary:hover { background-color: var(--primary-hover); }

.secondary { background-color: var(--surface-hover); border: 1px solid var(--border-color); color: var(--text-main); } 
.secondary:hover { background-color: #f1f5f9; }

.success { background-color: var(--success); color: #ffffff; } 
.success:hover { background-color: #059669; }

.warning { background-color: var(--warning); color: #ffffff; } 
.warning:hover { background-color: #d97706; }

.danger { background-color: var(--danger); color: #ffffff; } 
.danger:hover { background-color: #dc2626; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(2, 132, 199, 0.05);
}

/* ==========================================================================
   BADGES & UTILIDADES FINANCIERAS
   ========================================================================== */
.badge {
    padding: 0.3rem 0.65rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    font-variant-numeric: tabular-nums;
}

.badge-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-muted); }
.hidden       { display: none !important; }

/* ==========================================================================
   TOASTS & MODALES
   ========================================================================== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-float);
    text-align: center;
}

fieldset {
    display: flex;
    flex-direction: column;
    gap: 8px; 
    border: none;
}

/* ==========================================================================
   DASHBOARD Y BARRAS DE PROGRESO
   ========================================================================== */
.progress-container {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 25px; /* Bordes redondeados */
  padding: 4px;        /* Espacio interno opcional */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* El relleno que indica el avance */
.progress-bar {
  height: 20px;
  background: linear-gradient(90deg, #10b981 , #10b981c4); /* Degradado moderno */
  border-radius: 20px;
  width: 0; /* Por defecto inicia en 0%; se controla con el inline style del HTML */
  transition: width 0.4s ease-in-out; /* Animación suave al cambiar de porcentaje */
}

/* El relleno que indica el avance */
.progress-bar-danger {
  height: 20px;
  background: linear-gradient(90deg, var(--danger), #e75224); /* Degradado moderno */
  border-radius: 20px;
  width: 0; /* Por defecto inicia en 0%; se controla con el inline style del HTML */
  transition: width 0.4s ease-in-out; /* Animación suave al cambiar de porcentaje */
}


footer {
    background: var(--surface);
    color: var(--text-muted);
    padding: 2.5rem 0;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}


/*********************botones 2.0***********************************/

.button-success {
  color: #fffefe;
  padding: 0.7em 1.7em;
  font-size: 18px;
  border-radius: 0.5em;
  background: #30b63b;
  cursor: pointer;
  border: 1px solid #e8e8e8;
  transition: all 0.3s;
  box-shadow: 6px 6px 12px #c5c5c5, -6px -6px 12px #ffffff;
}

button:active {
  color: #666;
  box-shadow: inset 4px 4px 12px #c5c5c5, inset -4px -4px 12px #ffffff;
}


