:root{
    --vino:#611232;
    --vino2:#9f2241;
    --dorado:#bc955c;
    --verde:#235b4e;
    --azul:#0c5a7d;
    --gris:#f4f4f5;
    --gris2:#e5e7eb;
    --texto:#111827;
    --texto-suave:#6b7280;
    --rojo:#9f2241;
    --amarillo:#bc955c;
    --naranja:#dd6b20;
    --ok:#235b4e;
    --blanco:#ffffff;
    --sombra:0 8px 22px rgba(0,0,0,.08);
}

*{ box-sizing:border-box; }

body{
    margin:0;
    font-family:Arial, Helvetica, sans-serif;
    background:#f3f4f6;
    color:var(--texto);
}

.topbar{
    height:76px;
    background:linear-gradient(90deg,var(--vino),#7a1438);
    color:white;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 28px;
    border-bottom:5px solid var(--dorado);
    position:sticky;
    top:0;
    z-index:50;
}

.brand{ display:flex; align-items:center; gap:14px; }
.brand h1{ margin:0; font-size:28px; letter-spacing:.5px; }
.brand span{ font-size:12px; opacity:.95; }

.escudo{
    background:white;
    color:var(--vino);
    font-weight:bold;
    border-radius:10px;
    padding:12px;
    box-shadow:0 4px 12px rgba(0,0,0,.2);
}

.user-info{ font-size:13px; text-align:right; }
.user-info strong{ display:block; }
.user-info span{ opacity:.85; }

.layout{
    display:flex;
    min-height:calc(100vh - 76px);
}

.sidebar{
    width:255px;
    background:#1f2937;
    padding:20px 0;
    position:sticky;
    top:76px;
    height:calc(100vh - 76px);
}

.sidebar-title{
    color:#9ca3af;
    font-size:12px;
    text-transform:uppercase;
    padding:0 24px 12px;
    letter-spacing:.8px;
}

.sidebar a{
    display:block;
    color:white;
    text-decoration:none;
    padding:15px 24px;
    border-left:5px solid transparent;
    font-weight:600;
    transition:.2s ease;
}

.sidebar a:hover{
    background:#374151;
    border-left-color:var(--dorado);
    padding-left:30px;
}

.sidebar .logout{
    margin-top:25px;
    background:#7f1d1d;
}

.content{
    flex:1;
    padding:34px 42px;
}

.page-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:22px;
}

.page-header h1{
    margin:0;
    font-size:34px;
    color:#111827;
}

.page-header p{
    margin:6px 0 0;
    color:var(--texto-suave);
    font-size:15px;
}

.card,
.form-section,
.grafica-card,
.tabla-card,
.pendiente-card{
    background:white;
    border-radius:18px;
    padding:24px;
    box-shadow:var(--sombra);
}

.card{ margin-bottom:22px; }

.btn{
    display:inline-block;
    border:0;
    border-radius:10px;
    background:var(--vino);
    color:white;
    padding:12px 20px;
    text-decoration:none;
    cursor:pointer;
    font-weight:bold;
    transition:.2s ease;
}

.btn:hover{
    opacity:.9;
    transform:translateY(-1px);
}

.btn-sec{ background:var(--verde); }
.btn-danger{ background:var(--rojo); }

label{
    display:block;
    font-weight:700;
    font-size:13px;
    color:var(--vino);
    margin-bottom:6px;
}

input,
select,
textarea{
    width:100%;
    padding:13px 14px;
    border:1px solid #d1d5db;
    border-radius:11px;
    margin-bottom:16px;
    background:white;
    font-size:14px;
}

input:focus,
select:focus,
textarea:focus{
    outline:none;
    border-color:var(--vino);
    box-shadow:0 0 0 3px rgba(97,18,50,.12);
}

textarea{
    min-height:130px;
    resize:vertical;
}

.form-row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:18px;
}

.modern-form{
    display:grid;
    gap:22px;
}

.form-section{
    border-top:5px solid var(--vino);
}

.section-title{
    display:flex;
    align-items:center;
    gap:14px;
    margin-bottom:20px;
}

.section-title span{
    font-size:30px;
    background:#f8f1f4;
    padding:12px;
    border-radius:14px;
}

.section-title h2{
    margin:0;
    color:var(--vino);
    font-size:21px;
}

.section-title p{
    margin:4px 0 0;
    color:var(--texto-suave);
    font-size:14px;
}

.form-actions{
    display:flex;
    justify-content:flex-end;
    gap:12px;
    margin-bottom:30px;
}

.login-body{
    background:linear-gradient(135deg,var(--vino),var(--verde));
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:100vh;
}

.login-card{
    background:white;
    width:390px;
    padding:34px;
    border-radius:18px;
    box-shadow:0 14px 35px rgba(0,0,0,.25);
}

