body {
    margin: 0;
    font-family: 'Poppins', 'Open Sans', sans-serif;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background: linear-gradient(to right, #00665f, #c19e37);
    color: white;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container img {
    max-width: 120px;
    margin-bottom: 10px;
}

h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5em;
    margin: 0;
}

main {
    padding: 40px 20px;
    text-align: center;
}

h2 {
    font-size: 1.8em;
    color: #00665f;
    margin-bottom: 30px;
}

.button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.menu-button, .btn-accion, .btn-toggle {
    background-color: #00665f;
    background: linear-gradient(to right, #00665f, #004d4a);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1em;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.menu-button:hover, .btn-accion:hover, .btn-toggle:hover {
    background-color: #c19e37;
    background: linear-gradient(to right, #c19e37, #a8832c);
    color: white;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: #eaeaea;
    color: #333;
    margin-top: 40px;
}

.grafico {
    max-width: 90%;
    border: 2px solid #555;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.mensaje-error, .alerta-error {
    color: crimson;
    text-align: center;
    font-weight: bold;
    margin-top: 1rem;
}

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.toggle-group input[type="checkbox"] {
    display: none;
}

.toggle-group label {
    padding: 8px 14px;
    border: 2px solid #ccc;
    border-radius: 25px;
    background-color: #f5f5f5;
    cursor: pointer;
    font-size: 14px;
    transition: all 2s ease;
}

.toggle-group input[type="checkbox"]:checked + label {
    background-color: #ff6600;
    color: white;
    border-color: #ff6600;
    font-weight: bold;
}

.oculto {
    display: none;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag {
    background-color: #404040;
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tag:hover {
    background-color: crimson;
}

.form-grupo {
    margin-bottom: 20px;
}

label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

input[type="date"], select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
}

#industria-select {
    height: 150px;
    border-radius: 6px;
    border: 1px solid #aaa;
    margin-top: 8px;
}
.grafico-container {
    margin-top: 2rem;
    width: 100%;
    padding: 0 10px;
    text-align: center;
    box-sizing: border-box;
}

.grafico-container iframe {
    width: 100% !important;
    height: auto !important;
}

/* 🎯 Tabla de Dólar Futuro */
.tabla-dolar {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    font-size: 0.95em;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.tabla-dolar th,
.tabla-dolar td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
}

.tabla-dolar th {
    background: linear-gradient(to right, #00665f, #004d4a);
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tabla-dolar tr:nth-child(even) {
    background-color: #f9f9f9;
}

.tabla-dolar tr:hover {
    background-color: #eef6f6;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 40px;
    margin-bottom: 30px;
    justify-items: center;
}

.form-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 250px;
}

.form-item input {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1em;
    text-align: center;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-item {
        max-width: 90%;
    }
}

/* 🔷 NAVBAR */
.navbar {
    background: linear-gradient(to right, #00665f, #c19e37);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    text-align: left;
}

.navbar-logo img {
    width: 70px;
    height: auto;
    border-radius: 50%;
    border: 2px solid white;
}

.navbar-title h1 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 1.8em;
}

.navbar-title .slogan {
    font-size: 0.95em;
    font-style: italic;
    margin: 0;
    color: #ffe;
}
.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

/* Sección bienvenida */
.bienvenida {
    padding: 50px 20px;
    text-align: center;
    background-color: #fff;
}

.bienvenida h2 {
    font-size: 2em;
    color: #00665f;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Cinzel', serif;
    font-size: 1.2em;
}

.logo img {
    height: 40px;
    width: 40px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid white;
}

.volver-link {
    font-weight: bold;
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.3s;
}

.volver-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    text-decoration: underline;
}

/* 🧾 MAIN CONTENT */
.contenido {
    padding: 20px;
    margin-bottom: 30px;
    max-width: none;
    width: calc(100% - 60px);
    margin: 20px 20px 30px 60px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(0,0,0,0.08);
    box-sizing: border-box;
}

.hero {
    padding: 60px 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.05);
    max-width: none;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.hero .intro {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 30px;
}

.grafico {
    margin-top: 40px;
    max-width: 90%;
    border: 2px solid #555;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.grafico-wrapper {
    margin-top: 40px;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 60px;
    background: linear-gradient(to bottom, #004d4a, #00665f);
    color: white;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    overflow: hidden;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.sidebar:hover {
    width: 200px;
}

/* Logo */
.logo-container-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 0;
    width: 100%;
}

.logo-sidebar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    display: block;
    margin: 0 auto;
}

.logo-text {
    font-family: 'Cinzel', serif;
    font-size: 1.2em;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.sidebar:hover .logo-text {
    opacity: 1;
}

/* NAV LINKS */
.nav-links {
    display: flex;
    flex-direction: column;
    margin-top: 30px;
    width: 100%;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    font-weight: 600;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.nav-links a:hover {
    background-color: #c19e37;
    color: white;
}

.nav-links span {
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar:hover .nav-links span {
    opacity: 1;
}

.sidebar:hover ~ .contenido {
    margin-left: 200px;
    width: calc(100% - 200px);
}

/* ===== Tablas compactas pro ===== */
.table-wrap {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.tabla-compacta {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    line-height: 1.25;
    color: #24323f;
    font-variant-numeric: tabular-nums;
    background: #fff;
}
.tabla-compacta th,
.tabla-compacta td {
    padding: 6px 10px;
    border-bottom: 1px solid #e8edf1;
    white-space: nowrap;
}
.tabla-compacta th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: center;
    background: linear-gradient(180deg, #0a4b44 0%, #0a4b44 60%, #0e5e56 100%);
    color: #fff;
    letter-spacing: .3px;
    text-transform: none;
    font-weight: 600;
}
.tabla-compacta tr:nth-child(even) td { background: #fafcfd; }
.tabla-compacta tr:hover td { background: #f2f7f6; }
.tabla-compacta td { text-align: right; }
.tabla-compacta td:first-child, .tabla-compacta th:first-child {
    position: sticky; left: 0; z-index: 2; background: #ffffff;
    text-align: left; font-weight: 600; color: #0a4b44; border-right: 1px solid #e8edf1;
}
.tabla-compacta th:first-child { background: #0a4b44; color: #fff; }
.tabla-compacta .subtle { color: #6b7a85; font-weight: 500; }
.tabla-compacta tfoot td { background: #f6faf9; font-weight: 600; }
.table-wrap.max300 { max-height: 300px; }
.table-wrap.max420 { max-height: 420px; }

/* ────────────────────────────────────────────────────────────── */
/* 🆕 Paso 1 — Helpers de feedback en UI (spinner + alerta)      */
/* ────────────────────────────────────────────────────────────── */

/* Contenedor relativo para ubicar el overlay spinner adentro */
.chart-wrap { position: relative; } /* 🆕 */

/* Overlay spinner que cubre el área de resultado mientras carga */
.spinner {                           /* 🆕 */
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.6); z-index: 5;
}
.spinner::after {                    /* 🆕 */
  content: ""; width: 36px; height: 36px; border-radius: 9999px;
  border: 4px solid #e5e7eb; border-top-color: #0a4b44;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } } /* 🆕 */

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

/* Banner de error/alerta para fallos de backend o red */
.macro-alert {                        /* 🆕 */
  margin: 8px 0; padding: 10px 12px; border-radius: 8px;
  background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca;
  font-size: 14px; text-align: left;
}

/* 🆕 Paso 2: avisos y estados */
.muted.warn { color: #b45309; font-weight: 600; }   /* contador en “amarillo” */
.btn[disabled] { opacity: .5; cursor: not-allowed; } /* desactivar botón Agregar cuando está al límite */

/* ============ Paso 5: Tema oscuro ============ */
body.dark {
    background-color: #0b1211;
    color: #e7f2f1;
  }
  
  /* contenedores principales */
  body.dark .contenido { 
    background-color: #0e1716;
    color: #e7f2f1;
    box-shadow: 0 0 12px rgba(0,0,0,0.4);
  }
  body.dark .card, 
  body.dark .result {
    background: #0f1b1a;
    color: #e7f2f1;
    box-shadow: 0 6px 20px rgba(0,0,0,.35);
  }
  
  /* sidebar y navegación */
  body.dark .sidebar {
    background: linear-gradient(to bottom, #0b2a27, #0c3a36);
  }
  body.dark .nav-links a:hover {
    background-color: #c19e37;
    color: #1a1a1a;
  }
  
  /* tipografías secundarias */
  body.dark .muted { color: #93b1ac; }
  
  /* chips */
  body.dark .chip {
    background:#112523; color:#cfe5e2; border-color:#1b3a37;
  }
  
  /* botones */
  body.dark .btn { background:#0a4b44; color:#eaf7f5; }
  body.dark .btn.secondary { background:#112523; color:#cfe5e2; border:1px solid #204844; }
  body.dark .btn[disabled] { opacity:.45; }
  
  /* badges de estado */
  body.dark .badge {
    background:#132322; color:#d7f2ef; border-color:#1a3a37;
  }
  body.dark .badge.ok   { background:#0f2a23; color:#b8f6d8; border-color:#1e4c3d; }
  body.dark .badge.warn { background:#2b2107; color:#ffde99; border-color:#7a5b1a; }
  body.dark .badge.dang { background:#2a0f0f; color:#ffb3b3; border-color:#7a1e1e; }
  
  /* inputs/selects */
  body.dark input[type="date"], 
  body.dark select, 
  body.dark input[type="text"] {
    background:#0f1b1a; color:#e7f2f1; border:1px solid #244845;
  }
  
  /* listado de industrias (botones) */
  body.dark .ind-list .btn.secondary { background:#132422; color:#d9f0ee; border:1px solid #1e3f3b; }
  body.dark .ind-list .btn.secondary:hover { filter: brightness(1.1); }
  
  /* tablas compactas */
  body.dark .tabla-compacta {
    background:#0f1b1a; color:#dcefed;
  }
  body.dark .tabla-compacta th {
    background: linear-gradient(180deg, #0b3a34 0%, #0b3a34 60%, #0e5e56 100%);
    color:#eaf7f5;
  }
  body.dark .tabla-compacta tr:nth-child(even) td { background:#0d1716; }
  body.dark .tabla-compacta tr:hover td { background:#122321; }
  body.dark .tabla-compacta td:first-child,
  body.dark .tabla-compacta th:first-child { background:#0f1b1a; color:#9de2d8; border-right:1px solid #1a3330; }
  
  /* spinner/oculto util */
  .hidden { display:none; }
  
  /* toggle */
  .theme-toggle { min-width: 170px; }

  /* 🛠️ Fix: footer y fondo de página en modo oscuro */
html.dark, body.dark {
    background-color: #0b1211;   /* mismo fondo que el body.dark */
  }
  
  /* Footer oscuro */
  body.dark footer {
    background-color: #0f1b1a;   /* panel oscuro */
    color: #cfe5e2;
    border-top: 1px solid #1e3f3b;
  }
  
  /* Por si tenés sombras o bordes claros en wrappers */
  body.dark .layout {
    background-color: transparent;  /* evita “parches” claros */
  }
  
  /* (Opcional) enlaces del footer */
  body.dark footer a {
    color: #9de2d8;
  }
  body.dark footer a:hover {
    color: #c19e37;
  }

  /* ─── Curva de Renta Fija: pequeños helpers reutilizables ─── */
.header-wrap { 
    display:flex; 
    align-items:center; 
    justify-content:space-between; 
    gap:12px;
  }
  .subtle { 
    color:#6b7a85; 
    font-size:.95rem; 
    margin:0; 
  }
  
  /* Contenedor para el gráfico Plotly, asegura ancho completo y altura mínima */
  .plotly-container { 
    width:100%; 
    min-height:420px; 
  }