/* =====================================================================
   Serviprof - Etapa 1  ·  Estilos base (liviano, moderno, responsivo)
   ===================================================================== */

:root {
    --azul:        #1c84d6;   /* azul del logo */
    --azul-osc:    #232a33;   /* gris carbon del logo (topbar) */
    --gris-bg:     #f1f5f9;
    --gris-card:   #ffffff;
    --gris-borde:  #e2e8f0;
    --texto:       #0f172a;
    --texto-sec:   #64748b;
    --ok:          #16a34a;
    --danger:      #dc2626;
    --off:         #94a3b8;
    --radio:       12px;
    --sombra:      0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
    --sombra-md:   0 4px 12px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--gris-bg);
    color: var(--texto);
    line-height: 1.5;
}

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem .9rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s, background .15s;
    background: #e2e8f0;
    color: var(--texto);
}
.btn:hover { filter: brightness(.97); }
.btn--primary { background: var(--azul); color: #fff; }
.btn--danger  { background: var(--danger); color: #fff; }
.btn--ok      { background: var(--ok); color: #fff; }
.btn--ghost   { background: #fff; border-color: var(--gris-borde); color: var(--texto); }
.btn--block   { width: 100%; }
.btn--sm      { padding: .3rem .55rem; font-size: .8rem; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--azul-osc);
    color: #fff;
    padding: .6rem 1.2rem;
    box-shadow: var(--sombra-md);
    flex-wrap: wrap;
}
.topbar__brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; }
.topbar__logo { display: block; width: 34px; height: 34px; background: #fff; border-radius: 7px; padding: 3px; }
.topbar__empresa { font-size: .95rem; }
.topbar__nav { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.topbar__user { font-size: .9rem; }
.topbar__user small { opacity: .8; }

/* ---------- Contenido ---------- */
.contenido { max-width: 1400px; margin: 0 auto; padding: 1.2rem 1.2rem 2rem; }

/* ---------- Barra de menus desplegables (estilo sistema original) ---------- */
.menubar {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem;
    background: var(--azul);
    padding: 0 .6rem;
    box-shadow: var(--sombra);
    position: relative;
    z-index: 50;
}
.menubar__item { position: relative; }
.menubar__btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: transparent;
    border: 0;
    color: #fff;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    padding: .55rem .8rem;
    cursor: pointer;
}
.menubar__btn:hover,
.menubar__item.is-open .menubar__btn { background: rgba(255, 255, 255, .15); }
.menubar__caret { font-size: .7rem; opacity: .8; }

.menubar__menu,
.menubar__submenu {
    list-style: none;
    margin: 0;
    padding: .3rem 0;
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 0 0 8px 8px;
    box-shadow: var(--sombra-md);
    min-width: 240px;
    display: none;
    position: absolute;
}
.menubar__menu { top: 100%; left: 0; }
/* Abrir por hover (desktop) y por clic (clase is-open via JS). */
.menubar__item:hover > .menubar__menu,
.menubar__item.is-open > .menubar__menu { display: block; }

.menubar__li { position: relative; }
.menubar__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .45rem .9rem;
    font-size: .88rem;
    color: var(--texto);
    text-decoration: none;
    white-space: nowrap;
}
a.menubar__link:hover,
.menubar__li.has-sub:hover > .menubar__link { background: var(--gris-bg); }
.menubar__link.is-off { color: var(--off); cursor: default; }
.menubar__arrow { font-size: .7rem; opacity: .7; }

.menubar__submenu { top: -.3rem; left: 100%; border-radius: 8px; }
.menubar__li.has-sub:hover > .menubar__submenu { display: block; }

/* ---------- Alertas ---------- */
.alert {
    padding: .7rem 1rem;
    border-radius: 8px;
    margin: 0 0 1rem;
    font-size: .92rem;
    border: 1px solid transparent;
}
.alert--error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert--ok    { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--azul-osc), #0f172a);
    padding: 1rem;
}
.login-card {
    background: var(--gris-card);
    width: 100%;
    max-width: 380px;
    border-radius: var(--radio);
    padding: 2rem 1.8rem;
    box-shadow: var(--sombra-md);
}
.login-card__head { text-align: center; margin-bottom: 1.2rem; }
.login-card__logo { display: inline-block; width: 120px; height: auto; }
.login-card__title { font-size: 1.05rem; margin: .5rem 0 .2rem; }
.login-card__sub { color: var(--texto-sec); margin: 0; font-size: .9rem; }
.login-card__foot { color: var(--texto-sec); font-size: .8rem; text-align: center; margin: 1rem 0 0; }
.datos-soporte { font-size: .9rem; color: var(--texto-sec); padding-left: 1.1rem; }

/* ---------- Formularios ---------- */
.form__group { display: block; margin-bottom: 1rem; }
.form__label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; color: var(--texto-sec); }
.form__input {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    color: var(--texto);
}
.form__input:focus { outline: 2px solid var(--azul); outline-offset: 1px; border-color: var(--azul); }
.form__hint { display: block; margin-top: .25rem; font-size: .78rem; color: var(--texto-sec); }
.form__row { display: flex; gap: .8rem; flex-wrap: wrap; }
.form__row .form__group { flex: 1; min-width: 140px; }
.form__group--sm { max-width: 90px; }
.form__actions { display: flex; gap: .6rem; margin-top: .5rem; }

