:root {
    --a: #6d5dfc;
    --b: #ff7ab8;
    --c: #2fd3c0;
    --r: 26px;
    --blur: 22px;
    --g: .42;
    --bd: .75;
    --font: 'Sora', system-ui, sans-serif;
    --tx: #1d1b34;
    --mu: #6c6a85;
    --bg: #fff;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px)
}

html {
    scroll-padding-top: env(safe-area-inset-top, 0px)
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--tx);
    font-family: var(--font);
    min-height: 100vh;
    overflow-x: hidden
}

.blobs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden
}

.blobs i {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .55;
    animation: fl 18s ease-in-out infinite alternate
}

.blobs i:nth-child(1) {
    width: 46vw;
    height: 46vw;
    background: var(--a);
    left: -10vw;
    top: -12vw
}

.blobs i:nth-child(2) {
    width: 38vw;
    height: 38vw;
    background: var(--b);
    right: -8vw;
    top: 18vh;
    animation-delay: -6s
}

.blobs i:nth-child(3) {
    width: 34vw;
    height: 34vw;
    background: var(--c);
    left: 30vw;
    bottom: -14vw;
    animation-delay: -11s
}

.noanim .blobs i {
    animation: none
}

@keyframes fl {
    to {
        transform: translate(6vw, 5vh) scale(1.15)
    }
}

.glass {
    background: linear-gradient(135deg, rgba(255, 255, 255, calc(var(--g) + .25)), rgba(255, 255, 255, var(--g)));
    backdrop-filter: blur(var(--blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
    border: 1px solid rgba(255, 255, 255, var(--bd));
    border-radius: var(--r);
    box-shadow: 0 10px 40px rgba(60, 50, 120, .12), inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .3);
    position: relative
}

.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(120% 60% at 20% -10%, rgba(255, 255, 255, .7), transparent 55%)
}

.app {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 18px;
    padding: 18px;
    max-width: 1500px;
    margin: auto
}

.rail {
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 0
}

.logo {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--a), var(--b));
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--a) 50%, transparent);
    margin-bottom: 10px
}

.nb {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    border: 0;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    transition: .25s;
    color: var(--mu)
}

.nb:hover,
.nb.on {
    background: rgba(255, 255, 255, .8);
    color: var(--a);
    box-shadow: 0 6px 16px rgba(60, 50, 120, .15)
}

.nb:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--a);
    outline-offset: 2px
}

main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px
}

header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    flex-wrap: wrap
}

header h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -.02em
}

header p {
    margin: 2px 0 0;
    color: var(--mu);
    font-size: 13px
}

.sp {
    flex: 1
}

.btn {
    border: 0;
    cursor: pointer;
    font: 600 14px var(--font);
    padding: 12px 20px;
    border-radius: calc(var(--r) * .7);
    color: #fff;
    background: linear-gradient(135deg, var(--a), var(--b));
    box-shadow: 0 8px 22px color-mix(in srgb, var(--a) 40%, transparent);
    transition: .25s
}

.btn:hover {
    transform: translateY(-2px)
}

.btn.gl {
    background: rgba(255, 255, 255, .65);
    color: var(--tx);
    box-shadow: inset 0 1px 0 #fff, 0 4px 14px rgba(60, 50, 120, .1)
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 18px
}

.w {
    padding: 20px 22px
}

.w h3 {
    margin: 0 0 4px;
    font-size: 15px
}

.w .sub {
    color: var(--mu);
    font-size: 12.5px;
    margin-bottom: 12px
}

.k {
    grid-column: span 3
}

.kpi .ic {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 20px;
    background: color-mix(in srgb, var(--kc) 18%, white);
    box-shadow: inset 0 1px 0 #fff
}

.kpi .v {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -.03em;
    margin: 12px 0 2px;
    font-variant-numeric: tabular-nums
}

.kpi .l {
    color: var(--mu);
    font-size: 13px
}

.kpi .d {
    position: absolute;
    right: 20px;
    top: 22px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--kc) 16%, white);
    color: var(--kc)
}

.kpi svg {
    position: absolute;
    right: 16px;
    bottom: 14px;
    width: 90px;
    height: 34px;
    opacity: .9
}

.kpi:hover {
    transform: translateY(-3px)
}

.kpi {
    transition: .3s
}