.login-card h2{
    margin-top:0;
    color:var(--vino);
}

.alert{
    padding:14px;
    border-radius:10px;
    margin-bottom:15px;
}

.alert-error{
    background:#fee2e2;
    color:#991b1b;
}

.alert-ok{
    background:#dcfce7;
    color:#166534;
}

/* DASHBOARD */

.filtros-dashboard{
    background:white;
    padding:18px;
    border-radius:16px;
    display:grid;
    grid-template-columns:2fr 2fr 2fr 1.2fr .8fr;
    gap:15px;
    margin-bottom:20px;
    box-shadow:var(--sombra);
}

.filtros-dashboard button,
.btn-limpiar{
    align-self:end;
    padding:12px 18px;
    border-radius:10px;
    border:none;
    background:var(--vino);
    color:#fff;
    font-weight:700;
    text-decoration:none;
    cursor:pointer;
    text-align:center;
}

.btn-limpiar{
    background:var(--verde);
}

.cards-dashboard{
    display:grid;
    grid-template-columns:repeat(6,1fr);
    gap:15px;
    margin-bottom:20px;
}

.card-kpi{
    background:#ffffff !important;
    color:#111827 !important;
    border-left:7px solid var(--vino);
    border-radius:16px;
    padding:20px;
    box-shadow:var(--sombra);
}

.card-kpi span{
    display:block;
    font-size:13px;
    color:#374151 !important;
    font-weight:700;
}

.card-kpi strong{
    font-size:34px;
    color:var(--vino) !important;
}

.card-kpi.rojo{
    background:#ffffff !important;
    border-left-color:var(--rojo) !important;
}

.card-kpi.amarillo{
    background:#ffffff !important;
    border-left-color:var(--amarillo) !important;
}

.card-kpi.verde{
    background:#ffffff !important;
    border-left-color:var(--verde) !important;
}

.card-kpi.vino{
    background:#ffffff !important;
    border-left-color:var(--vino) !important;
}

.graficas-grid{
    display:grid;
    grid-template-columns:2fr 1fr 1fr;
    gap:20px;
    margin-bottom:22px;
}

.grafica-card{
    height:380px;
}

.grafica-card h3,
.tabla-card h3{
    margin-top:0;
    color:var(--vino);
}

.grafica-card canvas{
    width:100% !important;
    height:300px !important;
}

table{
    width:100%;
    border-collapse:collapse;
    background:white;
    border-radius:12px;
    overflow:hidden;
}

th,
td{
    padding:13px;
    border-bottom:1px solid #eee;
    text-align:left;
    font-size:14px;
}

th{
    background:var(--vino);
    color:white;
}

.badge,
.semaforo{
    padding:7px 12px;
    border-radius:999px;
    color:white;
    font-size:12px;
    font-weight:bold;
    display:inline-block;
}

.badge.verde,
.semaforo.verde{
    background:var(--verde);
    color:white;
}

.badge.amarillo,
.semaforo.amarillo{
    background:var(--amarillo);
    color:white;
}

.badge.naranja,
.semaforo.naranja{
    background:var(--naranja);
    color:white;
}

.badge.rojo,
.semaforo.rojo{
    background:var(--rojo);
    color:white;
}

/* PENDIENTES */

.cards-pendientes{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:20px;
}

.pendiente-card{
    border-top:5px solid var(--vino);
    display:flex;
    flex-direction:column;
    gap:14px;
}

.pendiente-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.folio{
    color:var(--texto-suave);
    font-weight:bold;
    font-size:13px;
}

.pendiente-card h2{
    margin:0;
    color:var(--vino);
    font-size:20px;
}

.descripcion{
    color:#4b5563;
    line-height:1.5;
    min-height:55px;
}

.pendiente-info{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
}

.pendiente-info div{
    background:#f9fafb;
    border-radius:12px;
    padding:12px;
}

.pendiente-info strong{
    display:block;
    color:var(--vino);
    font-size:12px;
    margin-bottom:4px;
}

.pendiente-info span{
    font-size:13px;
    color:#374151;
}

.pendiente-actions{
    margin-top:auto;
    display:flex;
    justify-content:flex-end;
}

.empty-state{
    grid-column:1/-1;
    background:white;
    padding:35px;
    border-radius:18px;
    text-align:center;
    box-shadow:var(--sombra);
}

.acciones-panel{
    display:flex;
    justify-content:flex-end;
    gap:12px;
    margin-bottom:18px;
}

.acciones-panel .btn{
    min-width:200px;
    text-align:center;
}

.comentario{
    border-left:5px solid var(--verde);
    padding:14px;
    background:#fafafa;
    margin-bottom:10px;
    border-radius:10px;
}

/* RESPONSIVO */