/* ---------- Menu tablero ---------- */
.menu__head { margin-bottom: 1rem; }
.menu__title { margin: 0 0 .2rem; font-size: 1.5rem; }
.menu__welcome { margin: 0; color: var(--texto-sec); }
.menu__area {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--texto-sec);
    margin: 1.6rem 0 .6rem;
    border-bottom: 1px solid var(--gris-borde);
    padding-bottom: .3rem;
}
.tablero {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .9rem;
}
.tarjeta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
    background: var(--gris-card);
    border: 1px solid var(--gris-borde);
    border-radius: var(--radio);
    padding: 1rem;
    text-decoration: none;
    color: var(--texto);
    box-shadow: var(--sombra);
    transition: transform .12s, box-shadow .12s;
    position: relative;
    min-height: 96px;
}
a.tarjeta:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); border-color: var(--azul); }
.tarjeta__icono { font-size: 1.6rem; }
.tarjeta__nombre { font-weight: 600; font-size: .95rem; }
.tarjeta--off {
    background: #f8fafc;
    color: var(--off);
    cursor: not-allowed;
    box-shadow: none;
}
.tarjeta--off .tarjeta__icono { filter: grayscale(1); opacity: .5; }
.tarjeta__badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #e2e8f0;
    color: var(--texto-sec);
    padding: .12rem .4rem;
    border-radius: 999px;
}

/* ---------- Tablero compacto multicolumna (menu principal) ---------- */
.menu--compacto .menu__head { margin-bottom: .6rem; }
.menu--compacto .menu__title { font-size: 1.25rem; }
.menu--compacto .menu__welcome { font-size: .9rem; }

/* Grupos fluyen en columnas para que todo entre sin scroll. */
.tablero-grid {
    column-width: 300px;
    column-gap: 1rem;
}
.grupo {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin: 0 0 .9rem;
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    overflow: hidden;
    background: var(--gris-card);
    box-shadow: var(--sombra);
}
.grupo__titulo {
    margin: 0;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #fff;
    padding: .4rem .7rem;
    background: var(--g-color, var(--azul));
}
.grupo__tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
    padding: .5rem;
}
.tile {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .45rem .55rem;
    border-radius: 7px;
    border: 1px solid var(--gris-borde);
    background: #fff;
    text-decoration: none;
    color: var(--texto);
    position: relative;
    min-height: 44px;
    transition: transform .1s, box-shadow .1s, border-color .1s;
}
a.tile:hover {
    transform: translateY(-1px);
    box-shadow: var(--sombra-md);
    border-color: var(--g-color, var(--azul));
}
.tile__icono { font-size: 1.25rem; line-height: 1; flex: 0 0 auto; color: var(--g-color, var(--azul)); display: inline-flex; }
.tile__nombre { font-size: .78rem; font-weight: 600; line-height: 1.15; }
.tile--off { background: #f8fafc; color: var(--texto-sec); cursor: not-allowed; }
.tile--off .tile__icono { color: var(--off); opacity: .8; }
.tile__badge {
    position: absolute;
    top: 2px; right: 4px;
    font-size: .54rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--off);
}

