/* Tablas con esquinas redondeadas */
.table-rounded {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.table-rounded th:first-child {
    border-top-left-radius: 16px;
}
.table-rounded th:last-child {
    border-top-right-radius: 16px;
}
.table-rounded tr:last-child td:first-child {
    border-bottom-left-radius: 16px;
}
.table-rounded tr:last-child td:last-child {
    border-bottom-right-radius: 16px;
}
:root {
    /* Fallback base: coincide con warm-vibrant */
    --theme-bg: #f2f7eb;
    --theme-card-bg-light: #edf5e2;
    --theme-card-hover: #dfeccd;
    --theme-sidebar: #2f4f32;
    --theme-sidebar-hover: #3f6842;
    --theme-sidebar-text: #edf3df;
    --theme-sidebar-active-border: #c6dc98;
    --theme-accent-bg: #dfebcd;
    --theme-accent-border: #9fb87b;
    --theme-accent-text: #223824;
    --theme-primary: #4f8b2c;
    --theme-primary-hover: #3d6f21;
    --theme-focus: #4f8b2c;
    --theme-dollar-green: #4f8b2c;
    --theme-dollar-beige: #edf3df;
    --theme-dollar-gray: #9fb87b;
    --theme-dollar-black: #1f2d20;
    --theme-dollar-white: #f2f7eb;
}

body[data-theme="warm-vibrant"] {
    /* Verde más intenso y contraste más alto */
    --theme-bg: #f2f7eb;
    --theme-card-bg-light: #edf5e2;
    --theme-card-hover: #dfeccd;
    --theme-sidebar: #2f4f32;
    --theme-sidebar-hover: #3f6842;
    --theme-sidebar-text: #edf3df;
    --theme-sidebar-active-border: #c6dc98;
    --theme-accent-bg: #dfebcd;
    --theme-accent-border: #9fb87b;
    --theme-accent-text: #223824;
    --theme-primary: #4f8b2c;
    --theme-primary-hover: #3d6f21;
    --theme-focus: #4f8b2c;
    --theme-dollar-green: #4f8b2c;
    --theme-dollar-beige: #edf3df;
    --theme-dollar-gray: #9fb87b;
    --theme-dollar-black: #1f2d20;
    --theme-dollar-white: #f2f7eb;
}

body[data-theme="warm-soft"] {
    /* Verde más apagado y suave */
    --theme-bg: #f6f7f2;
    --theme-card-bg-light: #f8faf5;
    --theme-card-hover: #eff3e9;
    --theme-sidebar: #4a5d4b;
    --theme-sidebar-hover: #5c735e;
    --theme-sidebar-text: #e6ead9;
    --theme-sidebar-active-border: #becab0;
    --theme-accent-bg: #e8ecdf;
    --theme-accent-border: #b7c2a7;
    --theme-accent-text: #2f3d30;
    --theme-primary: #6b8e23;
    --theme-primary-hover: #55741f;
    --theme-focus: #6b8e23;
    --theme-dollar-green: #6b8e23;
    --theme-dollar-beige: #e6ead9;
    --theme-dollar-gray: #b7c2a7;
    --theme-dollar-black: #253125;
    --theme-dollar-white: #f6f7f2;
}

body[data-theme="dark"] {
    /* Paleta inspirada en dólares (modo oscuro) */
    --theme-bg: #23291e;
    --theme-card-bg-light: #2d3a2e;
    --theme-card-hover: #3a4d3b;
    --theme-sidebar: #2d3a2e;
    --theme-sidebar-hover: #3a4d3b;
    --theme-sidebar-text: #e6e9d8;
    --theme-sidebar-active-border: #6b8e23;
    --theme-accent-bg: #2d3a2e;
    --theme-accent-border: #6b8e23;
    --theme-accent-text: #e6e9d8;
    --theme-primary: #b7c2a7;
    --theme-primary-hover: #e6e9d8;
    --theme-focus: #b7c2a7;
}

body{
    background:var(--theme-bg);
}


.sidebar{
    height:100vh;
    background:var(--theme-sidebar);
    color:white;
    position:fixed;
    width:210px;
}

.main {
    margin-left: 210px;
    transition: margin-left 0.2s;
}

.main--public {
    margin-left: 0 !important;
}

.sidebar-head {
    display: block;
}

.sidebar-nav {
    display: block;
}

.sidebar-toggle {
    display: none;
    border: none;
    background: transparent;
    color: var(--theme-sidebar-text);
    font-size: 26px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
}

.sidebar-toggle:hover {
    background: var(--theme-sidebar-hover);
    color: white;
    cursor: pointer;
}

.sidebar a{
    color:var(--theme-sidebar-text);
    text-decoration:none;
    display:block;
    padding:12px 20px;
}

.sidebar a:hover{
    background:var(--theme-sidebar-hover);
    color:white;
}

.sidebar a.active{
    background:var(--theme-sidebar-hover);
    color:white;
    border-left:4px solid var(--theme-sidebar-active-border);
}

.sidebar-link {
    display: block;
    padding: 12px 20px;
    color:var(--theme-sidebar-text);
    text-decoration: none;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
}

.sidebar button:hover {
    background-color: var(--theme-sidebar-hover);
    color: #ffe8cc;
    cursor: pointer;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 22px;
    font-weight: bold;
    padding: 20px;
    color: white;
}

.logo-icon {
    font-size: 32px;
    color: #fdba74;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 8px rgba(253, 186, 116, 0.4),
        -1px -1px 2px rgba(255, 255, 255, 0.2),
        1px 1px 2px rgba(0, 0, 0, 0.4);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
    animation: pulse-glow 2s ease-in-out infinite;
}

.logo-text {
    background: linear-gradient(135deg, #ffe9d2 0%, white 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

.main{
    margin-left:210px;
}

.topbar{
    background:white;
    border-bottom:1px solid #e5e7eb;
    padding:10px 25px;
    align-items: flex-start;
    flex-wrap: wrap;
    row-gap: 6px;
}

.topbar-greeting-block {
    flex: 1 1 540px;
    min-width: 320px;
}

.topbar-user-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
    align-self: flex-start;
    flex: 0 0 auto;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.theme-toggle-icon {
    font-size: 14px;
    line-height: 1;
    color: var(--theme-accent-text);
    opacity: 0.45;
    user-select: none;
    transform: scale(0.95);
    transition: opacity .2s ease, transform .2s ease, filter .2s ease;
}

.theme-toggle.theme-is-soft .theme-toggle-icon--moon,
.theme-toggle.theme-is-vibrant .theme-toggle-icon--sun {
    opacity: 1;
    transform: scale(1.08);
    filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--theme-focus) 30%, transparent));
}