.c3 {
    grid-column: span 3
}

.c6 {
    grid-column: span 6
}

.c12 {
    grid-column: span 12
}

.c8 {
    grid-column: span 8
}

.c4 {
    grid-column: span 4
}

.c5 {
    grid-column: span 5
}

.c7 {
    grid-column: span 7
}

.chart {
    width: 100%;
    height: 230px;
    display: block
}

.chart text {
    fill: var(--mu);
    font: 11px var(--font)
}

.draw {
    stroke-dasharray: var(--len);
    stroke-dashoffset: var(--len);
    animation: dr 1.6s .2s ease forwards
}

.noanim .draw {
    animation: none;
    stroke-dashoffset: 0
}

@keyframes dr {
    to {
        stroke-dashoffset: 0
    }
}

.legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--mu);
    margin-top: 8px
}

.legend b {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .6)
}

.row:last-child {
    border: 0
}

.av {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    background: linear-gradient(135deg, var(--a), var(--c))
}

.row .n {
    font-weight: 600;
    font-size: 14px
}

.row .s {
    font-size: 12px;
    color: var(--mu)
}

.pill {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .7)
}

.prog {
    height: 10px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .7);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(60, 50, 120, .12);
    margin: 6px 0 4px
}

.prog i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 9px;
    background: linear-gradient(90deg, var(--a), var(--b));
    transition: width 1.4s cubic-bezier(.2, .8, .2, 1);
    position: relative;
    overflow: hidden
}

.prog i::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
    animation: sh 2.2s infinite
}

.noanim .prog i::after {
    animation: none
}

@keyframes sh {
    from {
        transform: translateX(-100%)
    }

    to {
        transform: translateX(100%)
    }
}

.tk {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px
}

.tk button {
    aspect-ratio: 1;
    border: 0;
    border-radius: calc(var(--r) * .35);
    font: 600 11px var(--font);
    cursor: pointer;
    background: rgba(255, 255, 255, .7);
    color: var(--mu);
    transition: .2s
}

.tk button.s {
    background: linear-gradient(135deg, var(--a), var(--b));
    color: #fff
}

.tk button.p {
    outline: 2px solid var(--c)
}

.tk button:hover {
    transform: scale(1.12)
}

.fab {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 22px;
    padding: 0
}

/* toasts */
#toasts {
    position: fixed;
    top: calc(18px + env(safe-area-inset-top, 0px));
    right: 18px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(340px, calc(100vw - 36px))
}

.toast {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-radius: calc(var(--r) * .7);
    animation: ti .45s cubic-bezier(.2, 1.2, .3, 1)
}

.toast.out {
    animation: to .3s forwards
}

.toast .ti {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--tc) 20%, white);
    flex: none
}

.toast b {
    font-size: 13.5px;
    display: block
}

.toast span {
    font-size: 12px;
    color: var(--mu)
}

.toast::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    border-radius: 3px;
    background: var(--tc);
    animation: tb 4s linear forwards;
    z-index: 2
}

@keyframes ti {
    from {
        opacity: 0;
        transform: translateX(40px) scale(.9)
    }
}

@keyframes to {
    to {
        opacity: 0;
        transform: translateX(40px)
    }
}

@keyframes tb {
    from {
        width: 100%
    }

    to {
        width: 0
    }
}

/* modal & drawer */
.ov {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(40, 35, 90, .22);
    backdrop-filter: blur(6px);
    display: none;
    place-items: center;
    padding: 16px
}

.ov.on {
    display: grid;
    animation: fi .25s
}

.modal {
    width: min(460px, 100%);
    padding: 28px;
    animation: mp .4s cubic-bezier(.2, 1.2, .3, 1);
    max-height: 92vh;
    overflow: auto
}

@keyframes fi {
    from {
        opacity: 0
    }
}

@keyframes mp {
    from {
        opacity: 0;
        transform: scale(.9) translateY(20px)
    }
}

.modal h2 {
    margin: 0 0 4px;
    font-size: 20px
}

.modal p {
    color: var(--mu);
    font-size: 13.5px;
    margin: 0 0 16px
}

label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin: 12px 0 5px
}

input[type=text],
input[type=number],
select {
    width: 100%;
    padding: 11px 14px;
    border-radius: calc(var(--r) * .5);
    border: 1px solid rgba(255, 255, 255, .9);
    background: rgba(255, 255, 255, .65);
    font: 14px var(--font);
    color: var(--tx)
}

