:root { --fg:#111; --muted:#666; --bg:#fafafa; --card:#fff; --br:#eaeaea; }
    * { box-sizing:border-box; }
    body { 
        margin:0; 
        font:16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; 
        color:var(--fg); 
        background:var(--bg); 
    }
    header { 
        padding:20px 24px; 
        display:flex; 
        align-items:center; 
        justify-content: center;
        width: 100%;
        border-bottom:1px solid var(--br); 
        background:#fff; 
        position:sticky; 
        top:0; 
        z-index: 100;
    }
    .ancho{
        width: 80%;
        padding: 0 16px; 
        justify-content: space-between;
    }
    .logo{
        width: 220px;
    }
    .logo-cdti{
		width: 320px;
	}
    h1 { 
        margin:0; 
        font-size:18px; 
        letter-spacing:.4px; 
    }
    .btn{ position:relative; }
    .btn--loading{ pointer-events:none; opacity:.95; }

    /* etiqueta del botón */
    .btn__label{ transition: opacity .15s ease; }
    .btn--loading .btn__label{ opacity:0; }

    /* spinner oculto por defecto */
    .btn__spinner{
    position:absolute; inset:0;
    display:none;                 /* ← oculto */
    place-items:center;
    }
    .btn--loading .btn__spinner{     /* ← solo visible en loading */
    display:grid;
    }

    /* animación del spinner */
    .btn__spinner::before{
    content:"";
    width:16px; height:16px;
    border:2px solid currentColor;
    border-right-color: transparent;
    border-radius:50%;
    animation: btnspin .75s linear infinite;
    }
    @keyframes btnspin{ to{ transform: rotate(360deg); } }

    /* (opcional) por si sigues usando el atributo hidden en JS */
    .btn__spinner[hidden]{ display:none !important; }
    .wrap { 
        max-width:1200px;
        margin: 24px auto; 
        padding: 0 16px; 
        display:grid; 
        gap:16px; }
    .card { 
        background:var(--card); 
        width: 100%;
        border:1px solid var(--br); 
        border-radius:16px; 
        padding:16px; 
    }
    .card-primer{
        display: flex;
        justify-content: space-between;
        
    }
    .info{
        display: flex;
        gap:12px;
        width: 100%;
      
    }
    .chart-area{
        position: relative;
        width: 100%;
        height: 320px;        /* alto base (móvil) */
      }
    .card.chart canvas{
        position: absolute;
        inset: 0;
        width: 100% !important;
        height: 100% !important;
        display: block;
      }
    .grid { 
        display:grid; 
        grid-template-columns: 1fr; 
        gap:16px; 
    }
    .title { 
        font-weight:600; 
        margin:0 0 8px; 
    }
    .muted { 
        color:var(--muted); 
        font-size:14px; 
        
    }
    .act{
        align-items: center;
    }
    .big { 
        font-size:36px; 
        font-weight:800; 
        line-height:1; 
    }
    .row { 
        display:flex; 
        gap:6px;
        flex-wrap:wrap; 
    }
    .stats-grid{
        display:grid; gap:10px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
      .stat-label{ color:var(--muted); font-size:14px; }
      .stat-value{ font-size:16px; font-weight:800; line-height:1.1; }

    .card-primer{
        display: flex;
        justify-content: space-between; 
        width: auto;
        background:var(--card); 
        border:1px solid var(--br); 
        border-radius:16px; 
        padding:16px; 
    }
    .card-stats{
        display: flex;
        flex-direction: column;
        width: 50%;
        background:var(--card); 
        border:1px solid var(--br); 
        border-radius:16px; 
        padding:16px; 
        gap: 12px;
        justify-content: space-between;
    }
    .card-compost{
        display: flex;
        flex-direction: column;
        width: 100%;
        background:var(--card); 
        border:1px solid var(--br); 
        border-radius:16px; 
        padding:16px; 
        gap: 12px;
        justify-content: space-between;
    }
    button { 
        background:#111; 
        color:#fff; 
        border:0; 
        padding:10px 14px; 
        border-radius:10px; 
        cursor:pointer; 
    }
    button:disabled{ 
        opacity:.6; 
        cursor:default; 
    }
    table { 
        width:100%; 
        border-collapse:collapse; 
    }
    th, td { 
        padding:8px 6px; 
        border-bottom:1px solid var(--br); 
        text-align:left; 
        font-size:14px; }
    th { 
        color:#333; 
        font-weight:600; 
    }
    .latest-actions{ margin-top: 12px; }

    .btn{
    border: 0; padding: 10px 14px; border-radius: 10px; cursor: pointer;
    }

    .btn-lote{
    background: #111; color: #fff;
    }
    .btn-lote:hover{ opacity: .9; }
    .status-dot{
        display:inline-block; width:10px; height:10px; border-radius:50%;
        margin-right:8px; vertical-align:middle; background:#999;
        }
        .status-dot.ok{ background:#10b981; }   /* verde */
        .status-dot.err{ background:#ef4444; }  /* rojo  */


    .progress{
        position: relative; width:100%; height:18px;
        background:#eee; border:2px solid var(--br); border-radius:4px; overflow:hidden;
        margin-top:0px;
        }
    .progress__fill{
        height:100%; width:0%;
        background: linear-gradient(90deg, #10b981, #22c55e);
        transition: width .4s ease;
        }
    .progress__fill.done{ background: linear-gradient(90deg, #0ea5e9, #10b981); }
    .progress__ticks{
        position:absolute; inset:0; pointer-events:none;
        background: repeating-linear-gradient(
            to right,
            transparent 0,
            transparent calc(100%/14 - 1px),
            rgba(0,0,0,.08) calc(100%/14 - 1px),
            rgba(0,0,0,.08) calc(100%/14)
        );
    }
    @media (min-width: 880px){
      .grid { 
        grid-template-columns: 1.2fr .8fr; 
    }
    @media (max-width: 520px){
        .stats-grid{ grid-template-columns: 1fr; }
    }
      
    }

    /* Línea separadora entre secciones */
    .section-divider {
        width: 100%;
        height: 1px;
        background-color: #e0e0e0;
        border: none;
        margin: 0px 0;
    }
    .title-container{
        width: 100%;
    }
    
    .info-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
    
    /* Selector de período del gráfico */
    .chart-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
    }
    
    .period-selector {
        display: flex;
        gap: 4px;
    }
    
    .period-btn {
        padding: 6px 12px;
        border: 1px solid var(--br);
        background: var(--card);
        color: var(--fg);
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
        transition: all 0.2s ease;
    }
    
    .period-btn:hover {
        background: var(--bg);
    }
    
    .period-btn.active {
        background: #3b82f6;
        color: white;
        border-color: #3b82f6;
    }

    /* ====== HEADER RESPONSIVE ====== */
.site-header{ display:grid; gap:8px; }

/* Fila 1: logos a izquierda/derecha */
.hdr-logos{
  display:flex; align-items:center; justify-content:space-between;
}
.hdr-logos img,
.site-header .logo-left,
.site-header .logo-right,
.site-header img.logo{         /* por si tus clases difieren */
  max-height:48px; height:auto; width:auto; object-fit:contain;
}

/* Fila 2: estado + botones centrados */
.hdr-ctrls{
  display:flex; align-items:center; justify-content:center; gap:12px; flex-wrap:wrap;
}
#status{ font-size:0.95rem; opacity:.8; text-align:center; }
.hdr-ctrls button,
.hdr-ctrls .btn{
  padding:8px 12px; font-size:0.95rem; line-height:1;
}

/* ====== CONTENIDO RESPONSIVE ====== */
/* Las cards en columna (una debajo de otra) en pantallas pequeñas */
.grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.card{ width:100%; }

/* Tablet (≤ 900px) */
@media (max-width: 1200px){
 header {
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-between;
}
.ancho{
    padding-top: 12px;
    padding-bottom: 12px;
    width: 100%; 
    justify-content: space-between;
}
.act{
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

}

/* Móvil (≤ 600px) */
@media (max-width: 600px){
header {
    
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-between;
}
.logo{
    width: 140px;
}
.logo-cdti{
    width: 140px;
}
.ancho{
    padding-top: 12px;
    padding-bottom: 12px;
    width: 100%; 
    justify-content: space-between;
}
.act{
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.info{
    flex-direction: column;
    align-items: flex-start;
}
.card-stats{
    width: 100%;
}
.card-primer{
   width: 100% ;
}
}