.theme-toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 42px;
    height: 24px;
    margin: 0;
    cursor: pointer;
}

.theme-toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: color-mix(in srgb, var(--theme-accent-border) 70%, #fff 30%);
    border: 1px solid var(--theme-accent-border);
    transition: all .2s ease;
}

.theme-toggle-slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .2s ease;
}

.theme-toggle-switch input:checked + .theme-toggle-slider {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
}

.theme-toggle-switch input:checked + .theme-toggle-slider::before {
    transform: translateX(18px);
}

.theme-toggle-switch input:focus-visible + .theme-toggle-slider {
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--theme-focus) 24%, transparent);
}

.card{
    border:none;
    border-radius:12px;
    box-shadow:0 5px 15px rgba(0,0,0,.05);
}

.app-messages {
    margin-bottom: 16px;
}

.app-message {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    margin-bottom: 10px;
}

.app-message--success {
    background: #eefaf3;
    border-color: #c9ecd6;
    color: #1f6b3b;
}

.app-message--error {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #b42318;
}

.app-message--warning {
    background: #fff8eb;
    border-color: #fde68a;
    color: #92400e;
}

.app-message--info {
    background: var(--theme-accent-bg);
    border-color: var(--theme-accent-border);
    color: var(--theme-accent-text);
}

.metric{
    font-size:28px;
    font-weight:bold;
}

.sidebar-group {
    margin: 18px 0 0 0;
    padding: 0 0 0 0;
}
.sidebar-group-title {
    font-size: 0.98em;
    font-weight: 600;
    color: #ffd6a0;
    padding: 8px 20px 4px 20px;
    letter-spacing: 0.5px;
    opacity: 0.85;
    /* Ajuste para alinear con las opciones principales */
    margin-left: 0;
}
.sidebar-sub {
    padding-left: 40px !important;
    font-size: 0.97em;
    color: var(--theme-sidebar-text);
    opacity: 0.92;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.sidebar-sub.active {
    background: var(--theme-sidebar-hover);
    border-left: 3px solid var(--theme-sidebar-active-border);
    color: #fff;
    opacity: 1;
}
.sidebar a.active {
    background: var(--theme-sidebar-hover);
    border-left: 3px solid var(--theme-sidebar-active-border);
    color: #fff;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 190px;
    }

    .main {
        margin-left: 190px;
    }

    .topbar {
        padding: 10px 18px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        display: block;
        padding: 0 10px 10px 10px;
    }

    .sidebar-head {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        width: auto;
        padding: 14px 8px 10px 8px;
        font-size: 20px;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 4px;
    }

    .sidebar-nav {
        display: none;
        width: 100%;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
    }

    .sidebar.is-open .sidebar-nav {
        display: flex;
    }

    .sidebar a,
    .sidebar-link {
        display: inline-block;
        width: auto;
        padding: 8px 10px;
        border-radius: 8px;
    }

    .sidebar a.active {
        border-left: none;
        border-bottom: 2px solid var(--theme-sidebar-active-border);
    }

    .sidebar hr {
        width: 100%;
        margin: 8px 0;
        opacity: 0.25;
    }

    .sidebar form {
        width: auto;
        margin-left: auto;
    }

    .main {
        margin-left: 0;
    }

    .topbar {
        padding: 10px 14px;
        align-items: flex-start;
        row-gap: 8px;
    }

    .topbar-greeting-block {
        min-width: 0;
        flex-basis: 100%;
        order: 2;
    }

    .topbar-user-controls {
        margin-left: 0;
        margin-top: 0;
        width: 100%;
        justify-content: flex-end;
        order: 1;
    }
}

/* Tooltip Bootstrap personalizado */
.custom-tooltip.bs-tooltip-auto[data-popper-placement^=top] .tooltip-arrow::before,
.custom-tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
.custom-tooltip .tooltip-inner {
    border-radius: 12px !important;
    white-space: pre-line !important;
    max-width: 220px;
    text-align: center;
    font-size: 1rem;
    line-height: 1.3;
    padding: 10px 16px;
}