.acts {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 100%);
    z-index: 55;
    padding: 22px;
    transform: translateX(110%);
    transition: transform .5s cubic-bezier(.2, .9, .2, 1);
    overflow: auto;
    border-radius: var(--r) 0 0 var(--r);
    padding-top: calc(22px + env(safe-area-inset-top, 0px))
}

.drawer.on {
    transform: none
}

.sw {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.sw button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2)
}

.rg {
    display: flex;
    align-items: center;
    gap: 10px
}

.rg input {
    flex: 1;
    accent-color: var(--a)
}

.rg span {
    font-size: 12px;
    width: 36px;
    color: var(--mu)
}

input[type=color] {
    width: 46px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: none;
    padding: 0;
    cursor: pointer
}

.cols {
    display: flex;
    gap: 12px
}

.roll {
    font-size: 54px;
    font-weight: 700;
    text-align: center;
    letter-spacing: .05em;
    margin: 18px 0 6px;
    background: linear-gradient(135deg, var(--a), var(--b));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-variant-numeric: tabular-nums
}

.win {
    text-align: center;
    min-height: 50px;
    font-size: 15px
}

.cf {
    position: fixed;
    width: 9px;
    height: 14px;
    z-index: 70;
    pointer-events: none;
    animation: cf 1.6s ease-out forwards
}

@keyframes cf {
    to {
        transform: translate(var(--x), var(--y)) rotate(720deg);
        opacity: 0
    }
}

@media(max-width:1000px) {
    .k {
        grid-column: span 6
    }

    .c8,
    .c4,
    .c5,
    .c7,
    .c3,
    .c6 {
        grid-column: span 12
    }
}

@media(max-width:640px) {
    .app {
        grid-template-columns: 1fr;
        padding: 12px
    }

    .rail {
        display: none
    }

    .k {
        grid-column: span 12
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        animation-duration: .01s !important
    }
}

@media(prefers-color-scheme:dark) {
    :root:not([data-theme="light"]) {
        --bg: #fff
    }
}

:root[data-theme="dark"] {
    --bg: #fff
}

.kpi .ic {
    color: var(--kc);
    font-size: 18px
}

.toast .ti {
    font-size: 15px
}

.nb {
    font-size: 19px
}

.btn svg {
    margin-right: 6px
}

.tw {
    overflow-x: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 560px
}

th {
    text-align: left;
    color: var(--mu);
    font-weight: 600;
    font-size: 12px;
    padding: 8px
}

td {
    padding: 11px 8px;
    border-top: 1px solid rgba(255, 255, 255, .75)
}

tbody tr {
    transition: .2s
}

tbody tr:hover td {
    background: rgba(255, 255, 255, .45)
}

.st {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 99px;
    color: var(--kc);
    background: color-mix(in srgb, var(--kc) 15%, white)
}

.tools {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap
}

.tools input {
    flex: 1;
    min-width: 160px
}

.tools select {
    width: auto
}

.hm {
    display: grid;
    grid-template-columns: 34px repeat(12, 1fr);
    gap: 4px;
    font-size: 11px;
    color: var(--mu);
    align-items: center
}

.hm i {
    height: 24px;
    border-radius: 7px;
    display: block;
    transition: .2s
}

.hm i:hover {
    transform: scale(1.2)
}

.tlr {
    display: flex;
    gap: 12px;
    padding: 0 0 16px;
    position: relative
}

.tlr::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 34px;
    bottom: 0;
    width: 2px;
    background: rgba(120, 110, 170, .2)
}

.tlr:last-child::before {
    display: none
}

.tdot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: none;
    color: var(--kc);
    background: color-mix(in srgb, var(--kc) 16%, white);
    font-size: 14px;
    box-shadow: inset 0 1px 0 #fff
}

.hb {
    height: 12px;
    border-radius: 9px;
    background: linear-gradient(90deg, var(--a), var(--b));
    width: 0;
    transition: width 1.3s cubic-bezier(.2, .8, .2, 1)
}

.fn {
    height: 42px;
    margin: 6px auto;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    width: 0;
    transition: width 1.2s cubic-bezier(.2, .8, .2, 1)
}