@media(max-width:1300px){
    .cards-dashboard{
        grid-template-columns:repeat(3,1fr);
    }

    .graficas-grid,
    .cards-pendientes{
        grid-template-columns:1fr;
    }
}

@media(max-width:900px){
    .layout{
        display:block;
    }

    .sidebar{
        width:100%;
        height:auto;
        position:relative;
        top:0;
        display:flex;
        overflow:auto;
    }

    .sidebar-title{
        display:none;
    }

    .content{
        padding:24px;
    }

    .page-header{
        display:block;
    }

    .form-row,
    .filtros-dashboard{
        grid-template-columns:1fr;
    }

    .cards-dashboard{
        grid-template-columns:1fr 1fr;
    }
}

@media(max-width:600px){
    .cards-dashboard,
    .pendiente-info{
        grid-template-columns:1fr;
    }

    .topbar{
        height:auto;
        padding:16px;
        display:block;
    }

    .sidebar{
        display:block;
    }

    .acciones-panel{
        display:block;
    }

    .acciones-panel .btn{
        display:block;
        margin-bottom:10px;
    }
}
/* ==========================================
   BANNER SINTESIS EJECUTIVA
========================================== */

.banner-sintesis{
    background:linear-gradient(
        135deg,
        #611232 0%,
        #7d153b 50%,
        #235b4e 100%
    );

    border-radius:22px;

    padding:30px;

    margin-bottom:25px;

    display:flex;
    justify-content:space-between;
    align-items:center;

    color:white;

    box-shadow:
        0 12px 35px rgba(0,0,0,.15);
}

.banner-sintesis-info{
    display:flex;
    align-items:center;
    gap:22px;
}

.banner-icono{
    width:90px;
    height:90px;

    border-radius:20px;

    background:rgba(255,255,255,.15);

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:42px;

    backdrop-filter:blur(5px);
}

.banner-sintesis h2{
    margin:0 0 8px 0;

    font-size:32px;
    font-weight:700;

    color:white;
}

.banner-sintesis p{
    margin:0;

    max-width:700px;

    font-size:15px;

    opacity:.95;
}

.banner-fecha{
    margin-top:12px;

    font-size:14px;

    background:rgba(255,255,255,.15);

    display:inline-block;

    padding:8px 14px;

    border-radius:30px;
}

.banner-botones{
    display:flex;
    gap:15px;
}

.btn-banner{
    text-decoration:none;

    padding:15px 28px;

    border-radius:12px;

    font-weight:bold;

    transition:.25s ease;

    white-space:nowrap;
}

.btn-banner:hover{
    transform:translateY(-3px);

    box-shadow:
        0 8px 20px rgba(0,0,0,.25);
}

.btn-banner-vino{
    background:white;

    color:#611232;
}

.btn-banner-verde{
    background:#ffffff;

    color:#235b4e;
}

.btn-banner-vino:hover{
    background:#f5f5f5;
}

.btn-banner-verde:hover{
    background:#f5f5f5;
}
@media(max-width:1200px){

    .banner-sintesis{
        flex-direction:column;
        align-items:flex-start;
        gap:20px;
    }

    .banner-botones{
        width:100%;
    }

    .btn-banner{
        flex:1;
        text-align:center;
    }
}

@media(max-width:700px){

    .banner-sintesis-info{
        flex-direction:column;
        align-items:flex-start;
    }

    .banner-sintesis h2{
        font-size:24px;
    }

    .banner-botones{
        flex-direction:column;
        width:100%;
    }
}

/* ===============================
   VISTAS EJECUTIVAS GENERALES
================================ */

.modulo-hero{
    background:linear-gradient(135deg,#611232,#7a1438,#235b4e);
    color:white;
    border-radius:22px;
    padding:30px;
    margin-bottom:26px;
    box-shadow:0 12px 35px rgba(0,0,0,.16);
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
}

.modulo-hero h1{
    margin:0;
    font-size:34px;
    color:white;
}

.modulo-hero p{
    margin:8px 0 0;
    opacity:.95;
    max-width:780px;
}

.modulo-hero-icon{
    font-size:56px;
    background:rgba(255,255,255,.16);
    width:95px;
    height:95px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:24px;
}

.modulo-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:18px;
    margin-bottom:24px;
}

.modulo-card-mini{
    background:white;
    border-radius:18px;
    padding:20px;
    box-shadow:var(--sombra);
    border-left:7px solid var(--vino);
}

.modulo-card-mini span{
    display:block;
    font-size:13px;
    font-weight:700;
    color:#374151;
}

.modulo-card-mini strong{
    display:block;
    font-size:34px;
    color:var(--vino);
    margin-top:8px;
}

.panel-ejecutivo{
    background:white;
    border-radius:20px;
    padding:24px;
    box-shadow:var(--sombra);
    margin-bottom:24px;
}