/* Titulos de grupo: variaciones del azul principal (#1c84d6). */
.grupo--admin   { --g-color: #1c84d6; }  /* azul base */
.grupo--caja    { --g-color: #0f6ab8; }  /* azul medio */
.grupo--venta   { --g-color: #2b93e0; }  /* azul claro */
.grupo--inv     { --g-color: #155f9e; }  /* azul profundo */
.grupo--compra  { --g-color: #3aa0ea; }  /* azul cielo */
.grupo--cotiz   { --g-color: #1276c4; }  /* azul */
.grupo--libro   { --g-color: #0c4f86; }  /* azul marino */
.grupo--cta     { --g-color: #2589da; }  /* azul */
.grupo--reporte { --g-color: #1a4f7a; }  /* azul acero osc */
.grupo--sii     { --g-color: #1c84d6; }  /* azul base */

/* Acento de color tambien en el borde superior de cada tile habilitado. */
.grupo a.tile { border-left: 3px solid var(--g-color, var(--azul)); }

/* ---------- Pantalla principal estilo aplicacion de escritorio ---------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.body--dashboard {
    min-height: 100vh;
    overflow: hidden;
    background: #eef4f7;
}
.contenido--dashboard {
    width: 100%;
    max-width: none;
    height: 100vh;
    margin: 0;
    padding: 0;
}
.dashboard-app {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    color: #12244b;
}
.body--dashboard .material-symbols-rounded {
    font-size: inherit;
    font-variation-settings: "FILL" 1;
    line-height: 1;
    text-transform: none;
}

.dashboard-header {
    display: grid;
    grid-template-columns: 240px minmax(300px, 1fr) auto;
    align-items: center;
    min-height: 76px;
    background: #fff;
    border-bottom: 1px solid #dce5eb;
    box-shadow: 0 1px 4px rgba(20, 45, 78, .08);
    position: relative;
    z-index: 30;
}
.dashboard-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
    height: 100%;
    padding: .45rem 1.15rem;
}
.dashboard-brand__logo {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: cover;
    flex: 0 0 auto;
}
.dashboard-brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.05;
}
.dashboard-brand__text strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.08rem;
    font-style: italic;
    color: #112653;
}
.dashboard-brand__text span {
    margin-top: .3rem;
    font-size: .78rem;
    font-style: italic;
    color: #152b56;
}
.dashboard-company {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    padding: 0 1rem;
    color: #463b91;
    font-size: clamp(1rem, 1.55vw, 1.4rem);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-company > .material-symbols-rounded {
    color: #61a818;
    font-size: 1.8rem;
    transform: rotate(8deg);
}
.dashboard-context {
    display: flex;
    align-items: stretch;
    height: 100%;
}
.dashboard-context__item {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 220px;
    padding: .55rem 1rem;
    border-left: 1px solid #eef2f5;
}
.dashboard-context__item > .material-symbols-rounded {
    flex: 0 0 auto;
    font-size: 1.75rem;
    color: #18366f;
}
.dashboard-context__item span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}
.dashboard-context__item small {
    margin-bottom: .18rem;
    color: #41527a;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
}
.dashboard-context__item strong {
    max-width: 225px;
    overflow: hidden;
    color: #132650;
    font-size: .72rem;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.dashboard-workspace {
    display: flex;
    flex: 1;
    min-height: 0;
}
.dashboard-sidebar {
    display: flex;
    flex: 0 0 240px;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    background: #233f78;
    color: #fff;
    position: relative;
    z-index: 25;
}
.dashboard-nav {
    padding: .75rem 0;
}
.dashboard-nav__item {
    position: relative;
}
.dashboard-nav__button {
    display: grid;
    grid-template-columns: 1.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem;
    width: 100%;
    min-height: 46px;
    padding: .65rem 1rem;
    border: 0;
    background: transparent;
    color: #edf4ff;
    font: inherit;
    font-size: .76rem;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
}
.dashboard-nav__button > .material-symbols-rounded:first-child {
    font-size: 1rem;
    text-align: center;
}
.dashboard-nav__chevron {
    font-size: .65rem;
    opacity: .55;
}
.dashboard-nav__item:hover .dashboard-nav__button,
.dashboard-nav__item:focus-within .dashboard-nav__button {
    background: rgba(255, 255, 255, .11);
}
.dashboard-nav__submenu {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    width: 285px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    padding: .55rem 0;
    background: #fff;
    border: 1px solid #dce4eb;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 8px 24px rgba(17, 38, 78, .2);
    color: #142751;
}
.dashboard-nav__item:hover .dashboard-nav__submenu,
.dashboard-nav__item:focus-within .dashboard-nav__submenu {
    display: block;
}
.dashboard-nav__submenu-title,
.dashboard-nav__submenu a,
.dashboard-nav__disabled,
.dashboard-nav__section {
    display: block;
    padding: .48rem .85rem;
    font-size: .78rem;
    line-height: 1.25;
}
.dashboard-nav__submenu-title {
    padding-top: .25rem;
    border-bottom: 1px solid #e7edf2;
    color: #274679;
    font-size: .7rem;
    text-transform: uppercase;
}
.dashboard-nav__submenu a {
    color: #12244b;
    text-decoration: none;
}
.dashboard-nav__submenu a:hover,
.dashboard-nav__submenu a:focus {
    background: #edf5fb;
    color: #0d6eaf;
    outline: none;
}
.dashboard-nav__section {
    padding-bottom: .25rem;
    color: #344b75;
    font-weight: 700;
}
.dashboard-nav__disabled {
    padding-top: .3rem;
    padding-bottom: .3rem;
    color: #9aa6b6;
    cursor: default;
}
.dashboard-sidebar__footer {
    padding: .45rem .55rem .8rem;
    border-top: 1px solid rgba(255, 255, 255, .15);
}
.dashboard-sidebar__link {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 42px;
    padding: .55rem .85rem;
    color: #fff;
    font-size: .82rem;
    text-decoration: none;
}
a.dashboard-sidebar__link:hover {
    background: rgba(255, 255, 255, .1);
}
.dashboard-sidebar__link--off {
    color: #d9e4f6;
    cursor: default;
}

.dashboard-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    background: #f2f7fa;
}
.dashboard-flash {
    margin: .65rem 1rem 0;
}
.dashboard-board {
    display: grid;
    grid-template-columns: minmax(570px, 1.65fr) minmax(315px, 1fr) 160px;
    gap: clamp(.8rem, 1.5vw, 1.35rem);
    flex: 1;
    min-width: 0;
    min-height: 520px;
    padding: .55rem 1.05rem .4rem;
}
.dashboard-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: .95rem;
}
.dashboard-column--left,
.dashboard-column--center {
    justify-content: space-between;
}
.dashboard-group {
    --section-color: #2a8bc6;
    min-width: 0;
}
.dashboard-group__title {
    margin: 0 0 .62rem;
    padding: 0 .3rem .2rem;
    border-bottom: 1px solid #dce6eb;
    color: var(--section-color);
    font-size: .79rem;
    font-style: italic;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}
.dashboard-group__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, 106px);
    gap: .65rem;
    justify-content: space-between;
}
.dashboard-column--center .dashboard-group__tiles {
    column-gap: 1.25rem;
    justify-content: start;
}
.dashboard-column--right .dashboard-group__tiles {
    grid-template-columns: 156px;
    justify-content: center;
}
.dashboard-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .35rem;
    width: 106px;
    height: 100px;
    padding: .4rem .35rem;
    border: 1px solid #dde4ed;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(18, 36, 75, .08), 0 1px 2px rgba(18, 36, 75, .05);
    color: #10234d;
    text-align: center;
    text-decoration: none;
    transition:
        transform .2s cubic-bezier(.2, .75, .25, 1),
        box-shadow .2s ease,
        border-color .2s ease;
}
.dashboard-column--right .dashboard-tile {
    width: 156px;
}
.dashboard-tile:hover,
a.dashboard-tile:focus-visible {
    border-color: var(--section-color);
    box-shadow: 0 10px 24px rgba(18, 36, 75, .15), 0 3px 7px rgba(18, 36, 75, .08);
    transform: translateY(-3px);
    outline: none;
}
.dashboard-tile__icon {
    color: var(--section-color);
    flex: 0 0 auto;
    font-size: 1.8rem;
    line-height: 1;
    transition: transform .2s cubic-bezier(.2, .75, .25, 1);
}
.dashboard-tile:hover .dashboard-tile__icon,
a.dashboard-tile:focus-visible .dashboard-tile__icon {
    transform: translateY(-1px) scale(1.06);
}
.dashboard-tile__name {
    display: block;
    width: 100%;
    color: #11234a;
    font-size: .63rem;
    font-weight: 500;
    line-height: 1.16;
    text-wrap: balance;
    text-transform: uppercase;
}
.dashboard-tile--off {
    cursor: default;
}
.dashboard-tile--off .dashboard-tile__icon {
    opacity: .9;
}

.dashboard-group--venta { --section-color: #9a4e24; }
.dashboard-group--compra { --section-color: #3471e8; }
.dashboard-group--reporte { --section-color: #344d80; }
.dashboard-group--inv { --section-color: #2d9760; }
.dashboard-group--cta { --section-color: #e17f00; }
.dashboard-group--comprobante { --section-color: #d17a00; }
.dashboard-group--cotiz { --section-color: #8a3bd0; }
.dashboard-group--sii { --section-color: #637d94; }

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex: 0 0 auto;
    min-height: 66px;
    padding: .35rem 1.05rem .55rem;
}
.dashboard-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    width: 180px;
    height: 55px;
    padding: .45rem .65rem;
    border: 0;
    background: #637d94;
    box-shadow: 0 3px 10px rgba(18, 36, 75, .12), 0 1px 2px rgba(18, 36, 75, .08);
    color: #fff;
    text-align: center;
    text-decoration: none;
    transition:
        transform .2s cubic-bezier(.2, .75, .25, 1),
        box-shadow .2s ease,
        filter .2s ease;
}
.dashboard-action:hover,
a.dashboard-action:focus-visible {
    box-shadow: 0 9px 20px rgba(18, 36, 75, .2), 0 3px 6px rgba(18, 36, 75, .1);
    filter: brightness(1.04);
    transform: translateY(-2px);
    outline: none;
}
.dashboard-action .dashboard-tile__icon {
    color: #fff;
    font-size: 1.35rem;
}
.dashboard-action .dashboard-tile__name {
    color: #fff;
    font-size: .72rem;
    font-weight: 500;
}
.dashboard-action--featured {
    width: 205px;
    margin-left: auto;
    border: 4px solid #6f35a8;
    background: #8b48c5;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 3px 10px rgba(67, 28, 105, .2);
}
.dashboard-action--featured:hover,
a.dashboard-action--featured:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55), 0 9px 20px rgba(67, 28, 105, .3);
}
.dashboard-status {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: .9rem;
    align-items: center;
    min-height: 25px;
    padding: .25rem .85rem;
    border-top: 1px solid #dde5ea;
    background: #fff;
    color: #78869a;
    font-size: .61rem;
    text-transform: uppercase;
}
.dashboard-status span:last-child {
    text-align: right;
}
.dashboard-status i {
    margin-right: .2rem;
    color: #53a847;
    font-size: .45rem;
    vertical-align: middle;
}

@media (max-width: 1320px) {
    .dashboard-header { grid-template-columns: 220px minmax(220px, 1fr) auto; }
    .dashboard-sidebar { flex-basis: 220px; }
    .dashboard-context__item { min-width: 185px; }
    .dashboard-context__item:nth-child(2) { display: none; }
    .dashboard-board {
        grid-template-columns: minmax(570px, 1.6fr) minmax(315px, 1fr);
        min-height: 760px;
    }
    .dashboard-column--right {
        grid-column: 1 / -1;
    }
    .dashboard-column--right .dashboard-group__tiles {
        grid-template-columns: repeat(auto-fill, 156px);
        justify-content: start;
    }
}

@media (max-width: 980px) {
    .dashboard-header { grid-template-columns: 190px 1fr auto; }
    .dashboard-brand { padding-left: .75rem; }
    .dashboard-brand__logo { width: 42px; height: 42px; }
    .dashboard-brand__text strong { font-size: .95rem; }
    .dashboard-brand__text span { font-size: .68rem; }
    .dashboard-company { font-size: .95rem; }
    .dashboard-company > .material-symbols-rounded { font-size: 1.45rem; }
    .dashboard-context__item { min-width: 175px; padding: .45rem .7rem; }
    .dashboard-sidebar { flex-basis: 74px; }
    .dashboard-nav__button {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: .7rem .35rem;
    }
    .dashboard-nav__button > .material-symbols-rounded:first-child { font-size: 1.2rem; }
    .dashboard-nav__button span,
    .dashboard-nav__chevron,
    .dashboard-sidebar__link { font-size: 0; }
    .dashboard-sidebar__link { justify-content: center; }
    .dashboard-sidebar__link .material-symbols-rounded { font-size: 1.05rem; }
    .dashboard-board {
        grid-template-columns: minmax(570px, 1fr);
        min-height: 1180px;
    }
    .dashboard-column--center,
    .dashboard-column--right { grid-column: 1; }
    .dashboard-column--right .dashboard-group__tiles {
        justify-content: start;
    }
}

@media (max-width: 720px) {
    .dashboard-header { grid-template-columns: 180px minmax(0, 1fr); }
    .dashboard-company { padding-right: .65rem; }
    .dashboard-context { display: none; }
    .dashboard-sidebar { flex-basis: 62px; }
    .dashboard-nav__submenu { width: min(285px, calc(100vw - 62px)); }
    .dashboard-main { overflow-x: auto; }
    .dashboard-board { min-width: 590px; padding-left: .65rem; padding-right: .65rem; }
    .dashboard-actions { min-width: 590px; padding-left: .65rem; padding-right: .65rem; }
    .dashboard-status { min-width: 590px; }
}

/* ---------- Login con la identidad visual del panel principal ---------- */
.login-body--system {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
    background: #f2f7fa;
    color: #12244b;
}
.login-body--system .material-symbols-rounded {
    font-size: inherit;
    font-variation-settings: "FILL" 1;
    line-height: 1;
    text-transform: none;
}
.login-stage {
    display: grid;
    flex: 1;
    place-items: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem 1rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 16% 18%, rgba(28, 132, 214, .1), transparent 25%),
        radial-gradient(circle at 84% 80%, rgba(70, 59, 145, .08), transparent 27%),
        linear-gradient(135deg, #f7fafc 0%, #edf4f8 100%);
    position: relative;
    isolation: isolate;
}
.login-stage::before,
.login-stage::after {
    content: "";
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(28, 132, 214, .09);
    border-radius: 50%;
}
.login-stage::before {
    top: -180px;
    left: -130px;
    width: 460px;
    height: 460px;
}
.login-stage::after {
    right: -170px;
    bottom: -220px;
    width: 520px;
    height: 520px;
}
.login-card--system {
    width: min(100%, 410px);
    max-width: 410px;
    padding: 2rem 2rem 1.45rem;
    overflow: hidden;
    border: 1px solid #dce5ed;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(18, 36, 75, .13), 0 3px 10px rgba(18, 36, 75, .06);
    position: relative;
}
.login-card__accent {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #233f78, #1c84d6 58%, #61a818);
}
.login-card--system .login-card__head {
    margin-bottom: 1.35rem;
}
.login-card__logo-system {
    display: block;
    width: 86px;
    height: 86px;
    margin: 0 auto .85rem;
    object-fit: contain;
}
.login-card--system .login-card__title {
    margin: 0 0 .3rem;
    color: #132650;
    font-size: 1.22rem;
}
.login-card--system .login-card__sub {
    color: #66758a;
    font-size: .84rem;
}
.login-card__alert {
    padding: .55rem .7rem;
    font-size: .8rem;
}
.login-form .form__group {
    margin-bottom: .85rem;
}
.login-form .form__label {
    margin-bottom: .32rem;
    color: #415474;
    font-size: .75rem;
    text-transform: uppercase;
}
.login-form__control {
    display: flex;
    align-items: center;
    min-height: 46px;
    border: 1px solid #cfdae5;
    border-radius: 9px;
    background: #f8fbfd;
    color: #7a8aa0;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-form__control:focus-within {
    border-color: #1c84d6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(28, 132, 214, .13);
}
.login-form__control > .material-symbols-rounded {
    flex: 0 0 auto;
    margin-left: .75rem;
    font-size: 1.2rem;
}
.login-form__control .form__input {
    min-width: 0;
    min-height: 44px;
    padding: .55rem .75rem .55rem .55rem;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #142750;
    font-size: .9rem;
    outline: none;
}
.login-form__control .form__input:focus {
    border: 0;
    outline: none;
}
.login-form__control .form__input::placeholder {
    color: #9aa7b7;
}
.login-form__submit {
    min-height: 45px;
    margin-top: .25rem;
    border-radius: 9px;
    background: #1c84d6;
    box-shadow: 0 5px 14px rgba(28, 132, 214, .2);
    font-size: .88rem;
    transition: transform .2s cubic-bezier(.2, .75, .25, 1), box-shadow .2s ease, background .2s ease;
}
.login-form__submit > .material-symbols-rounded {
    font-size: 1.2rem;
}
.login-form__submit:hover,
.login-form__submit:focus-visible {
    background: #1478c6;
    box-shadow: 0 9px 20px rgba(28, 132, 214, .28);
    filter: none;
    transform: translateY(-2px);
    outline: none;
}
.login-card--system .login-card__foot {
    margin-top: 1rem;
    color: #738197;
    font-size: .72rem;
}
@media (max-width: 540px) {
    .login-stage { padding: 1.2rem .75rem; }
    .login-card--system { padding: 1.65rem 1.25rem 1.2rem; }
}

/* ---------- Modo ventana (popup standalone) ---------- */
/* El Maestro de Clientes se abre como ventana de Chrome dimensionada al cuadro,
   sin topbar ni barra de menus: el panel llena toda la ventana. */
.body--standalone .contenido { max-width: 100%; margin: 0; padding: 0; }
.body--standalone .cliente.panel {
    max-width: 100%;
    min-height: 100vh;
    background: var(--gris-bg);
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* ---------- Maestro de Clientes ---------- */
/* Vista pensada para abrirse en una ventana secundaria (el usuario trabaja
   con 2 ventanas a la vez): mas angosta y compacta que el resto del sistema. */
.cliente { max-width: 760px; }
.cliente.panel { padding: .9rem 1.1rem; }
.cliente .panel__head { margin-bottom: .6rem; }
.cliente .panel__title { font-size: 1.05rem; }
.cliente .panel__head-actions .btn { padding: .4rem .65rem; font-size: .82rem; }
.cliente .form__row .form__group.cliente__msg-wrap { flex: 2; min-width: 180px; }
.cliente #cliente-msg.alert {
    padding: .4rem .7rem;
    margin: 0;
    font-size: .8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cliente .form__group { margin-bottom: .5rem; }
.cliente .form__label { font-size: .72rem; margin-bottom: .15rem; }
.cliente .form__input { padding: .4rem .55rem; font-size: .88rem; }
.cliente .form__row { gap: .6rem; }
.cliente .form__row .form__group { min-width: 100px; }
.cliente .form__group--rut { max-width: 280px; }
.cliente .form__group--sm2 { max-width: 115px; }
.cliente__meta .form__input[readonly] {
    background: #f1f5f9;
    color: var(--texto-sec);
    border-style: dashed;
}
/* .form__row aplica display:flex con mayor prioridad que el atributo [hidden]
   del navegador; sin esto, los bloques admin-only quedarian visibles aunque
   JS les ponga "hidden". */
.cliente__meta[hidden],
.cliente__venta[hidden] { display: none; }
.form__row--accion { align-items: flex-end; }
.form__row--accion .btn { margin-bottom: .5rem; }
.cliente__credito { margin-bottom: .5rem; }
.cliente__credito > .form__label { margin-bottom: .2rem; }
.cliente__credito .form__input[readonly] {
    background: #f1f5f9;
    color: var(--texto-sec);
    border-style: dashed;
}

/* ---------- Maestro de Productos ---------- */
/* Reusa el design system de Clientes: panel compacto (~760px), inputs y botones
   .form__* / .btn, y una tarjeta blanca que contiene cada pestana. Todo va
   scopeado a .maestro-productos para no afectar otros modulos. La conmutacion de
   pestanas usa el data-api de Bootstrap (bundle ya cargado), sin JS propio. */
.producto { max-width: 760px; }
.producto.panel { padding: .9rem 1.1rem; }
.body--standalone .producto.panel {
    max-width: 100%;
    min-height: 100vh;
    background: var(--gris-bg);
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.maestro-productos .panel__head {
    margin-bottom: .6rem;
}
.maestro-productos .panel__title {
    font-size: 1.05rem;
}
.maestro-productos__tabs,
.maestro-productos__subtabs {
    width: 100%;
}
.maestro-productos__subtabs {
    margin-top: .9rem;
}
.maestro-productos .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.maestro-productos .nav-tabs {
    width: 100%;
}
.maestro-productos .nav-link {
    display: block;
    padding: .45rem .9rem;
    border: 1px solid var(--gris-borde);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #eef2f7;
    color: var(--texto-sec);
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
}
.maestro-productos .nav-link:hover {
    background: #e2edf8;
    color: var(--azul);
}
.maestro-productos .nav-link.active {
    position: relative;
    z-index: 1;
    background: #fff;
    color: var(--azul);
}
.maestro-productos__subtabs .nav-link {
    padding: .38rem .7rem;
    font-size: .74rem;
}
.maestro-productos__card,
.maestro-productos__subcard {
    width: 100%;
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 0 var(--radio) var(--radio) var(--radio);
}
.maestro-productos__subcard {
    border-radius: 0 8px 8px 8px;
}
.maestro-productos .tab-pane {
    display: none;
}
.maestro-productos .tab-pane.show.active {
    display: block;
}
.maestro-productos .fade {
    transition: opacity .15s linear;
}
.maestro-productos .fade:not(.show) {
    opacity: 0;
}
.maestro-productos__panel {
    padding: 1rem 1.1rem;
}
.maestro-productos__panel--sec {
    min-height: 240px;
}
.maestro-productos .form__group {
    margin-bottom: .55rem;
}
.maestro-productos .form__label {
    font-size: .72rem;
    margin-bottom: .15rem;
}
.maestro-productos .form__label--center {
    text-align: center;
}
.maestro-productos .form__input {
    padding: .4rem .55rem;
    font-size: .88rem;
}
.maestro-productos .form__input[alineacion="centro"] {
    text-align: center;
}
.maestro-productos .form__input[alineacion="izquierda"] {
    text-align: left;
}
.maestro-productos .form__row--accion {
    align-items: flex-end;
}
.maestro-productos .form__row--accion .form__group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}
/* Boton e input de la misma fila quedan a la misma altura (34px) para que
   Nuevo Producto y Grabar Cambios se alineen con el campo de al lado. */
.maestro-productos .form__row--accion .form__input {
    min-height: 34px;
}
.maestro-productos .form__row--accion .btn {
    height: 34px;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.maestro-productos .form__group--codigo {
    flex: 0 0 220px;
    max-width: 220px;
}
.maestro-productos .form__group--btn {
    flex: 0 0 auto;
}
.maestro-productos .form__row--barras {
    gap: .4rem;
}
.maestro-productos .form__group--barra {
    flex: 1 1 80px;
    min-width: 72px;
}
.maestro-productos .form__group--barra .form__label--center {
    font-size: .68rem;
}

/* ---------- Maestro de Productos: Valores Comerciales ---------- */
.maestro-productos .mp-vc {
    display: flex;
    flex-wrap: wrap;
    gap: .9rem;
    align-items: flex-start;
}
.maestro-productos .mp-vc-left {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    flex: 1 1 250px;
    min-width: 0;
}
.maestro-productos .mp-vc-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.maestro-productos .mp-vc-label {
    flex: 0 0 120px;
    max-width: 120px;
    margin: 0;
}
.maestro-productos .mp-vc-input {
    flex: 0 0 92px;
    max-width: 92px;
    width: 92px;
}
.maestro-productos .mp-vc-btn {
    flex: 0 0 auto;
    line-height: 1;
}
.maestro-productos .mp-vc-right {
    flex: 0 0 auto;
}
.maestro-productos .mp-card-calculo {
    width: 210px;
    padding: .6rem .65rem;
    background: var(--gris-bg);
    border: 1px solid var(--gris-borde);
    border-radius: var(--radio);
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.maestro-productos .mp-card-calculo__title {
    margin: 0;
    color: var(--azul);
    font-size: .82rem;
    font-weight: 700;
}
.maestro-productos .mp-vc-vert {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.maestro-productos .mp-vc-vert .mp-vc-label {
    flex: 0 0 auto;
    max-width: 100%;
}
.maestro-productos .mp-vc-vert-row {
    display: flex;
    align-items: center;
    gap: .35rem;
}
.maestro-productos .mp-vc-vert-row .mp-vc-input {
    flex: 1 1 60px;
    width: auto;
    max-width: 100%;
    min-width: 0;
}
.maestro-productos .mp-vc-btn-lg {
    flex: 0 0 auto;
    padding: .3rem .45rem;
    font-size: .74rem;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .maestro-productos .mp-vc-right {
        width: 100%;
    }
    .maestro-productos .mp-card-calculo {
        width: 100%;
    }
}

/* ---------- Maestro de Productos: Estados del Producto ---------- */
.maestro-productos .mp-estados-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
}
.maestro-productos .mp-radio-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}
.maestro-productos .mp-radio-label {
    flex: 0 0 auto;
    color: var(--texto);
    font-size: .9rem;
    font-weight: 600;
    text-align: left;
}
.maestro-productos .mp-radio-options {
    display: flex;
    align-items: center;
    gap: .9rem;
}
.maestro-productos .mp-radio-options .form-check {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding-left: 0;
    margin: 0;
}
.maestro-productos .mp-radio-options .form-check-input {
    margin: 0;
}
.maestro-productos .mp-radio-options .form-check-label {
    font-size: .9rem;
}

/* ---------- Modal (buscar por nombre, etc.) ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.modal__dialog {
    position: relative;
    background: var(--gris-card);
    border-radius: var(--radio);
    box-shadow: var(--sombra-md);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    margin: 1rem;
    display: flex;
    flex-direction: column;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--gris-borde); }
.modal__title { margin: 0; font-size: 1.05rem; }
.modal__close { background: none; border: none; font-size: 1.4rem; line-height: 1; color: var(--texto-sec); cursor: pointer; padding: 0 .2rem; }
.modal__close:hover { color: var(--texto); }
.modal__body { padding: 1rem 1.2rem 1.2rem; overflow-y: auto; }
.modal__contador { margin: .6rem 0 0; font-size: .8rem; color: var(--texto-sec); }
.modal__list { margin-top: .8rem; display: flex; flex-direction: column; gap: .3rem; max-height: 50vh; overflow-y: auto; }
.modal__item {
    display: flex;
    flex-direction: column;
    text-align: left;
    width: 100%;
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 8px;
    padding: .5rem .7rem;
    cursor: pointer;
}
.modal__item:hover { background: var(--gris-bg); border-color: var(--azul); }
.modal__item--activo { background: #eaf3fc; border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul) inset; }
.modal__item-nombre { font-weight: 600; }
.modal__item-info { font-size: .8rem; color: var(--texto-sec); }
.modal__empty { color: var(--texto-sec); font-size: .9rem; padding: .4rem 0; }

/* ---------- Panel / tablas ---------- */
.panel { background: var(--gris-card); border: 1px solid var(--gris-borde); border-radius: var(--radio); padding: 1.4rem; box-shadow: var(--sombra); }
.panel--narrow { max-width: 640px; margin: 0 auto; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel__title { margin: 0; font-size: 1.3rem; }
.panel__head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.buscador { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.buscador .form__input { max-width: 320px; }

.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th, .tabla td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--gris-borde); }
.tabla th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-sec); }
.tabla__acciones { white-space: nowrap; }
.tabla__vacio { text-align: center; color: var(--texto-sec); padding: 1.5rem; }
.fila--inactiva { opacity: .6; }
.inline { display: inline; }

.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pill--ok  { background: #dcfce7; color: #166534; }
.pill--off { background: #f1f5f9; color: var(--off); }

/* ---------- Responsivo ---------- */
@media (max-width: 768px) {
    .tablero-grid { column-width: auto; columns: 1; }
}
@media (max-width: 560px) {
    .topbar { flex-direction: column; align-items: flex-start; }
    .tablero { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .menubar { overflow-x: auto; }
    /* En movil, los submenus en cascada se muestran debajo (no a un lado). */
    .menubar__submenu { position: static; left: 0; box-shadow: none; border: 0; min-width: 0; padding-left: 1rem; }
    .menubar__li.has-sub:hover > .menubar__submenu { display: block; }
}

/* ==================================================================== *
 *  Reporte Libro de Ventas (.reporte-lv)
 *  Todo el bloque va scoped a .reporte-lv para no afectar otros modulos.
 * ==================================================================== */

.alert--info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* El reporte necesita mas ancho que los maestros: son 13 columnas. */
.reporte-lv { max-width: 1400px; }

/* ---- Filtros ---- */
.rlv-filtros {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: .9rem 1rem;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    margin-bottom: .9rem;
}

.rlv-filtros__fila {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem .7rem;
    align-items: flex-end;
}

.rlv-campo { display: flex; flex-direction: column; min-width: 0; }

.rlv-campo__label {
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--texto-sec);
    margin-bottom: .18rem;
    white-space: nowrap;
}

.rlv-campo .form__input { height: 32px; font-size: .84rem; padding: .25rem .5rem; }

.rlv-campo--fecha   { flex: 0 0 148px; }
.rlv-campo--folio   { flex: 0 0 96px; }
.rlv-campo--rut     { flex: 0 0 128px; }
.rlv-campo--cliente { flex: 1 1 240px; min-width: 180px; }
.rlv-campo--cond    { flex: 0 0 210px; }
.rlv-campo--monto   { flex: 0 0 120px; }
.rlv-campo--acciones { flex: 1 1 auto; }

.rlv-acciones { display: flex; gap: .4rem; }

/* ---- Atajos de periodo ---- */
.rlv-atajos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    padding-top: .5rem;
    border-top: 1px dashed var(--gris-borde);
}

.rlv-atajos__titulo {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--texto-sec);
    margin-right: .2rem;
}

.rlv-chip {
    border: 1px solid var(--gris-borde);
    background: #fff;
    color: var(--texto);
    border-radius: 999px;
    padding: .22rem .68rem;
    font-size: .76rem;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}

.rlv-chip:hover { background: #eaf4fd; border-color: var(--azul); color: var(--azul); }

.rlv-chip.is-activo {
    background: var(--azul);
    border-color: var(--azul);
    color: #fff;
    font-weight: 600;
}

.rlv-chip--todo { margin-left: auto; }

/* ---- Tarjetas de totales ---- */
.rlv-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .55rem;
    margin-bottom: .8rem;
}

.rlv-kpi {
    background: var(--gris-card);
    border: 1px solid var(--gris-borde);
    border-left: 3px solid var(--azul);
    border-radius: 8px;
    padding: .5rem .7rem;
    box-shadow: var(--sombra);
}

.rlv-kpi__label {
    display: block;
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--texto-sec);
}

.rlv-kpi__valor {
    display: block;
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--texto);
    margin-top: .1rem;
    font-variant-numeric: tabular-nums;
}

.rlv-kpi--docs  { border-left-color: var(--off); }
.rlv-kpi--total { border-left-color: var(--ok); background: #f6fdf8; }
.rlv-kpi--total .rlv-kpi__valor { color: #15803d; }

/* ---- Tabla ---- */
.rlv-tabla-wrap {
    position: relative;
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    background: var(--gris-card);
    /* La tabla scrollea dentro de su contenedor: la pagina nunca scrollea
       horizontalmente aunque haya 13 columnas. */
    overflow: auto;
    max-height: 58vh;
    box-shadow: var(--sombra);
}

.rlv-tabla {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .8rem;
}

.rlv-tabla thead th {
    position: sticky;   /* el encabezado queda fijo al hacer scroll */
    top: 0;
    z-index: 2;
    background: var(--azul);
    color: #fff;
    font-size: .69rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    text-align: left;
    padding: .5rem .5rem;
    white-space: nowrap;
    border-bottom: 1px solid #1668a8;
}

.rlv-tabla thead th[data-orden] { cursor: pointer; user-select: none; }
.rlv-tabla thead th[data-orden]:hover { background: #1a78c2; }
.rlv-tabla thead th.is-activo { background: #166ba9; }
.rlv-sort { margin-left: .15rem; font-size: .72rem; opacity: .95; }

.rlv-th--num  { text-align: right; }
.rlv-th--mini { text-align: center; }

.rlv-tabla tbody td {
    padding: .38rem .5rem;
    border-bottom: 1px solid #eef2f7;
    color: var(--texto);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.rlv-tabla tbody tr:nth-child(even) { background: #fafcfe; }
.rlv-tabla tbody tr:hover { background: #eaf4fd; }

.rlv-td--num   { text-align: right; font-variant-numeric: tabular-nums; }
.rlv-td--mini  { text-align: center; color: var(--texto-sec); }
.rlv-td--fecha { white-space: nowrap; }
.rlv-td--folio { font-weight: 600; color: var(--azul); }
.rlv-td--cond  { color: var(--texto-sec); font-size: .76rem; }
.rlv-td--total { font-weight: 700; }
.rlv-td--sindato { color: var(--off); font-style: italic; }

.rlv-tag {
    display: inline-block;
    background: #eef2f7;
    color: var(--texto-sec);
    border-radius: 4px;
    padding: .05rem .32rem;
    font-size: .7rem;
    font-weight: 600;
}

.rlv-vacio td {
    text-align: center;
    padding: 2.2rem 1rem;
    color: var(--texto-sec);
    font-size: .85rem;
    white-space: normal;
}

.rlv-vacio i { display: block; font-size: 1.6rem; margin-bottom: .4rem; opacity: .55; }

/* ---- Indicador de carga ---- */
.rlv-cargando {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: rgba(255, 255, 255, .78);
    font-size: .85rem;
    color: var(--texto-sec);
    z-index: 3;
}

.rlv-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--gris-borde);
    border-top-color: var(--azul);
    border-radius: 50%;
    animation: rlv-giro .6s linear infinite;
}

@keyframes rlv-giro { to { transform: rotate(360deg); } }

/* Respeta a quien pidio menos animacion en su sistema. */
@media (prefers-reduced-motion: reduce) {
    .rlv-spinner { animation: none; }
}

/* ---- Pie / paginacion ---- */
.rlv-pie {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .7rem;
}

.rlv-pie__info { font-size: .78rem; color: var(--texto-sec); }

.rlv-pag { display: flex; align-items: center; gap: .3rem; }

.rlv-pag__actual {
    font-size: .78rem;
    color: var(--texto-sec);
    display: flex;
    align-items: center;
    gap: .3rem;
    margin: 0 .3rem;
}

.rlv-pag__input {
    width: 52px;
    height: 27px;
    text-align: center;
    border: 1px solid var(--gris-borde);
    border-radius: 5px;
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
}

.rlv-pag .btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---- Modo ventana (popup) ---- */
.body--standalone .reporte-lv.panel {
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    min-height: 100vh;
}

.body--standalone .rlv-tabla-wrap { max-height: 50vh; }

/* ---- Pantallas chicas ---- */
@media (max-width: 900px) {
    .rlv-campo--fecha, .rlv-campo--rut, .rlv-campo--cond { flex: 1 1 140px; }
    .rlv-campo--acciones { flex: 1 1 100%; }
    .rlv-acciones { justify-content: flex-start; }
    .rlv-chip--todo { margin-left: 0; }
    .rlv-tabla-wrap { max-height: 62vh; }
}