.rings {
    display: flex;
    justify-content: space-around;
    gap: 8px;
    flex-wrap: wrap
}

.rg2 {
    text-align: center;
    font-size: 12px;
    color: var(--mu)
}

/* ===== MVC extras ===== */
a.nb {
    display: grid;
    place-items: center;
    text-decoration: none
}

input[type=email],
input[type=password],
input[type=date],
textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: calc(var(--r) * .5);
    border: 1px solid rgba(255, 255, 255, .9);
    background: rgba(255, 255, 255, .65);
    font: 14px var(--font);
    color: var(--tx)
}

.usr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 6px
}

.usr span {
    font-size: 13.5px;
    font-weight: 600
}

.usr .nb {
    width: 38px;
    height: 38px;
    font-size: 16px
}

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    position: relative;
    z-index: 1
}

.login-card {
    width: min(400px, 100%);
    padding: 36px 32px
}

.login-card .logo {
    margin: 0 auto 14px
}

.login-card h1 {
    margin: 0;
    text-align: center;
    font-size: 24px
}

.login-card>p {
    text-align: center;
    color: var(--mu);
    font-size: 13.5px;
    margin: 6px 0 18px
}

.alert {
    padding: 10px 14px;
    border-radius: calc(var(--r) * .5);
    background: color-mix(in srgb, #ee4d5f 14%, white);
    color: #c43a4a;
    font-size: 13px;
    margin-bottom: 6px
}

.hint {
    text-align: center;
    font-size: 12px;
    color: var(--mu);
    margin: 16px 0 0
}

.ia {
    display: inline-flex;
    gap: 6px
}

.ia button,
.ia a {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 11px;
    background: rgba(255, 255, 255, .7);
    color: var(--mu);
    cursor: pointer;
    display: grid;
    place-items: center;
    text-decoration: none;
    transition: .2s
}

.ia button:hover {
    color: #ee4d5f;
    transform: translateY(-2px)
}

.empty {
    text-align: center;
    color: var(--mu);
    padding: 30px 0;
    font-size: 14px
}

@media(max-width:640px) {
    .rail {
        display: flex;
        position: fixed;
        top: auto;
        bottom: 10px;
        left: 10px;
        right: 10px;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        padding: 8px;
        z-index: 40
    }

    .rail .sp,
    .rail .logo {
        display: none
    }

    .app {
        padding-bottom: 92px
    }

    .usr span {
        display: none
    }
}




/* SIDEBAR */
/* ===== Sidebar con texto ===== */
@media(min-width:641px) {
    .app {
        grid-template-columns: 230px 1fr
    }

    .rail {
        align-items: stretch;
        padding: 16px 12px
    }

    .rail .logo {
        align-self: center
    }

    .rail .nb {
        position: relative;
        width: 100%;
        height: 46px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding: 0 14px;
        font: 600 14px var(--font);
        text-align: left;
        text-decoration: none;
        white-space: nowrap
    }

    .rail .nb i {
        width: 22px;
        text-align: center;
        font-size: 18px;
        flex: none
    }

    .rail .bdg {
        position: static;
        margin-left: auto
    }
}

/* En celular se queda solo con iconos (barra inferior) */
@media(max-width:640px) {
    .rail .lbl {
        display: none
    }
}



/* ---- Logo con imagen en el sidebar ---- */
.rail .logo.has-img{
    width:100%;
    max-width:180px;
    height:auto;
    aspect-ratio:auto;
    border-radius:0;
    background:none;
    box-shadow:none;
    overflow:visible;
    padding:0;
    align-self:center
}
.rail .logo.has-img img{
    width:100%;
    height:auto;
    object-fit:contain;
    display:block
}

/* ===== Fondo con los colores del tema (sin blanco) ===== */
body{
    background:linear-gradient(135deg,var(--a) 0%,var(--b) 50%,var(--c) 100%) fixed;
    min-height:100vh
}
.blobs i{opacity:.35}

/* Tarjetas de vidrio con menos blanco */
.glass{
    background:linear-gradient(135deg,rgba(255,255,255,.34),rgba(255,255,255,.18));
    border:1px solid rgba(255,255,255,.45)
}
.glass::after{
    background:radial-gradient(120% 60% at 20% -10%,rgba(255,255,255,.16),transparent 55%)
}