.panel-ejecutivo h2{
    margin-top:0;
    color:var(--vino);
}

.tabla-responsive{
    overflow-x:auto;
}

.tabla-moderna{
    width:100%;
    border-collapse:separate;
    border-spacing:0 10px;
}

.tabla-moderna thead th{
    background:var(--vino);
    color:white;
    padding:14px;
    font-size:13px;
}

.tabla-moderna tbody tr{
    background:#ffffff;
    box-shadow:0 4px 14px rgba(0,0,0,.06);
}

.tabla-moderna tbody td{
    padding:16px 14px;
    border-bottom:none;
    vertical-align:middle;
}

.tabla-moderna tbody tr td:first-child{
    border-radius:12px 0 0 12px;
}

.tabla-moderna tbody tr td:last-child{
    border-radius:0 12px 12px 0;
}

.sintesis-cards{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:20px;
}

.sintesis-card{
    background:white;
    border-radius:20px;
    padding:24px;
    box-shadow:var(--sombra);
    border-top:6px solid var(--vino);
}

.sintesis-card h2{
    margin:10px 0;
    color:var(--vino);
}

.sintesis-fecha{
    display:inline-block;
    background:#f8f1f4;
    color:var(--vino);
    padding:8px 13px;
    border-radius:999px;
    font-weight:700;
    font-size:13px;
}

.sintesis-meta{
    color:#6b7280;
    font-size:13px;
    margin:10px 0 18px;
}

.upload-box{
    border:2px dashed #bc955c;
    background:#fffaf0;
    border-radius:18px;
    padding:24px;
    text-align:center;
    margin-bottom:18px;
}

.upload-box strong{
    display:block;
    color:var(--vino);
    margin-bottom:8px;
}

.upload-box input{
    background:white;
}

@media(max-width:1200px){
    .modulo-grid,
    .sintesis-cards{
        grid-template-columns:1fr 1fr;
    }
}

@media(max-width:700px){
    .modulo-hero{
        flex-direction:column;
        align-items:flex-start;
    }

    .modulo-grid,
    .sintesis-cards{
        grid-template-columns:1fr;
    }
}
/* ===============================
   DETALLE Y CIERRE DE PENDIENTES
================================ */

.detalle-grid{
    display:grid;
    grid-template-columns:2fr .9fr;
    gap:24px;
}

.detalle-principal{
    display:flex;
    flex-direction:column;
    gap:22px;
}

.detalle-lateral{
    position:sticky;
    top:100px;
    height:max-content;
}

.detalle-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:18px;
}

.detalle-descripcion{
    font-size:15px;
    color:#4b5563;
    line-height:1.7;
    background:#f9fafb;
    border-radius:14px;
    padding:18px;
}

.detalle-info-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
    margin-top:18px;
}

.detalle-info-grid div{
    background:#f9fafb;
    border-radius:14px;
    padding:14px;
    border-left:5px solid var(--vino);
}

.detalle-info-grid strong{
    display:block;
    color:var(--vino);
    font-size:12px;
    margin-bottom:5px;
}

.detalle-info-grid span{
    color:#374151;
    font-size:14px;
}

.detalle-info-grid.simple{
    grid-template-columns:1fr;
}

.panel-cierre{
    background:linear-gradient(135deg,#611232,#7a1438);
    color:white;
    border-radius:22px;
    padding:24px;
    box-shadow:0 12px 35px rgba(0,0,0,.16);
}

.panel-cierre h2{
    margin-top:0;
    color:white;
}

.panel-cierre p{
    opacity:.95;
    line-height:1.5;
}

.panel-cierre label{
    color:white;
}

.panel-cierre input,
.panel-cierre textarea{
    background:white;
    color:#111827;
}

.panel-cierre.cerrado{
    background:linear-gradient(135deg,#235b4e,#0f3d35);
}

.btn-full{
    width:100%;
    text-align:center;
    margin-top:8px;
    background:#ffffff;
    color:#611232;
}

.vino-badge{
    background:#611232;
    color:white;
}

.archivo-item{
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:#f9fafb;
    border-radius:14px;
    padding:14px;
    margin-bottom:10px;
}

.archivo-item span{
    font-weight:700;
    color:#374151;
}

.pendiente-actions{
    display:flex;
    gap:10px;
    justify-content:flex-end;
    flex-wrap:wrap;
}

@media(max-width:1100px){
    .detalle-grid{
        grid-template-columns:1fr;
    }

    .detalle-lateral{
        position:relative;
        top:0;
    }
}

@media(max-width:700px){
    .detalle-info-grid{
        grid-template-columns:1fr;
    }

    .detalle-header{
        flex-direction:column;
        align-items:flex-start;
        gap:12px;
    }
}