/* ===========================================================
   CENTRAL ELÉCTRICA — Gestión de tarifas de proveedores
   Demo desarrollado por ArisCode
   =========================================================== */

:root {
    --hoja:    #F4F5F8;
    --panel:   #FFFFFF;
    --barra:   #FFFFFF;

    --tinta:   #14161C;
    --gris:    #5A6070;
    --tenue:   #8A90A0;

    --indigo:  #4B3F9E;
    --indigo-h:#3C3183;
    --indigo-l:#EFEDF9;

    --linea:   #DCDFE6;
    --linea-2: #EBEDF1;

    --sube:    #A32B21;
    --baja:    #1B6E4A;
    --aviso:   #B36A00;

    --r: 5px;
    --cinta-h: 38px;
    --head-h: 112px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--tinta);
    background: var(--hoja);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.014em; }
p { margin: 0; }
button { font: inherit; }
a { color: var(--indigo); }

.mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.9em;
}

.cifra { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ===========================================================
   CINTA DE DEMO
   =========================================================== */
.cinta {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 90;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;

    height: var(--cinta-h);
    padding: 0 14px;
    overflow: hidden;
    white-space: nowrap;

    background: #14161C;
    color: #D3D7E0;
    font-size: 12.5px;
}

.cinta strong { color: #fff; font-weight: 600; }
.cinta a { color: #A79BF0; text-decoration: none; border-bottom: 1px solid rgba(167,155,240,.35); }
.cinta a:hover { color: #fff; border-bottom-color: #fff; }
.cinta-sep { color: #4A505C; }
.solo-angosto { display: none; }

/* ===========================================================
   ENCABEZADO
   =========================================================== */
.cabecera {
    position: fixed;
    top: var(--cinta-h); left: 0; right: 0;
    z-index: 80;
    background: var(--barra);
    border-bottom: 1px solid var(--linea);
}

.cabecera-fila {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 13px 26px 0;
}

.marca { display: flex; align-items: center; gap: 11px; }

.marca .glifo {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    background: var(--indigo);
    color: #fff;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -0.04em;
}

.marca .nombre { font-weight: 650; font-size: 15px; line-height: 1.2; }
.marca .sub { font-size: 12px; color: var(--gris); }

.cabecera .hueco { flex: 1; }

.chip-usuario {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--gris);
}

.chip-usuario .redondo {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--indigo-l);
    color: var(--indigo);
    font-size: 11.5px;
    font-weight: 650;
}

/* PESTAÑAS */
.pestanas {
    display: flex;
    gap: 2px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 10px 26px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.pestanas::-webkit-scrollbar { display: none; }

.pestanas button {
    position: relative;
    padding: 9px 14px 13px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--gris);
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
}

.pestanas button:hover { color: var(--tinta); }

.pestanas button.activa {
    color: var(--indigo);
    font-weight: 600;
    border-bottom-color: var(--indigo);
}

.pestanas .globo {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--linea-2);
    color: var(--gris);
    font-size: 11.5px;
    font-weight: 500;
}

.pestanas button.activa .globo { background: var(--indigo-l); color: var(--indigo); }

/* ===========================================================
   CONTENIDO
   =========================================================== */
main {
    max-width: 1440px;
    margin: 0 auto;
    padding: calc(var(--cinta-h) + var(--head-h) + 24px) 26px 60px;
}

.vista[hidden] { display: none; }

.titulo-vista { margin-bottom: 4px; font-size: 21px; }
.bajada { font-size: 14px; color: var(--gris); margin-bottom: 22px; max-width: 70ch; }

.tarjeta {
    background: var(--panel);
    border: 1px solid var(--linea);
    border-radius: 7px;
}

.tarjeta-cuerpo { padding: 22px 24px; }

.tarjeta-tope {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--linea-2);
}

.tarjeta-tope h3 { font-size: 14.5px; }
.tarjeta-tope .hueco { flex: 1; }

/* ===========================================================
   BOTONES
   =========================================================== */
.bt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: var(--r);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
}

.bt-lleno { background: var(--indigo); color: #fff; }
.bt-lleno:hover { background: var(--indigo-h); color: #fff; }
.bt-lleno:disabled { background: #B6B2D6; cursor: default; }

.bt-linea { background: var(--panel); color: var(--tinta); border-color: var(--linea); }
.bt-linea:hover { background: #F7F8FA; border-color: #C3C8D2; color: var(--tinta); }

.bt-mudo { background: transparent; color: var(--gris); padding: 6px 9px; }
.bt-mudo:hover { background: var(--linea-2); color: var(--tinta); }

.bt-chico { padding: 5px 11px; font-size: 12.5px; }

/* ===========================================================
   IMPORTAR
   =========================================================== */
.paso-elegir {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.prov-opcion {
    text-align: left;
    padding: 16px 18px;
    background: var(--panel);
    border: 1px solid var(--linea);
    border-radius: 7px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.prov-opcion:hover { border-color: #B9B3E0; }

.prov-opcion.elegida {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(75, 63, 158, .14);
    background: var(--indigo-l);
}

.prov-opcion .cod {
    display: inline-block;
    padding: 1px 7px;
    margin-bottom: 8px;
    border-radius: 3px;
    background: var(--linea-2);
    color: var(--gris);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
}

.prov-opcion.elegida .cod { background: #fff; color: var(--indigo); }
.prov-opcion h4 { font-size: 14.5px; margin-bottom: 4px; }
.prov-opcion p { font-size: 12.5px; color: var(--gris); line-height: 1.5; }

/* ZONA DE ARCHIVO */
.zona {
    padding: 38px 24px;
    text-align: center;
    background: var(--panel);
    border: 2px dashed var(--linea);
    border-radius: 7px;
    transition: border-color .15s, background .15s;
}

.zona.encima { border-color: var(--indigo); background: var(--indigo-l); }
.zona.inactiva { opacity: .5; pointer-events: none; }

.zona .icono { color: var(--tenue); margin-bottom: 12px; }
.zona h3 { font-size: 15.5px; margin-bottom: 5px; }
.zona p { font-size: 13.5px; color: var(--gris); margin-bottom: 16px; }
.zona input[type="file"] { display: none; }

.ejemplos {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--linea-2);
    font-size: 13px;
    color: var(--gris);
}

.ejemplos .lista { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

/* RESULTADO */
.marcadores {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--linea-2);
    border-bottom: 1px solid var(--linea-2);
}

.marcador { background: var(--panel); padding: 16px 20px; }
.marcador b { display: block; font-size: 24px; font-weight: 650; line-height: 1.1; }
.marcador span { font-size: 12.5px; color: var(--gris); }
.marcador.alerta b { color: var(--sube); }
.marcador.alerta span { color: var(--sube); }

.lista-errores { margin: 0; padding: 0; list-style: none; }

.lista-errores li {
    display: flex;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--linea-2);
    font-size: 13.5px;
}

.lista-errores li:last-child { border-bottom: none; }
.lista-errores .fila { color: var(--sube); font-weight: 600; white-space: nowrap; }

/* ===========================================================
   MAPEO DE COLUMNAS
   =========================================================== */
.mapeo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0 14px;
    max-width: 560px;
    font-size: 13.5px;
}

.mapeo .de, .mapeo .a, .mapeo .flecha {
    padding: 8px 0;
    border-bottom: 1px solid var(--linea-2);
}

.mapeo .flecha { color: var(--tenue); text-align: center; }
.mapeo .a { color: var(--gris); }
.mapeo .cabeza { font-size: 11.5px; font-weight: 600; color: var(--tenue); border-bottom: 1px solid var(--linea); padding-bottom: 6px; }

.supuestos { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--gris); }
.supuestos li { padding: 3px 0; }

/* ===========================================================
   FILTROS
   =========================================================== */
.filtros {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-bottom: 15px;
}

.filtros input[type="search"], .filtros select {
    padding: 7px 10px;
    font: inherit;
    font-size: 13.5px;
    color: var(--tinta);
    background: var(--panel);
    border: 1px solid var(--linea);
    border-radius: var(--r);
}

.filtros input[type="search"] { min-width: 250px; }
.filtros input:focus, .filtros select:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(75, 63, 158, .13);
}

.filtros .hueco { flex: 1; }
.conteo { font-size: 13px; color: var(--gris); }

/* ===========================================================
   TABLAS
   =========================================================== */
.envoltura { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    padding: 9px 13px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .02em;
    color: var(--gris);
    background: #F7F8FA;
    border-bottom: 1px solid var(--linea);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tbody td {
    padding: 10px 13px;
    border-bottom: 1px solid var(--linea-2);
    font-size: 13.5px;
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr.pulsable { cursor: pointer; }
tbody tr.pulsable:hover { background: #F8F8FC; }

.der { text-align: right; }
.t-fuerte { font-weight: 500; }
.t-flojo { font-size: 12.5px; color: var(--gris); }

.nada {
    padding: 44px 20px;
    text-align: center;
}

.nada h3 { font-size: 15px; margin-bottom: 5px; }
.nada p { font-size: 13.5px; color: var(--gris); }

/* ETIQUETAS */
.pica {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--linea-2);
    color: var(--gris);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.pica-ok  { background: #E3F1EA; color: var(--baja); }
.pica-mal { background: #FAEAE8; color: var(--sube); }
.pica-ind { background: var(--indigo-l); color: var(--indigo); }

.delta { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.delta.sube { color: var(--sube); }
.delta.baja { color: var(--baja); }
.delta.igual { color: var(--tenue); font-weight: 400; }

/* ===========================================================
   COMPARADOR
   =========================================================== */
.comp-fila td { vertical-align: top; }

.ofertas { display: flex; flex-direction: column; gap: 5px; }

.oferta {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 5px 9px;
    border-radius: var(--r);
    background: #F7F8FA;
    font-size: 13px;
}

.oferta.mejor { background: #E3F1EA; }
.oferta .quien { flex: 1; color: var(--gris); }
.oferta.mejor .quien { color: var(--baja); font-weight: 600; }
.oferta .monto { font-weight: 600; }

.ahorro { font-size: 12.5px; color: var(--baja); font-weight: 600; white-space: nowrap; }

/* ===========================================================
   PANEL LATERAL
   =========================================================== */
.velo {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(20, 22, 28, .42);
    display: none;
}
.velo.abierto { display: block; }

.cajon {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 101;
    width: min(520px, 100%);
    background: var(--panel);
    box-shadow: -8px 0 32px rgba(20, 22, 28, .2);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .22s ease;
}

.cajon.abierto { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) { .cajon { transition: none; } }

.cajon-tope { padding: 18px 22px 14px; border-bottom: 1px solid var(--linea); }
.cajon-tope .arriba { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.cajon-tope h2 { font-size: 16.5px; line-height: 1.35; }
.cajon-cuerpo { flex: 1; overflow-y: auto; padding: 20px 22px 26px; }

.bloque { margin-bottom: 24px; }
.bloque:last-child { margin-bottom: 0; }

.bloque > h3 {
    font-size: 12px;
    font-weight: 650;
    color: var(--gris);
    margin-bottom: 9px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--linea-2);
}

.pares { display: grid; grid-template-columns: auto 1fr; gap: 7px 18px; font-size: 13.5px; }
.pares dt { color: var(--gris); }
.pares dd { margin: 0; }

.tramos { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tramos th { padding: 5px 0; font-size: 11.5px; color: var(--gris); text-align: left; border-bottom: 1px solid var(--linea-2); background: none; position: static; }
.tramos td { padding: 7px 0; border-bottom: 1px solid var(--linea-2); }
.tramos tr:last-child td { border-bottom: none; }

/* ===========================================================
   AVISOS
   =========================================================== */
.avisos {
    position: fixed;
    left: 50%; bottom: 24px;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.aviso {
    background: var(--tinta);
    color: #fff;
    font-size: 13.5px;
    padding: 10px 16px;
    border-radius: var(--r);
    box-shadow: 0 8px 24px rgba(20, 22, 28, .28);
    animation: entra .18s ease;
}

@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .aviso { animation: none; } }

.trabajando {
    display: inline-block;
    width: 15px; height: 15px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gira .7s linear infinite;
}

@keyframes gira { to { transform: rotate(360deg); } }

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 1000px) {
    .paso-elegir { grid-template-columns: 1fr; }
    .marcadores { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    :root { --cinta-h: 34px; --head-h: 104px; }

    .solo-ancho { display: none; }
    .solo-angosto { display: inline; }
    .cinta { font-size: 11px; gap: 9px; }

    .cabecera-fila { padding: 11px 16px 0; }
    .pestanas { padding: 8px 16px 0; }
    .chip-usuario .quien { display: none; }

    main { padding: calc(var(--cinta-h) + var(--head-h) + 18px) 16px 44px; }

    .titulo-vista { font-size: 18px; }
    .tarjeta-cuerpo { padding: 18px 16px; }
    .tarjeta-tope { padding: 13px 16px; }
    .filtros input[type="search"] { min-width: 0; flex: 1 1 100%; }
    .zona { padding: 28px 16px; }

    .mapeo { grid-template-columns: 1fr auto 1fr; font-size: 12.5px; gap: 0 8px; }

    /* Tablas apiladas */
    .apila thead { display: none; }
    .apila tbody tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--linea-2); }
    .apila tbody td { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; border: none; }
    .apila tbody td::before { content: attr(data-th); font-size: 12.5px; color: var(--gris); flex-shrink: 0; }
    .apila .der { text-align: left; }
    .apila tbody td.sin-rotulo { display: block; }
    .apila tbody td.sin-rotulo::before { content: none; }
    .envoltura { overflow-x: visible; }
}
